Android Player configuration
What you learn​
You're instantiating DIVA Player in your app (mobile/TV) and relying on DIVA Back Office as the video streaming source.
The goal of this article is to build the simplest front-end to stream a video from the DIVA Back Office, having the possibility to control and modify ExoPlayer parameters dynamically and remotely.
Before starting​
- Ensure the DIVA Back Office instance you rely on is up and running.
- Ask your video engineers team
<videoId>
,<settingsURL>
,<languageCountryCode>
,<userToken>
and<sharedKey>
. - Ensure the settings file contains the
AndroidPlayerConfiguration
fields.
Instantiation​
The Basic instantiation code is sufficient.
In the settings
file, the AndroidPlayerConfiguration
section must contain the configuration, like in the following example:
"settings": {
"AndroidPlayerConfiguration":
{
"behindWindowJumptolive": true,
"retainBackBufferFromKeyframe": true,
"prioritizeTimeOverSizeThresholds": true,
"bufferForPlaybackMs": 2500,
"minBufferMs": 2500,
"maxBufferMs": 20000,
"bufferForPlaybackAfterRebufferMs": 2500,
"targetBufferBytes": 67108864,
"backBufferDurationMs": 4000,
"liveMinSpeed": 0.9,
"liveMaxSpeed": 4.1,
"liveMinOffsetMs": 10000,
"liveMaxOffsetMs": 30000,
"liveTargetOffsetMs": 20000,
"fallbackMinPlaybackSpeed": 0,
"proportionalControlFactor": 0,
"targetLiveOffsetIncrementOnRebufferMs": 0,
"minPossibleLiveOffsetSmoothingFactor": 0,
"blacklistedCodecs": [
"c2.android.avc.decoder",
"OMX.MTK.VIDEO.DECODER.AVC.secure",
"OMX.MTK.VIDEO.DECODER.AVC"
],
}
}
Here's an enhanced description of each parameter based on the official ExoPlayer live streaming documentation:
behindWindowJumptolive
​
Allows Diva to jump to the live position if the playback lags behind the live window, ensuring minimal delay.
- Performance Impact: It reduces latency by ensuring viewers are as close to the real-time broadcast as possible. This is particularly important for live events where delays can lead to a poor user experience.
- SPI Reliability: Enhances reliability by minimizing playback lag, ensuring users are always viewing content that's as close to real-time as possible. However, frequent jumps might affect playback smoothness.
retainBackBufferFromKeyframe
​
Retains media starting from the keyframe before the specified back buffer duration, maintaining smoother playback and reduced load.
- Performance Impact: Helps in reducing the load on the player by only retaining essential parts of the media. This results in smoother playback, especially during seeking operations.
- SPI Reliability: Increases reliability by preventing buffer underruns when rewinding or seeking, leading to a more stable playback experience.
prioritizeTimeOverSizeThresholds
​
Prioritizes buffer time over size, enhancing playback stability, especially in low-bandwidth conditions.
- Performance Impact: Provides a smoother viewing experience by ensuring that playback is continuous even if the data rate is inconsistent.
- SPI Reliability: Improves reliability under low-bandwidth conditions by adjusting the buffer strategy to maintain uninterrupted playback.
bufferForPlaybackMs
, minBufferMs
, maxBufferMs
, bufferForPlaybackAfterRebufferMs
​
Control buffering thresholds to balance load and playback smoothness.
- Performance Impact: Balancing these thresholds is crucial for reducing initial loading time, preventing frequent buffering, and optimizing memory usage.
- SPI Reliability: Properly configured values can significantly enhance playback stability, reduce rebuffering events, and ensure a smoother streaming experience.