Skip to content

Commit

Permalink
Added a player option to offset the subtitles/captions timing. closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
these8bits authored and heff committed May 19, 2014
1 parent bd66416 commit 23ab370
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ CHANGELOG
* Fixed saucelabs integration to run on commits in TravisCI ([view](https://github.com/videojs/video.js/pull/1214))
* Added a clearer error message when a tech is undefined ([view](https://github.com/videojs/video.js/pull/1210))
* Added a cog icon to the font icons ([view](https://github.com/videojs/video.js/pull/1211))
* Added a player option to offset the subtitles/captions timing ([view](https://github.com/videojs/video.js/pull/1212))

--------------------

Expand Down
5 changes: 3 additions & 2 deletions src/js/tracks.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,9 @@ 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 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) {
Expand Down

0 comments on commit 23ab370

Please sign in to comment.