THEOplayer Android [TV] SDK with Low Latency Manager
This projects falls under the license as defined in https://github.com/THEOplayer/license-and-disclaimer.
This Android project is an example how to integrate THEOplayer into an Android [TV] app with Latency Manager Plugin by THEOplayer.
How to implement a basic latency manager
This how-to-guide explains how to implement a basic latency manager for the THEOplayer sdk. This plugin is only valid for CMAF Low Latency DASH Streams.
Setup a Android Project and include the THEOplayer library and Low latency DASH stream. You can also check: How to get started with THEOplayer Android SDK
You would need a Android SDK of THEOplayer with basic configuration to setup your environment. You can create an SDK by signing-in to the THEO Portal Login Here
Quick Start to run the demo Android [TV] with Latency Manager
Obtain THEOplayer Android SDK and unzip it.
Please visit [Get Started with THEOplayer] to get required THEOplayer Android SDK.
theoplayer-android-[name]-[version]-minapi16-release.aarfile from unzipped SDK into application [libs] folder and rename it to
Project is configured to load SDK with such name, for using other name please change
implementation ':theoplayer@aar'dependency in [app-level build.gradle] file accordingly.
Open Android with Latency Manager application in Android Studio.
Android Studio should automatically synchronize and rebuild project. If this won't happen please select File > Sync Project with Gradle Files menu item to do it manually. Please note, that in very rare cases it will be required to synchronize project twice.
Select Run > Run 'app' menu item to run application on a device selected by default.
To change the device please select Run > Select Device... menu item.
Code Example to setup Latency manager in Android Project [TV]
Download the latency-manager js file (zipped). Extract the zipped file and save it in the assests folder of the Android project.
Add the Custom JS code to the
Add a new
LatencyParametersJava class and add repective code as like demo project
Add the below params of THEOplayer Source as well:
// Creating a TypedSource builder that defines the location of a single stream source TypedSource typedSource = TypedSource.Builder .typedSource() .src(getString(R.string.defaultSourceUrl)) .liveOffset(1.0) .lowLatency(true) .timeServer("https://time.akamai.com/?iso&ms=true") //There is a Timeserver Offered by THEOplayer also https://time.theoplayer.com .type(SourceType.DASH) .build(); // Creating a SourceDescription builder that contains the settings to be applied as a new THEOplayer source. SourceDescription.Builder sourceDescription = sourceDescription(typedSource); //Setting the source to the player player.setSource(sourceDescription.build());
- Initialise the
latencymanagerwith the following properties for the player. Example as below:
- Note: The default values of the Latency Manager params are as below:
this.targetlatency = 5000; this.timeserver = "https://time.theoplayer.com"; this.interval = 200; this.fireupdate = true; this.latencywindow = 250; this.ratechange = 0.08; this.seekwindow = 5000; this.sync = true;