Seek backward issue
Created by: epiclabsDASH
This PR is a mix of the PR #2272 and changes I have brought from @vuduDASH fork ( https://github.com/vuduDASH/dash.js, branch v2.3.0-vudu).
The idea behind this PR is doing a smarter management of buffer with the following goals:
- Fix seek backward issue (#2187 (closed)) that are coming from buffer exhausted situations.
- Fix issues when quota exceed situations are reported by the browser.
- Limit the amount of buffer consumed by the browser to:
- Ensure dash.js is compatible with devices that have limitations in terms of memory capacity (Smart TVs, STBs).
- Avoid situations in which browser is silently pruning media buffers.
Note: One of the important changes of this PR is we are now pruning the buffer after a seeking operation. This makes dash.js more efficient in terms of memory consumption and removes issues coming from silent pruning, but introduces some inefficiencies in network use.
However, previous mechanism was not enough smart and guided us to situations in which, after a seek operation, we were playing a low quality rendition because we already downloaded its chunks, even when there was enough bandwidth for downloading high quality ones, what caused inefficiencies in terms of quality.
My proposal is let's first fix inefficiencies that are more critical (memory consumption) and that are causing playback issues. Once these are fixed and stable, let's think on a way of increasing dash.js efficiency in terms of network use when there are seeking operations (for example, after a seek operation, keeps only a portion of the buffer if top quality is selected or, even simpler, just trust on browser cache mechanisms).
@vuduDASH, thanks for the changes. They were really useful. Please, feel free to add any change or comment.