Skip to main content

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.

targetBufferBytes​

Sets target buffer size to help manage memory for uninterrupted playback.

  • Performance Impact: By limiting the buffer size, it helps optimize memory usage, particularly on devices with limited resources.
  • SPI Reliability: Reduces the likelihood of playback stalls due to memory exhaustion, thus enhancing reliability, especially on low-end devices.

liveMinSpeed, liveMaxSpeed​

Define speed adjustments for maintaining live offset during playback.

  • Performance Impact: These adjustments help maintain a stable live offset, reducing lag and improving the viewing experience for live content.
  • SPI Reliability: Enhances the ability to stay in sync with live streams, reducing latency and avoiding interruptions.

liveMinOffsetMs, liveMaxOffsetMs, liveTargetOffsetMs​

Set minimum, maximum, and target live offset for responsive playback adjustments.

  • Performance Impact: Helps maintain consistent live playback, reducing latency while avoiding excessive buffering.
  • SPI Reliability: Ensures adaptive playback adjustments that align with network conditions, maintaining a smooth experience during live streaming.

targetLiveOffsetIncrementOnRebufferMs​

Adds buffer to the live offset post-rebuffer to minimize future interruptions.

  • Performance Impact: Helps reduce the frequency of rebuffering by increasing the live offset after stalls, leading to smoother recovery.
  • SPI Reliability: Improves playback resilience by giving additional buffer space after interruptions, thereby enhancing stability.

proportionalControlFactor​

Smooths playback adjustments, balancing between sudden vs. gradual transitions.

  • Performance Impact: Helps in smoother playback by avoiding abrupt changes in playback speed, providing a more natural viewing experience.
  • SPI Reliability: Increases reliability by preventing sudden speed fluctuations, which can disrupt the user experience, especially during live streams.

minPossibleLiveOffsetSmoothingFactor​

Smooths adjustments to live offset, adapting playback speed to network conditions.

  • Performance Impact: Minimizes playback disruptions due to network instability, leading to a more fluid experience.
  • SPI Reliability: Enhances stability by allowing the player to adjust gradually to changes in live stream conditions, reducing the chances of rebuffering.

blacklistedCodecs​

Excludes specific codecs to prevent compatibility issues and enhance playback performance.

  • Performance Impact: Helps in avoiding playback issues due to incompatible codecs, ensuring a seamless viewing experience.
  • SPI Reliability: Increases reliability by preventing codec-related errors that can disrupt playback, leading to a more stable streaming experience.

For more, please refer to the official documentation.