Implement low latency mode for live streams
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:
- 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. - 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).
- Setting live edge more aggressive. The live edge is computed with the formula:
startTime + duration - liveDelay
.liveDelay
is set to 3s by default.