add drag-to-scrub to video
This commit is contained in:
parent
1333a3ecec
commit
e6e2e0e1d8
1 changed files with 24 additions and 5 deletions
|
@ -269,8 +269,10 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
if (!$(e.target).is('.OxLogo')) {
|
if (!$(e.target).is('.OxLogo')) {
|
||||||
togglePaused();
|
togglePaused();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
// fixme: support drag (left-right)
|
dragstart: dragstart,
|
||||||
|
drag: drag,
|
||||||
|
dragend: dragend
|
||||||
});
|
});
|
||||||
|
|
||||||
self.$video = Ox.VideoElement(
|
self.$video = Ox.VideoElement(
|
||||||
|
@ -998,10 +1000,27 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
self.interfaceTimeout = 0;
|
self.interfaceTimeout = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ended() {
|
function dragstart() {
|
||||||
if (!self.options.paused) {
|
self.drag = {
|
||||||
togglePaused();
|
position: self.options.position,
|
||||||
|
paused: self.options.paused
|
||||||
}
|
}
|
||||||
|
!self.options.paused && togglePaused();
|
||||||
|
}
|
||||||
|
|
||||||
|
function drag(e) {
|
||||||
|
setPosition(self.drag.position - e.clientDX / 25);
|
||||||
|
that.triggerEvent('position', {
|
||||||
|
position: self.options.position
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function dragend() {
|
||||||
|
!self.drag.paused && togglePaused();
|
||||||
|
}
|
||||||
|
|
||||||
|
function ended() {
|
||||||
|
!self.options.paused && togglePaused();
|
||||||
if (self.options.poster) {
|
if (self.options.poster) {
|
||||||
self.$poster.animate({
|
self.$poster.animate({
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
|
Loading…
Reference in a new issue