Skip to content

Implement low latency mode for live streams

Vinay Rosenberg requested to merge github/fork/mmarciel/low_latency into development

Created by: mmarciel

This PR implements a low latency mode implementing points 1 and 2 of @wilaw comment in #1474 (closed) and it is based on the implementation of @TobbeEdgeware team.

There is a new parameter lowLatencyMode to control the mode in live streams.

Main changes:

  1. Using fetch and reading output as stream (feature only available in Chrome). There is a new layer for requests (HTTPLoader.js) that decides whether to use xhr or fetch. Fetch is only used when parameter lowLatencyMode is true.
  2. When using fetch, bytes are appended to the buffer (in the event FRAGMENT_LOADING_PROGRESS). Only when the first segment has been downloaded, it starts playing (event BYTES_APPENDED_END_FRAGMENT).
  3. Setting live edge more aggressive. The live edge is computed with the formula: startTime + duration - liveDelay. liveDelay is set to 3s by default.

Merge request reports