use VideoElement loop in VideoPlayer

This commit is contained in:
j 2017-04-16 22:54:40 +02:00
parent c32d50e82e
commit c0bfe480ad

View file

@ -438,6 +438,7 @@ Ox.VideoPlayer = function(options, self) {
self.$video = Ox.VideoElement({ self.$video = Ox.VideoElement({
items: self.video, items: self.video,
loop: self.options.loop,
playbackRate: self.options.playbackRate playbackRate: self.options.playbackRate
}) })
.bindEvent(Ox.extend({ .bindEvent(Ox.extend({
@ -1341,10 +1342,6 @@ Ox.VideoPlayer = function(options, self) {
} }
function ended() { function ended() {
if (self.options.loop) {
rewind();
self.$video.play();
} else {
!self.options.paused && togglePaused(); !self.options.paused && togglePaused();
if (self.options.poster) { if (self.options.poster) {
self.$poster.animate({ self.$poster.animate({
@ -1361,7 +1358,6 @@ Ox.VideoPlayer = function(options, self) {
self.options.rewind && setTimeout(rewind, 250); self.options.rewind && setTimeout(rewind, 250);
that.triggerEvent('ended'); that.triggerEvent('ended');
} }
}
function enterFullscreen() { function enterFullscreen() {
that.on({ that.on({
@ -2638,6 +2634,7 @@ Ox.VideoPlayer = function(options, self) {
function toggleLoop(from) { function toggleLoop(from) {
self.options.loop = !self.options.loop; self.options.loop = !self.options.loop;
self.$video.options('loop', self.options.loop);
if (self.$loopButton && from != 'button') { if (self.$loopButton && from != 'button') {
self.$loopButton.toggle(); self.$loopButton.toggle();
} }