add rewind option to video player
This commit is contained in:
parent
f4c1f826bf
commit
90085aaf2f
1 changed files with 16 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue