Skip to content

Commit

Permalink
Build changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmoore committed Nov 14, 2018
1 parent 52fc5fd commit 6cef5c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion dist/video-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,13 @@ var VideoWorker = function () {
}
self.fire('ready', e);

// For seamless loops, set the endTime to 0.1 seconds less than the video's duration
// https://github.com/nk-o/video-worker/issues/2
if (self.options.loop && !self.options.endTime) {
var secondsOffset = 0.1;
self.options.endTime = self.player.getDuration() - secondsOffset;
}

// volumechange
setInterval(function () {
self.getVolume(function (volume) {
Expand Down Expand Up @@ -679,7 +686,7 @@ var VideoWorker = function () {
self.fire('timeupdate', e);

// check for end of video and play again or stop
if (self.options.endTime && self.player.getCurrentTime() >= self.options.endTime || self.player.getCurrentTime() + 0.1 >= self.player.getDuration()) {
if (self.options.endTime && self.player.getCurrentTime() >= self.options.endTime) {
if (self.options.loop) {
self.play(self.options.startTime);
} else {
Expand Down
Loading

0 comments on commit 6cef5c6

Please sign in to comment.