diff --git a/src/js/tracks.js b/src/js/tracks.js index ebc85daeb6..06658d0895 100644 --- a/src/js/tracks.js +++ b/src/js/tracks.js @@ -58,9 +58,15 @@ vjs.Player.prototype.addTextTrack = function(kind, label, language, options){ // TODO: Add a process to deterime the best track to show for the specific kind // Incase there are mulitple defaulted tracks of the same kind // Or the user has a set preference of a specific language that should override the default - // if (track.dflt()) { - // this.ready(vjs.bind(track, track.show)); - // } + // Note: The setTimeout is a workaround because with the html5 tech, the player is 'ready' + // before it's child components (including the textTrackDisplay) have finished loading. + if (track.dflt()) { + this.ready(function(){ + setTimeout(function(){ + track.show(); + }, 0); + }); + } return track; }; diff --git a/test/unit/player.js b/test/unit/player.js index 584df7f55e..1cea1bf2be 100644 --- a/test/unit/player.js +++ b/test/unit/player.js @@ -80,7 +80,7 @@ test('should get tag, source, and track settings', function(){ var html = ''; fixture.innerHTML += html; @@ -97,7 +97,7 @@ test('should get tag, source, and track settings', function(){ ok(player.options_['sources'][1].type === 'video/webm'); ok(player.options_['tracks'].length === 1); ok(player.options_['tracks'][0]['kind'] === 'captions'); // No extern - ok(player.options_['tracks'][0]['default'] === true); + ok(player.options_['tracks'][0]['attrtest'] === ''); ok(player.el().className.indexOf('video-js') !== -1, 'transferred class from tag to player div'); ok(player.el().id === 'example_1', 'transferred id from tag to player div');