diff --git a/Gruntfile.js b/Gruntfile.js index a6d0b870e..76b2fb7f4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -122,6 +122,14 @@ module.exports = function ( grunt ) { files: { 'resources/videojs-resolution-switcher/videojs-resolution-switcher.css': 'resources/videojs-resolution-switcher/videojs-resolution-switcher.css' } + }, + 'videojs-text-tracks-on-demand': { + options: { + patch: 'patches/videojs-text-tracks-on-demand.patch' + }, + files: { + 'resources/videojs/video.js': 'resources/videojs/video.js' + } } } } ); @@ -133,7 +141,8 @@ module.exports = function ( grunt ) { 'copy:videojs-ogvjs', 'patch:videojs-resolution-switcher', 'patch:videojs-resolution-switcher-icon', - 'patch:videojs-ogvjs' + 'patch:videojs-ogvjs', + 'patch:videojs-text-tracks-on-demand' ] ); grunt.registerTask( 'update-ogvjs', [ 'exec:npm-update-videojs', 'copy:ogv.js' ] ); grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'banana' ] ); diff --git a/patches/videojs-text-tracks-on-demand.patch b/patches/videojs-text-tracks-on-demand.patch new file mode 100644 index 000000000..8e8dd63c5 --- /dev/null +++ b/patches/videojs-text-tracks-on-demand.patch @@ -0,0 +1,25 @@ +diff -ur node_modules/video.js/dist/video.js old-video.js-patched/dist/video.js +--- dist/video.js 1985-10-26 01:15:00.000000000 -0700 ++++ dist/video.js 2019-06-12 08:26:10.000000000 -0700 +@@ -7930,6 +7930,9 @@ + + mode = newMode; + ++ if (mode !== 'disabled' && this.cues.length === 0) { ++ loadTrack(this.src, this); ++ } + if (mode !== 'disabled') { + this.tech_.ready(function () { + _this2.tech_.on('timeupdate', timeupdateHandler); +@@ -8022,7 +8025,10 @@ + + if (settings.src) { + _this.src = settings.src; +- loadTrack(settings.src, _assertThisInitialized(_assertThisInitialized(_this))); ++ _this.loaded_ = true; ++ if (default_ || (settings.kind !== 'subtitles' && settings.kind !== 'captions')) { ++ loadTrack(_this.src, _assertThisInitialized(_assertThisInitialized(_this))); ++ } + } else { + _this.loaded_ = true; + } diff --git a/resources/videojs/video.js b/resources/videojs/video.js index 2a83a6e77..955c1baae 100644 --- a/resources/videojs/video.js +++ b/resources/videojs/video.js @@ -7930,6 +7930,9 @@ mode = newMode; + if (mode !== 'disabled' && this.cues.length === 0) { + loadTrack(this.src, this); + } if (mode !== 'disabled') { this.tech_.ready(function () { _this2.tech_.on('timeupdate', timeupdateHandler); @@ -8022,7 +8025,10 @@ if (settings.src) { _this.src = settings.src; - loadTrack(settings.src, _assertThisInitialized(_assertThisInitialized(_this))); + _this.loaded_ = true; + if (default_ || (settings.kind !== 'subtitles' && settings.kind !== 'captions')) { + loadTrack(_this.src, _assertThisInitialized(_assertThisInitialized(_this))); + } } else { _this.loaded_ = true; }