Latency on Live
The CONNECT Player SDK for Browsers allows for adjustments to live latency of DASH streams; i.e. the target play head point relative to the actual live edge. This page describes the steps needed to adjust the latency experience together with code examples. It should be used alongside the supplied sample application.
Three options for adjusting the default latency of the player are offered, but their applicability depends on the capabilities of the encoder producing the live stream:
Non-CMAF streams
Number of segments
The player will offset the target play head from live by this number of stream segments. The experience will vary greatly depending on the length of the live stream segments.
This feature is designed for use where the segment duration is specified in the.mpd
file (files withSegmentTemplate@duration
rather than those withSegmentTemplate.SegmentTimeline
).
Number of seconds
The player will offset the target play head from live by this number of seconds
CMAF in chunk mode streams
Chunk mode allows media segments to be split into smaller chunks that can be made available before the entire media segment is completed.
Low Latency Mode
The player targets the play head from the last segment or even closer to the live edge by obtaining completed chunks within an incomplete segment.
Example code (Non-CMAF)
The value to apply for the lifecycle of the player is set as an option on otvtoolkit
:
Number of segments
JSlet playerInstance = otvplayer( plugins: { otvtoolkit: { liveDelayFragmentCount: 5 } }, liveui: true
Number of seconds
JSlet playerInstance = otvplayer( plugins: { otvtoolkit: { liveDelay: 60 } }, liveui: true
If you update the value during the lifecycle of the player, it will only take effect the next time the player is instantiated.
These configuration options should not be used together. If they are, the behaviour as configured by liveDelay
will take precedence.
Example code (CMAF chunked)
Enabling low latency is required on a per-stream basis by setting the flag at the same time as passing the URL, mime-type and token in the loaded callback:
const playerInstance = otvplayer(
"videoPlayer",
{
plugins: {
otvtoolkit: {}
},
liveui: true
},
() => {
playerInstance.src({
src: "https://....",
type: "application/dash+xml",
token: "eyJra...",
lowLatencyEnabled: true
});
}
);
Limitations
- HLS reduced live latency is currently not supported.
- Using
liveDelayFragmentCount
to adjust the live latency on a.mpd
file which containsSegmentTemplate.SegmentTimeline
may produce unexpected results.
Recommendations
The default live latency is calculated to provide a good user experience in most environments and most network conditions. Changing these parameters can result in more frequent stalling and buffering, or failure to play. If the default values are not suitable then experimentation with these parameters may be used to find establish those which produce the best results for the deployment environment.