1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-15 01:34:23 +02:00

feat: sourceset event (#4660)

Trigger a sourceset event whenever the source is set in the Html5 tech, including initial source. We override the video element's src and setAttribute methods so that we can trigger the sourceset event when people change the src with both the video element and our API methods.
The event object for sourceset will contain the src string that was provided at the time the sourceset was triggered. This is mostly important if a source is being set while a tech is changing.
A Tech has a featuresSourceset option that it can set to for sourceset handling. It can then call the helper triggerSourceset(src) to trigger the sourceset.
This commit is contained in:
Brandon Casey
2018-03-07 14:28:37 -05:00
committed by Gary Katsevman
parent 1fa9dfbee2
commit df96a74f6b
5 changed files with 745 additions and 2 deletions

View File

@ -422,9 +422,11 @@ if (Html5.supportsNativeTextTracks()) {
addEventListener: (type, fn) => events.push([type, fn]),
removeEventListener: (type, fn) => events.push([type, fn])
};
const el = document.createElement('div');
const el = document.createElement('video');
el.textTracks = tt;
Object.defineProperty(el, 'textTracks', {
get: () => tt
});
/* eslint-disable no-unused-vars */
const htmlTech = new Html5({el, nativeTextTracks: false});