mirror of
https://github.com/videojs/video.js.git
synced 2025-04-07 07:19:54 +02:00
feat: update videojs-vtt.js and wrap native cues in TextTrack (#4115)
Update videojs-vtt.js and don't auto-export its versions of VTTCue globally. When our TextTrack object is given a cue, if it's a native cue, wrap it in our emulated vttjs.VTTCue. Fixes #4093.
This commit is contained in:
parent
f558648f44
commit
96a387f723
@ -44,7 +44,7 @@
|
||||
"tsml": "1.0.1",
|
||||
"videojs-font": "2.0.0",
|
||||
"videojs-ie8": "1.1.2",
|
||||
"videojs-vtt.js": "0.12.1",
|
||||
"videojs-vtt.js": "0.12.2",
|
||||
"xhr": "2.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -520,9 +520,6 @@ class Tech extends Component {
|
||||
// as an option. novtt builds will turn the above require call into an empty object
|
||||
// which will cause this if check to always fail.
|
||||
if (!this.options_['vtt.js'] && isPlain(vtt) && Object.keys(vtt).length > 0) {
|
||||
Object.keys(vtt).forEach(function(k) {
|
||||
window[k] = vtt[k];
|
||||
});
|
||||
this.trigger('vttjsloaded');
|
||||
return;
|
||||
}
|
||||
|
@ -336,7 +336,17 @@ class TextTrack extends Track {
|
||||
* @param {TextTrack~Cue} cue
|
||||
* The cue to add to our internal list
|
||||
*/
|
||||
addCue(cue) {
|
||||
addCue(originalCue) {
|
||||
let cue = originalCue;
|
||||
|
||||
if (!(originalCue instanceof window.vttjs.VTTCue)) {
|
||||
cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);
|
||||
|
||||
for (const prop in originalCue) {
|
||||
cue[prop] = originalCue[prop];
|
||||
}
|
||||
}
|
||||
|
||||
const tracks = this.tech_.textTracks();
|
||||
|
||||
for (let i = 0; i < tracks.length; i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user