Bug 842130 - Fix fullscreen video which currently isn't working. r=mbrubeck

This commit is contained in:
Brian R. Bondy 2013-03-28 21:29:55 -04:00
parent 4a153be08f
commit 478c4bce26
9 changed files with 0 additions and 257 deletions

View File

@ -216,11 +216,6 @@ var ContextCommands = {
BrowserUI.newTab(ContextMenuUI.popupState.mediaURL, Browser.selectedTab);
},
openVideoInFullscreen: function cc_openVideoInFullscreen() {
// XXX currently isn't working.
this.sendCommand('videotab');
},
// Bookmarks
editBookmark: function cc_editBookmark() {

View File

@ -106,7 +106,6 @@ let ScriptContexts = {};
["OfflineApps", "chrome://browser/content/helperui/OfflineApps.js"],
["SelectHelperUI", "chrome://browser/content/helperui/SelectHelperUI.js"],
["SelectionHelperUI", "chrome://browser/content/helperui/SelectionHelperUI.js"],
["FullScreenVideo", "chrome://browser/content/video.js"],
["AnimatedZoom", "chrome://browser/content/AnimatedZoom.js"],
["CommandUpdater", "chrome://browser/content/commandUtil.js"],
["ContextCommands", "chrome://browser/content/ContextCommands.js"],

View File

@ -145,7 +145,6 @@ var BrowserUI = {
DialogUI.init();
FormHelperUI.init();
FindHelperUI.init();
FullScreenVideo.init();
PdfJs.init();
#ifdef MOZ_SERVICES_SYNC
WeaveGlue.init();

View File

@ -69,21 +69,6 @@ var ContextMenuHandler = {
this._onPaste();
break;
case "play":
case "pause":
if (node instanceof Ci.nsIDOMHTMLMediaElement)
node[command]();
break;
case "videotab":
if (node instanceof Ci.nsIDOMHTMLVideoElement) {
node.pause();
Cu.import("resource:///modules/video.jsm");
Video.fullScreenSourceElement = node;
sendAsyncMessage("Browser:FullScreenVideo:Start");
}
break;
case "select-all":
this._onSelectAll();
break;

View File

@ -1,154 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<!--
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html xmlns="http://www.w3.org/1999/xhtml" accelerated="11">
<head>
<style type="text/css"><![CDATA[
html,
body,
video {
height: 100%;
}
body {
margin: 0;
background: black;
overflow: -moz-hidden-unscrollable;
}
video {
width: 100%;
max-height: 100%;
}
]]></style>
<script type="application/javascript;version=1.8"><![CDATA[
var TheaterTab = {
videoElement: null,
idleTimer: 0,
init: function init() {
this.videoElement = document.querySelector("video");
/*
* video events
*/
this.videoElement.addEventListener("loadeddata", TheaterTab.loadDataCallback, false);
this.videoElement.addEventListener("seeked", TheaterTab.seekComplete, false);
this.videoElement.addEventListener("pause", TheaterTab.pauseCallback, false);
this.videoElement.addEventListener("play", TheaterTab.playCallback, false);
this.videoElement.addEventListener("ended", TheaterTab.endedCallback, false);
/*
* window events
*/
window.addEventListener("click", function () {
TheaterTab.togglePlay();
TheaterTab.resetIdleTimer();
}, false);
window.addEventListener("unload", function () {
if (TheaterTab.videoElement.currentSrc) {
contentVideo.currentTime = TheaterTab.videoElement.currentTime;
contentVideo.volume = TheaterTab.videoElement.volume;
contentVideo.muted = TheaterTab.videoElement.muted;
if (!TheaterTab.videoElement.paused && !TheaterTab.videoElement.ended) {
TheaterTab.videoElement.pause();
}
}
}, false);
window.addEventListener("keypress", function (event) {
TheaterTab.resetIdleTimer();
}, false);
// Load the video up and play it
this.videoElement.mozLoadFrom(contentVideo);
},
/*
* Video element callbacks
*/
loadDataCallback: function loadDataCallback() {
dump("loadDataCallback()\n");
TheaterTab.videoElement.removeEventListener("loadeddata", arguments.callee, false);
TheaterTab.videoElement.volume = contentVideo.volume;
TheaterTab.videoElement.muted = contentVideo.muted;
TheaterTab.videoElement.poster = contentVideo.poster;
// If we are starting from mid stream, wait until we have
// seeked to the start location.
dump(contentVideo + "\n");
if (contentVideo.currentTime && !contentVideo.ended) {
// set up callback to play
TheaterTab.videoElement.addEventListener("seeked", function () {
TheaterTab.videoElement.removeEventListener("seeked", arguments.callee, false);
TheaterTab.seekComplete();
}, false);
// seek
TheaterTab.videoElement.currentTime = contentVideo.currentTime;
return;
}
TheaterTab.play();
},
seekComplete: function seekComplete() {
TheaterTab.play();
},
pauseCallback: function pauseCallback() {
},
playCallback: function playCallback() {
},
endedCallback: function endedCallback() {
},
/*
* Video control
*/
play: function play() {
this.videoElement.play();
},
pause: function pause() {
this.videoElement.pause();
},
togglePlay: function togglePlay() {
if (this.videoElement.paused) {
this.play();
} else {
this.pause();
}
},
};
Components.utils.import("resource:///modules/video.jsm");
// The video in the content tab we launched from
var contentVideo = Video.fullScreenSourceElement;
// ??
Video.fullScreenSourceElement = null;
]]></script>
</head>
<body onload="TheaterTab.init();">
<video controls="true"/>
</body>
</html>

View File

@ -1,66 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var FullScreenVideo = {
_tab: null,
init: function fsv_init() {
// These come in from content.js, currently we only use Start.
messageManager.addMessageListener("Browser:FullScreenVideo:Start", this.show.bind(this));
messageManager.addMessageListener("Browser:FullScreenVideo:Close", this.hide.bind(this));
messageManager.addMessageListener("Browser:FullScreenVideo:Play", this.play.bind(this));
messageManager.addMessageListener("Browser:FullScreenVideo:Pause", this.pause.bind(this));
// If the screen supports brightness locks, we will utilize that, see checkBrightnessLocking()
try {
this.screen = null;
let screenManager = Cc["@mozilla.org/gfx/screenmanager;1"].getService(Ci.nsIScreenManager);
this.screen = screenManager.primaryScreen;
}
catch (e) {} // The screen does not support brightness locks
},
play: function() {
this.playing = true;
this.checkBrightnessLocking();
},
pause: function() {
this.playing = false;
this.checkBrightnessLocking();
},
checkBrightnessLocking: function() {
// screen manager support for metro: bug 776113
var shouldLock = !!this.screen && !!window.fullScreen && !!this.playing;
var locking = !!this.brightnessLocked;
if (shouldLock == locking)
return;
if (shouldLock)
this.screen.lockMinimumBrightness(this.screen.BRIGHTNESS_FULL);
else
this.screen.unlockMinimumBrightness(this.screen.BRIGHTNESS_FULL);
this.brightnessLocked = shouldLock;
},
show: function fsv_show() {
this.createTab();
this.checkBrightnessLocking();
},
hide: function fsv_hide() {
this.checkBrightnessLocking();
this.destroyTab();
},
createTab: function fsv_createBrowser() {
this._tab = BrowserUI.newTab("chrome://browser/content/fullscreen-video.xhtml");
},
destroyTab: function fsv_destroyBrowser() {
Browser.closeTab(this._tab);
this._tab = null;
}
};

View File

@ -11,7 +11,6 @@ chrome.jar:
content/aboutRights.xhtml (content/pages/aboutRights.xhtml)
content/aboutCrash.xhtml (content/pages/aboutCrash.xhtml)
content/blockedSite.xhtml (content/pages/blockedSite.xhtml)
content/fullscreen-video.xhtml (content/pages/fullscreen-video.xhtml)
content/netError.xhtml (content/pages/netError.xhtml)
content/bindings/bindings.xml (content/bindings/bindings.xml)
@ -85,7 +84,6 @@ chrome.jar:
content/console.js (content/console.js)
content/AnimatedZoom.js (content/AnimatedZoom.js)
content/LoginManagerChild.js (content/LoginManagerChild.js)
content/video.js (content/video.js)
#ifdef MOZ_SERVICES_SYNC
* content/sync.js (content/sync.js)
content/RemoteTabs.js (content/RemoteTabs.js)

View File

@ -10,8 +10,4 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
EXTRA_JS_MODULES = \
video.jsm \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -1,9 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
this.EXPORTED_SYMBOLS = ["Video"];
this.Video = {
fullScreenSourceElement: null
};