Bitmovin
This documentation allow to set up and use the QUANTEEC plugin with the Android version of the Bitmovin player.
Add QUANTEEC plugin as a dependency
Add QUANTEEC plugin modules
The easiest way to get started using QUANTEEC plugin with ExoPlayer is to add Gradle dependencies to the libraries you need.
First, you need to declare the QUANTEEC Maven repository with your credentials. This declaration must be made in your settings.gradle file or build.gradle file, depending on the configuration of your project.
repositories {
...
maven {
url 'https://maven.quanteec.com/repository/internal/'
credentials {
username "username"
password "password"
}
authentication {
basic(BasicAuthentication)
}
}
}
To obtain your credentials for QUANTEEC Maven repository, please contact us by mail.
Then, you can add the dependencies in your build.gradle
file of your app module:
repositories {
dependencies {
...
implementation "com.quanteec:quanteecBitmovinPlugin:1.6.0"
implementation "com.quanteec:quanteecPlugin:1.6.0"
}
}
Where 1.6.0 is your preferred version.
Setting up the permissions
In order to function correctly, QUANTEEC plugin needs to have access to the network state of the Android devices. The network state is used to determine the type of network your device uses (mobile, wi-fi, or Ethernet) and adapt the behavior of the plugin to download segments.
Add the following permissions in the AndroidManifest.xml of your app module:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Create the QUANTEEC Configuration
You can create QUANTEEC configuration with a QuanteecConfig instance, which will describe the initial configuration of the QUANTEEC plugin.
- Kotlin
- Java
val quanteecConfig = QuanteecConfig.Builder("<your-quanteec-key>").setVideoID("<enter-your-custom-videoID>").build();
QuanteecConfig quanteecConfig = new QuanteecConfig.Builder("<your-quanteec-key>").setVideoID("<enter-your-custom-videoID>").build();
The creation of a QuanteecConfig instance with a Builder is only available for versions 1.3.0 and later. For older versions you must use a constructor :
- Kotlin
- Java
val quanteecConfig = QuanteecConfig("<enter-your-custom-videoID>", "<your-quanteec-key>");
QuanteecConfig quanteecConfig = new QuanteecConfig("<enter-your-custom-videoID>", "<your-quanteec-key>");
In your QUANTEEC configuration, remember to set a different videoID if you have different formats of the same stream (e.g., one DASH stream and one HLS stream) or two variants of the same stream (one stream with English audio and one stream with another language).
Create the QUANTEEC Core
You can next create a QuanteecBitmovinCore instance and link it to your Bitmovin Player after after its creation:
- Kotlin
- Java
Player player = new PlayerBuilder(/*Context*/ context)
.setPlayerConfig(playerConfig)
.build();
QuanteecBitmovinCore quanteecBitmovinCore = new QuanteecBitmovinCore(/*Context*/ context, config, player);
Good practice: try-catch block
One good practice is to encapsulate the instantiation of the QUANTEEC object within a try-catch block. This approach provides a robust mechanism for handling situations where QUANTEEC might not be available or may encounter compatibility issues.
Error handling
Embedding QUANTEEC in an Android app involves configuring and initializing the QUANTEEC plugin instance. If any issues arise during this process, such as missing dependencies or runtime errors, a try-catch block allows you to catch and handle these errors gracefully.
Unusual environments
Android devices and versions vary, and not all devices may support certain features or configurations of QUANTEEC. Wrapping the QUANTEEC initialization in a try-catch block allows you to account for scenarios where certain features might not be available on the user's device or where there are compatibility issues with the Android version.
QUANTEEC plugin and Android activity lifecycle
In order to manage efficiently the ressources used by the QUANTEEC plugin, it's important to take into account the activity lifecycle during the development of your application.
Releasing the ressources used by the Android plugin are not mandatory. But, if the application goes into background without doing it, the plugin will always be connected to others peer and will be able to send them data. This will happen even if you release the Exoplayer instance or stop the playback.
When you're application goes into background you have to possibiliy to free the ressources used by QUANTEEC. The first one is to totally release the QUANTEEC plugin by using this code for example :
- Kotlin
- Java
quanteecCore?.release();
quanteecCore = null;
quanteecCore.release();
quanteecCore = null;
In this case when your application come back in the foreground you'll have to recreate a new QUANTEEC plugin instance and link it to the player.
The second possibility is just to deactivate the plugin by using the function quanteecCore.activateQuanteec(false)
. This function will totally deactivate the use of QUANTEEC plugin. To activate it again all you have to do is to called quanteecCore.activateQuanteec(true)
when the application came back in the foreground. With this method, the reactivation of the QUANTEEC plugin will be faster. However some ressources, especially store in memory will not be free with such method.