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

View file

@ -66,7 +66,7 @@ Ox.Tooltip = function(options, self) {
width = that.width();
height = that.height();
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
? self.y - 16 - height