Skip to main content

Exoplayer 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
}
}

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.
  • retainBackBufferFromKeyframe: Retains media starting from the keyframe before the specified back buffer duration, maintaining smoother playback and reduced load.
  • prioritizeTimeOverSizeThresholds: Prioritizes buffer time over size, enhancing playback stability, especially in low-bandwidth conditions.
  • bufferForPlaybackMs, minBufferMs, maxBufferMs, bufferForPlaybackAfterRebufferMs: Control buffering thresholds to balance load and playback smoothness.
  • targetBufferBytes: Sets target buffer size to help manage memory for uninterrupted playback.
  • liveMinSpeed, liveMaxSpeed: Define speed adjustments for maintaining live offset during playback.
  • liveMinOffsetMs, liveMaxOffsetMs, liveTargetOffsetMs: Set minimum, maximum, and target live offset for responsive playback adjustments.
  • targetLiveOffsetIncrementOnRebufferMs: Adds buffer to the live offset post-rebuffer to minimize future interruptions.
  • proportionalControlFactor: Smooths playback adjustments, balancing between sudden vs. gradual transitions.
  • minPossibleLiveOffsetSmoothingFactor: Smooths adjustments to live offset, adapting playback speed to network conditions.

For more, please refer to the official documentation.