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({
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();
}