mirror of
https://github.com/videojs/video.js.git
synced 2025-03-31 22:22:09 +02:00
@gkatsev fixed removeRemoteTextTracks not working with return value from addRemoteTextTracks. closes #3253
This commit is contained in:
parent
ff83aa6573
commit
d3b368ccce
@ -5,6 +5,7 @@ CHANGELOG
|
|||||||
* @benjipott updated IS_CHROME to not be true on MS Edge ([view](https://github.com/videojs/video.js/pull/3232))
|
* @benjipott updated IS_CHROME to not be true on MS Edge ([view](https://github.com/videojs/video.js/pull/3232))
|
||||||
* @mister-ben blacklisted Chrome for Android for playback rate support ([view](https://github.com/videojs/video.js/pull/3246))
|
* @mister-ben blacklisted Chrome for Android for playback rate support ([view](https://github.com/videojs/video.js/pull/3246))
|
||||||
* @gkatsev made the first emulated text track enabled by default ([view](https://github.com/videojs/video.js/pull/3248))
|
* @gkatsev made the first emulated text track enabled by default ([view](https://github.com/videojs/video.js/pull/3248))
|
||||||
|
* @gkatsev fixed removeRemoteTextTracks not working with return value from addRemoteTextTracks ([view](https://github.com/videojs/video.js/pull/3253))
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
@ -2579,7 +2579,9 @@ class Player extends Component {
|
|||||||
* @param {Object} track Remote text track to remove
|
* @param {Object} track Remote text track to remove
|
||||||
* @method removeRemoteTextTrack
|
* @method removeRemoteTextTrack
|
||||||
*/
|
*/
|
||||||
removeRemoteTextTrack(track) {
|
// destructure the input into an object with a track argument, defaulting to arguments[0]
|
||||||
|
// default the whole argument to an empty object if nothing was passed in
|
||||||
|
removeRemoteTextTrack({track = arguments[0]} = {}) { // jshint ignore:line
|
||||||
this.tech_ && this.tech_['removeRemoteTextTrack'](track);
|
this.tech_ && this.tech_['removeRemoteTextTrack'](track);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,3 +529,27 @@ test('default captions take precedence over default descriptions', function() {
|
|||||||
equal(tracks[1].kind, 'captions', 'the captions track is second');
|
equal(tracks[1].kind, 'captions', 'the captions track is second');
|
||||||
equal(tracks[1].mode, 'showing', 'the captions track is showing');
|
equal(tracks[1].mode, 'showing', 'the captions track is showing');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('removeRemoteTextTrack should be able to take both a track and the response from addRemoteTextTrack', function() {
|
||||||
|
let player = TestHelpers.makePlayer();
|
||||||
|
let track = {
|
||||||
|
kind: 'kind',
|
||||||
|
src: 'src',
|
||||||
|
language: 'language',
|
||||||
|
label: 'label',
|
||||||
|
default: 'default'
|
||||||
|
};
|
||||||
|
let htmlTrackElement = player.addRemoteTextTrack(track);
|
||||||
|
|
||||||
|
equal(player.remoteTextTrackEls().length, 1, 'html track element exist');
|
||||||
|
|
||||||
|
player.removeRemoteTextTrack(htmlTrackElement);
|
||||||
|
|
||||||
|
equal(player.remoteTextTrackEls().length, 0, 'the track element was removed correctly');
|
||||||
|
|
||||||
|
htmlTrackElement = player.addRemoteTextTrack(track);
|
||||||
|
equal(player.remoteTextTrackEls().length, 1, 'html track element exist');
|
||||||
|
|
||||||
|
player.removeRemoteTextTrack(htmlTrackElement.track);
|
||||||
|
equal(player.remoteTextTrackEls().length, 0, 'the track element was removed correctly');
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user