From 617ad0e5ca8f59ab172096c7e4aff734c7b5b984 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 22 Dec 2011 18:03:30 +0000 Subject: [PATCH] video player bugfixes, fullscreen-related --- source/Ox.UI/js/Video/Ox.VideoPlayer.js | 43 ++++++++++++++----------- source/Ox.UI/js/Window/Ox.Tooltip.js | 2 +- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/source/Ox.UI/js/Video/Ox.VideoPlayer.js b/source/Ox.UI/js/Video/Ox.VideoPlayer.js index cba62310..a51f6f36 100644 --- a/source/Ox.UI/js/Video/Ox.VideoPlayer.js +++ b/source/Ox.UI/js/Video/Ox.VideoPlayer.js @@ -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 diff --git a/source/Ox.UI/js/Window/Ox.Tooltip.js b/source/Ox.UI/js/Window/Ox.Tooltip.js index ed2b5525..b84f03d6 100644 --- a/source/Ox.UI/js/Window/Ox.Tooltip.js +++ b/source/Ox.UI/js/Window/Ox.Tooltip.js @@ -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