When enabled, if the NetworkInformation API is available, it will be used for bandwidth estimation, If our estimation is greater than 10MBps and the downlink returns 10MBps, then our estimation is used.
Chrome 92 introduced a limit (75) on the number of media elements that can exist in a page at a time and we were going over that limit in our tests, causing them to fail.
Deprecate smoothQualityChange_ on the MPC, but otherwise, always do fast quality change whenever a user requests a rendition change and on fullscreen change
We have the recommended `beforeRequest` method but due to timing, it's not possible to use this to be able to set options for the initial m3u8 manifest as well. This makes it so that the XHR method can be overridden completely.
This is particularly important for Chrome, where, if unencrypted
content is appended before encrypted content and the key session
has not been created, a MEDIA_ERR_DECODE will be thrown once the
encrypted content is reached during playback.
A failed poster image may trigger an error event from the tech. This shouldn't cause us to pause our loaders, though.
Instead, we should verify that there's an actual error object on the tech before proceeding with pausing the loaders.
Deprecate lingering references to hls from the old videojs-contrib-hls
project, as well as dash. Ensure all references use `tech().vhs` instead.
Co-authored-by: Garrett Singer <gesinger@gmail.com>
Co-authored-by: Gary Katsevman <git@gkatsev.com>
Do a check for videojs.browser.IS_ANY_SAFARI and use that for overrideNative so that we use VHS playback on any non-safari browser.
Co-authored-by: ipadilla4 <ipadilla@brightcove.com>
Co-authored-by: Garrett Singer <gesinger@gmail.com>
This change adds two new events to `SegmentLoader`. The first `appendsdone` is fired whenever an append is complete on any main, audio, or subtitle loader. The second `playlistupdate` is fired whenever a playlist is changed on the segment loader.
Using these new events `PlaybackWatcher` watches for the `SegmentLoaders` `buffered_()` function to return a different buffered time range after each append. If it finds that we are not changing the buffered time range after three appends it will exclude the playlist or disable and remove the text track causing the issue.
Finally `PlaybackWatcher` will reset the buffered change counter whenever `playlistupdate` is fired on the `SegmentLoader` or when `seeking`/`seeked` fire on the `Tech`.
Previously, if the seekable window for the content started at 0
(generally denoting a VOD or LIVE DVR playlist), the back buffer would
not be trimmed. With high bitrate and/or longer content, this could
lead to an APPEND_BUFFER_ERR due to the buffer exceeding the max
allowed buffered bytes.
In order to help alleviate this issue, particularly with the increase in
high bitrate content, the back buffer is now trimmed to a reasonable
length, even if the seekable window starts at 0.
* Update sinon to v8.1.1 and fix abort tracking in mediaRequestsAborted
* Add check to media-segment-request for empty responseText when handling partial data
This was not needed in the past, as the responseText property of a sinon response was
anually set by VHS' test helpers. However, sinon now clears out the responseText property
on a response, the mime type override trick doesn't work like it would in a browser. The
additional check to the code should prove harmless, and acts as a guard against browsers
which don't implement the mime type override trick in the same way.
* Add an abortFn callback to media-segment-request to fix abort tracking in
mediaRequestsAborted
In the previously used version of sinon (v1.10.3), aborts of requests triggered the XHR
callback. In the XHR standard however, this does not happen. Later versions of sinon fixed
this issue. VHS' use of the old sinon lead to tests relying on broken behavior to verify
abort tracking in mediaRequestsAborted.
To properly use mediaRequestsAborted, aborts are tracked on loadend, part of XHR's
[request error steps](https://xhr.spec.whatwg.org/#request-error-steps), and called back
via the abortFn to increment mediaRequestsAborted
* Skip id3 with partial data handling tests until they no longer rely on segments being
fully requested
A couple of tests checking for id3 frames surfacing from partial data handling were found
to rely on the segment finishing its request before the data was surfaced. These tests are
skipped until a fix can be made such that they rely only on partial data.
* No longer override sinon's abort behavior for tests
* No longer work around sinon's response types in standardXHRResponse
With a newer sinon version, a few workarounds needed in test-helpers are no longer needed.
* Skip partial data caption tests until they no longer rely on full segment responses
This feature adds support for passing a JSON object as the source via a
data URI, which VHS looks for alongside a new vendor (VHS) specific
media type, 'application/vnd.vhs+json'. If present, VHS will use the
provided manifest object as the first requested manifest.
* Extract manifest modification functions from playlist loaders to manifest module
After parsing an HLS or DASH manifest string via m3u8-parser or
mpd-parser, the respective playlist loader (playlist-loader or
dash-playlist-loader) would modify the manifest objects to add
properties or change their structure so that VHS could use them
as if they were standardized.
The functions for doing this lived in playlist-loader and
dash-playlist-loader, however, with the upcoming possibility of passing
in a vhs-json object as the source (representing a manifest string
already parsed by m3u8-parser/mpd-parser), the functions needed to be
extracted to be reused appropriately, in a way that could act on either
HLS or DASH playlists in the same fashion.
This extracts that functionality to the manifests.js module.
* Simplify manifest modification functions by reducing abstraction
Previously, the same functions would be used for adding properties to
both master and media playlists. This simplified calls, but made for
more confusing sets of parameters and behaviors. It also led to some
harder to find backwards incompatibilities.
This simplifies the scope of each function to act on media playlists
regardless of whether they were part of a master or were sole media
playlists.