mirror of
https://github.com/videojs/video.js.git
synced 2025-07-05 00:58:52 +02:00
This commit is contained in:
committed by
Gary Katsevman
parent
b2d0e10dbd
commit
a22c7f2a4d
@ -5,6 +5,7 @@ CHANGELOG
|
|||||||
* @llun fixed menus from throwing when focused when empty ([view](https://github.com/videojs/video.js/pull/3218))
|
* @llun fixed menus from throwing when focused when empty ([view](https://github.com/videojs/video.js/pull/3218))
|
||||||
* @mister-ben added dir=ltr to control bar and loading spinner ([view](https://github.com/videojs/video.js/pull/3221))
|
* @mister-ben added dir=ltr to control bar and loading spinner ([view](https://github.com/videojs/video.js/pull/3221))
|
||||||
* @avreg fixed notSupportedMessage saying video when meaning media ([view](https://github.com/videojs/video.js/pull/3222))
|
* @avreg fixed notSupportedMessage saying video when meaning media ([view](https://github.com/videojs/video.js/pull/3222))
|
||||||
|
* @mister-ben fixed missing native HTML5 tracks ([view](https://github.com/videojs/video.js/pull/3212))
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
@ -257,12 +257,20 @@ class Html5 extends Tech {
|
|||||||
proxyNativeTextTracks_() {
|
proxyNativeTextTracks_() {
|
||||||
let tt = this.el().textTracks;
|
let tt = this.el().textTracks;
|
||||||
|
|
||||||
if (tt && tt.addEventListener) {
|
if (tt) {
|
||||||
|
// Add tracks - if player is initialised after DOM loaded, textTracks
|
||||||
|
// will not trigger addtrack
|
||||||
|
for (let i = 0; i < tt.length; i++) {
|
||||||
|
this.textTracks().addTrack_(tt[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tt.addEventListener) {
|
||||||
tt.addEventListener('change', this.handleTextTrackChange_);
|
tt.addEventListener('change', this.handleTextTrackChange_);
|
||||||
tt.addEventListener('addtrack', this.handleTextTrackAdd_);
|
tt.addEventListener('addtrack', this.handleTextTrackAdd_);
|
||||||
tt.addEventListener('removetrack', this.handleTextTrackRemove_);
|
tt.addEventListener('removetrack', this.handleTextTrackRemove_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleTextTrackChange(e) {
|
handleTextTrackChange(e) {
|
||||||
let tt = this.textTracks();
|
let tt = this.textTracks();
|
||||||
|
@ -78,14 +78,18 @@ class TextTrackList extends EventTarget {
|
|||||||
track.addEventListener('modechange', Fn.bind(this, function() {
|
track.addEventListener('modechange', Fn.bind(this, function() {
|
||||||
this.trigger('change');
|
this.trigger('change');
|
||||||
}));
|
}));
|
||||||
this.tracks_.push(track);
|
|
||||||
|
|
||||||
|
// Do not add duplicate tracks
|
||||||
|
if (this.tracks_.indexOf(track) === -1) {
|
||||||
|
this.tracks_.push(track);
|
||||||
this.trigger({
|
this.trigger({
|
||||||
track,
|
track,
|
||||||
type: 'addtrack'
|
type: 'addtrack'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove TextTrack from TextTrackList
|
* Remove TextTrack from TextTrackList
|
||||||
* NOTE: Be mindful of what is passed in as it may be a HTMLTrackElement
|
* NOTE: Be mindful of what is passed in as it may be a HTMLTrackElement
|
||||||
|
Reference in New Issue
Block a user