From 2830c89141c08789dbe69bdf4a90ff55b2646c35 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Wed, 14 May 2014 05:32:18 -0400 Subject: [PATCH 1/3] adjust subtitle timing by optional offset --- src/js/tracks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/tracks.js b/src/js/tracks.js index 06658d0895..61c7670cce 100644 --- a/src/js/tracks.js +++ b/src/js/tracks.js @@ -551,8 +551,8 @@ vjs.TextTrack.prototype.parseCueTime = function(timeText) { vjs.TextTrack.prototype.update = function(){ if (this.cues_.length > 0) { - // Get curent player time - var time = this.player_.currentTime(); + // Get current player time, adjust for track offset + var time = this.player_.currentTime() + (this.player_.trackTimeOffset || 0); // Check if the new time is outside the time box created by the the last update. if (this.prevChange === undefined || time < this.prevChange || this.nextChange <= time) { From f926505f0b2b4191863dbb1eea20e89158c4ca2d Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Wed, 14 May 2014 23:42:51 -0400 Subject: [PATCH 2/3] set trackTimeOffset on player_.options() --- src/js/tracks.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/tracks.js b/src/js/tracks.js index 61c7670cce..ffe8faf1ba 100644 --- a/src/js/tracks.js +++ b/src/js/tracks.js @@ -552,7 +552,8 @@ vjs.TextTrack.prototype.update = function(){ if (this.cues_.length > 0) { // Get current player time, adjust for track offset - var time = this.player_.currentTime() + (this.player_.trackTimeOffset || 0); + var offset = this.player_.options()['trackTimeOffset'] || 0 + var time = this.player_.currentTime() + offset; // Check if the new time is outside the time box created by the the last update. if (this.prevChange === undefined || time < this.prevChange || this.nextChange <= time) { From 423a730d1d606a20b76941ed257a67f4e6223770 Mon Sep 17 00:00:00 2001 From: Brad Chase Date: Wed, 14 May 2014 23:46:24 -0400 Subject: [PATCH 3/3] add missing semicolon --- src/js/tracks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/tracks.js b/src/js/tracks.js index ffe8faf1ba..d2ac76fb08 100644 --- a/src/js/tracks.js +++ b/src/js/tracks.js @@ -552,7 +552,7 @@ vjs.TextTrack.prototype.update = function(){ if (this.cues_.length > 0) { // Get current player time, adjust for track offset - var offset = this.player_.options()['trackTimeOffset'] || 0 + var offset = this.player_.options()['trackTimeOffset'] || 0; var time = this.player_.currentTime() + offset; // Check if the new time is outside the time box created by the the last update.