mirror of
https://github.com/videojs/video.js.git
synced 2025-01-10 23:30:03 +02:00
@gkatsev fixed text track errors on dispose and in cross-browser testing. closes #2466
This commit is contained in:
parent
293c9875d8
commit
4ec82d647d
@ -95,6 +95,7 @@ CHANGELOG
|
||||
* @mmcc made sure controls respect muted attribute ([view](https://github.com/videojs/video.js/pull/2408))
|
||||
* @dmlap switched global options back to an object at videojs.options ([view](https://github.com/videojs/video.js/pull/2461))
|
||||
* @ogun fixed a typo in the Turkish translation ([view](https://github.com/videojs/video.js/pull/2460))
|
||||
* @gkatsev fixed text track errors on dispose and in cross-browser testing ([view](https://github.com/videojs/video.js/pull/2466))
|
||||
|
||||
--------------------
|
||||
|
||||
|
@ -95,9 +95,11 @@ class Html5 extends Tech {
|
||||
let emulatedTt = this.textTracks();
|
||||
|
||||
// remove native event listeners
|
||||
if (tt) {
|
||||
tt.removeEventListener('change', this.handleTextTrackChange_);
|
||||
tt.removeEventListener('addtrack', this.handleTextTrackAdd_);
|
||||
tt.removeEventListener('removetrack', this.handleTextTrackRemove_);
|
||||
}
|
||||
|
||||
// clearout the emulated text track list.
|
||||
let i = emulatedTt.length;
|
||||
@ -206,10 +208,12 @@ class Html5 extends Tech {
|
||||
proxyNativeTextTracks_() {
|
||||
let tt = this.el().textTracks;
|
||||
|
||||
if (tt) {
|
||||
tt.addEventListener('change', this.handleTextTrackChange_);
|
||||
tt.addEventListener('addtrack', this.handleTextTrackAdd_);
|
||||
tt.addEventListener('removetrack', this.handleTextTrackRemove_);
|
||||
}
|
||||
}
|
||||
|
||||
handleTextTrackChange(e) {
|
||||
let tt = this.textTracks();
|
||||
@ -889,6 +893,9 @@ Html5.supportsNativeTextTracks = function() {
|
||||
if (supportsTextTracks && browser.IS_FIREFOX) {
|
||||
supportsTextTracks = false;
|
||||
}
|
||||
if (supportsTextTracks && !('onremovetrack' in Html5.TEST_VID.textTracks)) {
|
||||
supportsTextTracks = false;
|
||||
}
|
||||
|
||||
return supportsTextTracks;
|
||||
};
|
||||
|
@ -9,6 +9,7 @@ q.module('Text Track List Converter');
|
||||
let clean = (item) => {
|
||||
delete item.id;
|
||||
delete item.inBandMetadataTrackDispatchType;
|
||||
delete item.cues;
|
||||
};
|
||||
|
||||
let cleanup = (item) => {
|
||||
@ -34,8 +35,7 @@ if (Html5.supportsNativeTextTracks()) {
|
||||
kind: 'captions',
|
||||
label: 'English',
|
||||
language: 'en',
|
||||
mode: 'disabled',
|
||||
cues: null
|
||||
mode: 'disabled'
|
||||
}, 'the json output is same');
|
||||
});
|
||||
|
||||
@ -76,15 +76,13 @@ if (Html5.supportsNativeTextTracks()) {
|
||||
kind: 'captions',
|
||||
label: 'Spanish',
|
||||
language: 'es',
|
||||
mode: 'disabled',
|
||||
cues: null
|
||||
mode: 'disabled'
|
||||
}, {
|
||||
src: 'http://example.com/english.vtt',
|
||||
kind: 'captions',
|
||||
label: 'English',
|
||||
language: 'en',
|
||||
mode: 'disabled',
|
||||
cues: null
|
||||
mode: 'disabled'
|
||||
}], 'the output is correct');
|
||||
});
|
||||
|
||||
@ -147,8 +145,7 @@ q.test('trackToJson_ produces correct representation for emulated track object',
|
||||
kind: 'captions',
|
||||
label: 'English',
|
||||
language: 'en',
|
||||
mode: 'disabled',
|
||||
cues: null
|
||||
mode: 'disabled'
|
||||
}, 'the json output is same');
|
||||
});
|
||||
|
||||
@ -191,15 +188,13 @@ q.test('textTracksToJson produces good json output for emulated only', function(
|
||||
kind: 'captions',
|
||||
label: 'Spanish',
|
||||
language: 'es',
|
||||
mode: 'disabled',
|
||||
cues: null
|
||||
mode: 'disabled'
|
||||
}, {
|
||||
src: 'http://example.com/english.vtt',
|
||||
kind: 'captions',
|
||||
label: 'English',
|
||||
language: 'en',
|
||||
mode: 'disabled',
|
||||
cues: null
|
||||
mode: 'disabled'
|
||||
}], 'the output is correct');
|
||||
});
|
||||
|
||||
|
@ -309,7 +309,7 @@ test('when switching techs, we should not get a new text track', function() {
|
||||
});
|
||||
|
||||
if (Html5.supportsNativeTextTracks()) {
|
||||
test('listen to remove and add track events in native text tracks', function(assert) {
|
||||
test('listen to native remove and add track events in native text tracks', function(assert) {
|
||||
let done = assert.async();
|
||||
|
||||
let el = document.createElement('video');
|
||||
@ -357,6 +357,5 @@ if (Html5.supportsNativeTextTracks()) {
|
||||
done();
|
||||
};
|
||||
emulatedTt.on('addtrack', addtrack);
|
||||
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user