video player: add keyboard shortcut and public method for loop, abort play-in-to-out on pause, minor cleanup

This commit is contained in:
rlx 2013-08-01 08:39:20 +00:00
parent f7cbbb689f
commit 4eab471f9d

View file

@ -297,15 +297,14 @@ Ox.VideoPlayer = function(options, self) {
key_g: function() {
goToNext('result', 1);
},
key_l: toggleLoop,
key_left: function() {
setPosition(self.options.position - self.secondsPerFrame);
},
key_minus: function() {
changeVolume(-0.1);
},
key_p: function() {
playInToOut();
},
key_p: playInToOut,
key_right: function() {
setPosition(self.options.position + self.secondsPerFrame);
},
@ -1788,6 +1787,11 @@ Ox.VideoPlayer = function(options, self) {
return str.slice(0, -1).match(/^\d+$/) && str.slice(-1) == 'p';
}
function itemchange(data) {
var item = self.$video.options('items')[data.item];
Ox.Log('Video', 'ITEMCHANGE', item);
}
function loadImage() {
self.$image
.one({
@ -1895,8 +1899,6 @@ Ox.VideoPlayer = function(options, self) {
} else {
setPosition(self.playInToOut ? self.options.out : self.out/*, 'video'*/);
}
self.playInToOut = false;
//ended();
that.triggerEvent('ended');
}
} else {
@ -1915,11 +1917,6 @@ Ox.VideoPlayer = function(options, self) {
}
}
function itemchange(data) {
var item = self.$video.options('items')[data.item];
Ox.Log('Video', 'ITEMCHANGE', item);
}
function progress() {
var buffered = self.$video.buffered();
for (var i = 0; i < buffered.length; i++) {
@ -2522,6 +2519,7 @@ Ox.VideoPlayer = function(options, self) {
opacity: 1
}, 250);
}
self.playInToOut = false;
} else {
if (self.options.playInToOut && self.options.position > self.options.out - self.secondsPerFrame) {
setPosition(self.options['in']);
@ -2613,6 +2611,15 @@ Ox.VideoPlayer = function(options, self) {
return that;
};
/*@
togglePaused <f> toggle loop state
() -> <o> toggle loop state
@*/
that.toggleLoop = function() {
toggleLoop();
return that;
};
/*@
togglePaused <f> toggle paused state
() -> <o> toggle paused state
@ -2620,7 +2627,7 @@ Ox.VideoPlayer = function(options, self) {
that.togglePaused = function() {
togglePaused();
return that;
}
};
/*@
toggleMuted <f> toggle muted state
@ -2629,7 +2636,7 @@ Ox.VideoPlayer = function(options, self) {
that.toggleMuted = function() {
toggleMuted();
return that;
}
};
return that;