video player bugfixes, fullscreen-related

This commit is contained in:
rlx 2011-12-22 18:03:30 +00:00
parent 60281a666b
commit 617ad0e5ca
2 changed files with 26 additions and 19 deletions

View file

@ -1000,7 +1000,9 @@ Ox.VideoPlayer = function(options, self) {
} }
} }
setSizes(); setSizes(function() {
self.options.fullscreen && enterFullscreen();
});
function censor() { function censor() {
if (self.options.type == 'play') { if (self.options.type == 'play') {
@ -1057,6 +1059,26 @@ Ox.VideoPlayer = function(options, self) {
that.triggerEvent('ended'); that.triggerEvent('ended');
} }
function enterFullscreen() {
that.bind({
mousemove: function() {
showControls();
hideControls();
}
});
that.find('.OxControls').bind({
mouseenter: function() {
self.mouseIsInControls = true;
},
mouseleave: function() {
self.mouseIsInControls = false;
}
});
showControls();
hideControls();
that.gainFocus();
}
function find(query) { function find(query) {
var results = []; var results = [];
if (query.length) { if (query.length) {
@ -2080,6 +2102,7 @@ Ox.VideoPlayer = function(options, self) {
} }
function toggleFullscreen(from) { function toggleFullscreen(from) {
// FIXME: hiding controls won't work if video begins in fullscreen
var parentOffset, playOnFullscreen; var parentOffset, playOnFullscreen;
self.options.fullscreen = !self.options.fullscreen; self.options.fullscreen = !self.options.fullscreen;
if (!self.options.paused) { if (!self.options.paused) {
@ -2105,23 +2128,7 @@ Ox.VideoPlayer = function(options, self) {
.appendTo(Ox.UI.$body); .appendTo(Ox.UI.$body);
setSizes(function() { setSizes(function() {
playOnFullscreen && self.$video.play(); playOnFullscreen && self.$video.play();
that.bind({ enterFullscreen();
mousemove: function() {
showControls();
hideControls();
}
});
that.find('.OxControls').bind({
mouseenter: function() {
self.mouseIsInControls = true;
},
mouseleave: function() {
self.mouseIsInControls = false;
}
});
showControls();
hideControls();
that.gainFocus();
}); });
} else { } else {
// flag makes the animation end on absolute position // flag makes the animation end on absolute position

View file

@ -66,7 +66,7 @@ Ox.Tooltip = function(options, self) {
width = that.width(); width = that.width();
height = that.height(); height = that.height();
left = Ox.limit( left = Ox.limit(
self.x - width / 2, 0, window.innerWidth - width self.x - width / 2, 0, window.innerWidth - width - 8
); );
top = self.y > window.innerHeight - height - 16 top = self.y > window.innerHeight - height - 16
? self.y - 16 - height ? self.y - 16 - height