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,33 +1342,28 @@ Ox.VideoPlayer = function(options, self) {
} }
function ended() { function ended() {
if (self.options.loop) { !self.options.paused && togglePaused();
rewind(); if (self.options.poster) {
self.$video.play(); self.$poster.animate({
} else { opacity: 1
!self.options.paused && togglePaused(); }, 250);
if (self.options.poster) { self.posterIsVisible = true;
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');
} }
if (self.options.showIconOnLoad) {
self.$playIcon.animate({
opacity: 1
}, 250);
self.iconIsVisible = true;
}
self.options.rewind && setTimeout(rewind, 250);
that.triggerEvent('ended');
} }
function enterFullscreen() { function enterFullscreen() {
that.on({ that.on({
mousemove: function() { mousemove: function() {
showControls(); showControls();
hideControls(); hideControls();
} }
}); });
showControls(); showControls();
@ -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();
} }