Low latency and fast zapping **************************** PRESTOplay for Web Apps low-latency live playback. Covers lowLatencyMode preset, streaming/ABR tuning, clock sync, live edge chasing, and fast channel zapping via McPlaylist. Code samples: * Low-latency live (https://raw.githubusercontent.com/castlabs/prestoplay-web-code-samples/refs/heads/main/examples/live/low_latency.js): a live DASH stream close to the live edge, with the latency, buffer, and playback rate. * Live delay (https://raw.githubusercontent.com/castlabs/prestoplay-web-code-samples/refs/heads/main/examples/live/live_delay.js): presets for how far behind the live edge a live DASH or HLS stream plays. * Fast channel zapping (https://raw.githubusercontent.com/castlabs/prestoplay-web-code-samples/refs/heads/main/examples/live/fast_zapping.js): switches between live DASH channels with "McPlaylist" and shows the zap time. Note: Fast zapping between live channels relies on "McPlaylist" (https://players.castlabs.com/web/latest/docs/api/clpp.playlist.McPlaylist.md), which is experimental and may change in future releases. Low latency live playback ========================= Enable the preset by setting "lowLatencyMode" in your "PlayerConfiguration" (https://players.castlabs.com/web/latest/docs/api/clpp.utils.PlayerConfiguration.md). The preset tightens buffering, adjusts adaptive bitrate (ABR) thresholds, and enables low-latency manifest parsing for DASH and HLS manifests. player.open({ source: '', lowLatencyMode: true, }); Start from the preset and override these values if needed to match your packaging: * "StreamingConfiguration" (https://players.castlabs.com/web/latest/docs/api/clpp.StreamingConfiguration.md) — for example, "bufferingGoal" and "rebufferingGoal". * "AbrConfiguration" (https://players.castlabs.com/web/latest/docs/api/clpp.AbrConfiguration.md) — use "initialRestrictions" to cap join resolution. A higher downgrade target ("bandwidthDowngradeTarget" near "0.95") and a lower upgrade target ("bandwidthUpgradeTarget") help avoid stalls while staying close to live. player.open({ source: '', lowLatencyMode: true, streaming: { bufferingGoal: 0.1, rebufferingGoal: 0.01, bufferBehind: 30, }, abr: { bandwidthUpgradeTarget: 0.6, bandwidthDowngradeTarget: 0.95, initialRestrictions: { maxWidth: 640, maxHeight: 480 } }, }); Clock sync ---------- * "PlayerConfiguration" (https://players.castlabs.com/web/latest/docs/api/clpp.utils.PlayerConfiguration.md)'s "suggestedPresentationDelay" is set to "0" by default for low-latency configuration. * If your DASH manifest is missing a clock sync URI, supply one via "ManifestConfiguration" (https://players.castlabs.com/web/latest/docs/api/clpp.ManifestConfiguration.md)'s "manifest.dash.clockSyncUri". Live edge chasing ----------------- When a player drifts behind the live edge — for example, due to network conditions or buffering — live edge chasing recovers latency by increasing the playback rate. Configure it through "StreamingConfiguration" (https://players.castlabs.com/web/latest/docs/api/clpp.StreamingConfiguration.md): * "startChasingAt" — latency threshold (in seconds) at which chasing begins. * "stopChasingAt" — latency threshold (in seconds) at which chasing stops. * "chasingRate" — playback rate used while chasing; must be greater than 1. * "chaseJumpDistance" — if latency exceeds this value, the player seeks directly to the live edge instead of gradually catching up. player.open({ source: '', lowLatencyMode: true, streaming: { enableLiveEdgeChasing: true, startChasingAt: 3, stopChasingAt: 1, chasingRate: 1.5, chaseJumpDistance: 10, } }); Fast zapping between live channels ================================== Use the experimental "McPlaylist" (https://players.castlabs.com/web/latest/docs/api/clpp.playlist.McPlaylist.md) to reduce zap time between live manifests. See MC playlist for setup details. To stay aligned with segment edges for live streams, enable "startAtSegmentBoundary" to reduce seek time. const playlist = new clpp.playlist.McPlaylist({ anchorId: 'video-anchor', config: { license: '', viewerId: '', streaming: { bufferingGoal: 1, rebufferingGoal: 1, startAtSegmentBoundary: true, ignoreDrift: true } } });