Configure the Player for Low-Latency Streaming

Enabling low-latency streaming requires the configuration of certain player parameters:

Target Latency

The latency, i.e. distance from the stream's live edge, that the player should maintain during playback. For example, 6 seconds.

Latency Catchup/Fallback behavior

Deviations from the target latency can occur, for example, due to playback stalls under fluctuating network conditions. The player has means to return to the desired target latency if the deviation exceeds certain thresholds.

Latency catchup and fallback to the target latency is done in two possible ways. For small deviations playback speed manipulation (i.e. playing slightly faster or slower) is typically used. For larger deviations, it can be suitable to perform a seek. The player configuration offers the possibility to define individual threshold values for both of these methods.

Using Player Config Builder

The PlayerConfigBuilder util provides an easy way to enable low-latency streaming with minimal configuration effort.

import { Player, util } from 'bitmovin-player/modules/bitmovinplayer-core';

const config = new util.PlayerConfigBuilder("MY-PLAYER-KEY")
  .enableLowLatency({ targetLatency: 6 })
  .build();

const player = new Player(document.getElementById('container-id'), config);

For further information see the player configuration guide.

Manual Configuration

When manually creating a player config the main things to include are:

Example

const conf = {
  key: 'YOUR-PLAYER-KEY'
  live: {
    lowLatency: {
      targetLatency: 6,
      catchup: {
        playbackRateThreshold: 0.075,
        seekThreshold: 5,
        playbackRate: 1.2,
      },
      fallback: {
        playbackRateThreshold: 0.075,
        seekThreshold: 5,
        playbackRate: 0.95,
      },
    },
    synchronization: [
      {
        method: LiveSynchronizationMethod.HttpHead,
        serverUrl: 'https://time.akamai.com',
      },
    ],
  }
  tweaks: {
    RESTART_THRESHOLD: 0.2,
    RESTART_THRESHOLD_DELTA: 0.05,
    STARTUP_THRESHOLD: 0.2,
    STARTUP_THRESHOLD_DELTA: 0.05,
    LOW_LATENCY_BUFFER_GUARD: 0.8,
  }
};

The above configuration is a good starting point and equivalent to what the PlayerConfigBuilder would produce.

Note: For LL-DASH streams the player will automatically enable the chunked_cmaf_streaming tweak to use thefetch browser API for segment loading and switch the adaptation logic to the low-latency adaptation logic tailored to HTTP CTE.