From c0bfe480adbacd4b006d302015e111bccf565046 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 16 Apr 2017 22:54:40 +0200 Subject: [PATCH] use VideoElement loop in VideoPlayer --- source/UI/js/Video/VideoPlayer.js | 37 ++++++++++++++----------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/source/UI/js/Video/VideoPlayer.js b/source/UI/js/Video/VideoPlayer.js index 78a48591..52db92aa 100644 --- a/source/UI/js/Video/VideoPlayer.js +++ b/source/UI/js/Video/VideoPlayer.js @@ -438,6 +438,7 @@ Ox.VideoPlayer = function(options, self) { self.$video = Ox.VideoElement({ items: self.video, + loop: self.options.loop, playbackRate: self.options.playbackRate }) .bindEvent(Ox.extend({ @@ -1341,33 +1342,28 @@ Ox.VideoPlayer = function(options, self) { } function ended() { - if (self.options.loop) { - rewind(); - self.$video.play(); - } else { - !self.options.paused && togglePaused(); - if (self.options.poster) { - self.$poster.animate({ - opacity: 1 - }, 250); - self.posterIsVisible = true; - } - if (self.options.showIconOnLoad) { - self.$playIcon.animate({ - opacity: 1 - }, 250); - self.iconIsVisible = true; - } - self.options.rewind && setTimeout(rewind, 250); - that.triggerEvent('ended'); + !self.options.paused && togglePaused(); + if (self.options.poster) { + self.$poster.animate({ + opacity: 1 + }, 250); + self.posterIsVisible = true; } + if (self.options.showIconOnLoad) { + self.$playIcon.animate({ + opacity: 1 + }, 250); + self.iconIsVisible = true; + } + self.options.rewind && setTimeout(rewind, 250); + that.triggerEvent('ended'); } function enterFullscreen() { that.on({ mousemove: function() { showControls(); - hideControls(); + hideControls(); } }); showControls(); @@ -2638,6 +2634,7 @@ Ox.VideoPlayer = function(options, self) { function toggleLoop(from) { self.options.loop = !self.options.loop; + self.$video.options('loop', self.options.loop); if (self.$loopButton && from != 'button') { self.$loopButton.toggle(); }