add rewind option to video player

This commit is contained in:
rlx 2011-10-03 10:59:09 +00:00
parent f4c1f826bf
commit 90085aaf2f

View file

@ -44,6 +44,7 @@ Ox.VideoPlayer <f> Generic Video Player
preload <s|'auto'> 'auto', 'metadata' or 'none'
out <n> Out point (sec)
resolution <n|0> resolution
rewind <b|false> If true, video will rewind when ended
scaleToFill <b|false> If true, scale to fill (otherwise, scale to fit)
showControlsOnLoad <b|false> If true, show controls on load
showFind <b|false> If true, show find input
@ -104,6 +105,7 @@ Ox.VideoPlayer = function(options, self) {
preload: 'auto',
out: 0,
resolution: 0,
rewind: false,
scaleToFill: false,
showControlsOnLoad: false,
showFind: false,
@ -1033,6 +1035,7 @@ Ox.VideoPlayer = function(options, self) {
}, 250);
self.iconIsVisible = true;
}
self.options.rewind && rewind();
}
function find(query) {
@ -1547,9 +1550,14 @@ Ox.VideoPlayer = function(options, self) {
self.$video.playNext();
} else {
togglePaused();
setPosition(self.playInToOut ? self.options.out : self.out/*, 'video'*/);
//ended();
self.playInToOut = false;
if (self.options.rewind) {
rewind();
} else {
setPosition(self.playInToOut ? self.options.out : self.out/*, 'video'*/);
}
//ended();
that.triggerEvent('ended');
}
} else {
setPosition(self.options.position, 'video');
@ -1590,6 +1598,12 @@ Ox.VideoPlayer = function(options, self) {
});
}
function rewind() {
setTimeout(function() {
setPosition(self.options.playInToOut ? self.options.in : 0);
}, 250);
}
function seeked() {
Ox.print('XX seeked')
clearTimeout(self.seekTimeout);