Lumen help
Mesh Delivery for Streaming can be easily integrated into your Android and Android TV app in just a few simple steps using our SDK for Android. In this guide, we will show you how to integrate Mesh Delivery using ExoPlayer on Android.
Not into tutorials?
Dependencies
The easiest way to get the Lumen SDK is to add it as a Gradle dependency. We assume you are using Android Studio with the latest tools updates as recommended by Google. If not, write to us at cdnsupport@lumen.com.
Next, add the Streamroot dependency to the build.gradle file of your app module.
Integrate Lumen SDK
1. Set deliveryClientKey
Before doing anything, you must set the deliveryClientKey as a metadata in the application manifest.
deliveryClientKey: Refers to your Lumen unique identifier that you will find in the Account section of the Mesh Delivery Dashboard. If you don't have a deliveryClientKey, you can ask for a free trial on our website.
Note: It is also possible to pass your deliveryClientKey at Lumen Delivery Client instantiation and initialization.
2. SDK Initialization
SDK initialization is done preferably in an application context subclass.
3. Create a new Lumen Delivery Client instance
Now that you have set the deliveryClientKey, you are able to create the Lumen Delivery Client instances.
Other DNA options can be called in the builder. Please refer to dnaConfig overview for android to learn more about them.
Important:
It is also required to pass the loadControl during the player instantiation.
On Live streaming, to improve offload efficiency, we recommend to change the default value of the minimal buffer target to 10s. In order to do so, you need to change the instantiation of the default Exoplayer class DefaultLoadControl with this one:
4. Start the SDK instance
Calling the start() method on the DC will start the SDK.
5. Give your player the new URL
Once you have a running instance of the SDK, you must retrieve the final URL and input it to your player instead of your original one.
To maximize compatibility with the SDK we strongly encourage you to allow HTTP <-> HTTPS cross protocol redirects in your ExoPlayer media sources. See below for more details.
6. Stop the Lumen Delivery Client
Once the video is done playing, you have to stop the SDK you created earlier. Calling the following method will finish the ongoing tasks and release the resources.
7. Integrate the player interactor
This player interactor module will link ExoPlayer events to our SDK in order to get accurate metrics regarding the client session.
Here is an example of the class to add to the app in order to do so.
Important:
As we use this API at a low frequency, we've decided to uses reflection for this implementation.
It is therefore required to blacklist all ExoPlayer classes when using either Proguard like so
8. Network security configuration
Starting with Android 9 (API level 28), cleartext support is disabled by default.
As Streamroot SDK works as a local HTTP proxy, it is required to do one of the following
More info can be found in the Android documentation.
Explore CDN services