1
0
mirror of https://github.com/videojs/video.js.git synced 2025-03-29 22:07:10 +02:00

Store text tracks on player not tech

Test keeping text tracks between tech loads.
This does break without the previous commit.

closes #1874
This commit is contained in:
Gary Katsevman 2015-02-17 17:19:21 -05:00 committed by heff
parent 5bd0338d2e
commit 8b0966c1b4
3 changed files with 25 additions and 5 deletions

View File

@ -2,7 +2,7 @@ CHANGELOG
=========
## HEAD (Unreleased)
_(none)_
* @gkatsev fixed the track list reference while switching techs that use emulated tracks ([view](https://github.com/videojs/video.js/pull/1874))
--------------------

View File

@ -345,13 +345,13 @@ vjs.MediaTechController.prototype.emulateTextTracks = function() {
vjs.MediaTechController.prototype.textTracks_;
vjs.MediaTechController.prototype.textTracks = function() {
this.textTracks_ = this.textTracks_ || new vjs.TextTrackList();
return this.textTracks_;
this.player_.textTracks_ = this.player_.textTracks_ || new vjs.TextTrackList();
return this.player_.textTracks_;
};
vjs.MediaTechController.prototype.remoteTextTracks = function() {
this.remoteTextTracks_ = this.remoteTextTracks_ || new vjs.TextTrackList();
return this.remoteTextTracks_;
this.player_.remoteTextTracks_ = this.player_.remoteTextTracks_ || new vjs.TextTrackList();
return this.player_.remoteTextTracks_;
};
createTrackHelper = function(self, kind, label, language, options) {

View File

@ -285,3 +285,23 @@ test('html5 tech supports native text tracks if the video supports it, unless it
vjs.TEST_VID = oldTestVid;
vjs.IS_FIREFOX = oldIsFirefox;
});
test('when switching techs, we should not get a new text track', function() {
var player = PlayerTest.makePlayer({
html5: {
nativeTextTracks: false
}
}),
htmltracks,
flashtracks;
player.loadTech('Html5');
htmltracks = player.textTracks();
player.loadTech('Flash');
flashtracks = player.textTracks();
ok(htmltracks === flashtracks, 'the tracks are equal');
});