Skip to content

Commit

Permalink
video.js: Local patch for subtitle loading behavior
Browse files Browse the repository at this point in the history
Upstream PR in progress, will add more adjustments to it
and later will be able to remove this patch here.
videojs/video.js#6043

Bug: T222763
Change-Id: I4d2eeb44dacdcd12c7717d208b21bed2775a8360
  • Loading branch information
bvibber authored and jdforrester committed Jun 12, 2019
1 parent 2a1dbb7 commit c6390e0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
}
} );
Expand All @@ -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' ] );
Expand Down
25 changes: 25 additions & 0 deletions patches/videojs-text-tracks-on-demand.patch
Original file line number Diff line number Diff line change
@@ -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;
}
8 changes: 7 additions & 1 deletion resources/videojs/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit c6390e0

Please sign in to comment.