Bug 618124 - Don't use the play event to start fullscreen video [r=mfinkle]

This commit is contained in:
Wes Johnston 2011-01-10 09:48:41 -08:00
parent cfc98c9439
commit 37e8079116
2 changed files with 16 additions and 3 deletions

View File

@ -39,12 +39,20 @@ function closeFullScreen() {
sendAsyncMessage("Browser:FullScreenVideo:Close");
}
function startPlayback(aEvent) {
let target = aEvent.originalTarget;
contentObject._sendMouseEvent("mousedown", target, 0, 0);
contentObject._sendMouseEvent("mousemove", target, 0, 0);
contentObject._sendMouseEvent("mouseup", target, 0, 0);
}
addEventListener("click", function(aEvent) {
if (aEvent.target.id == "close")
closeFullScreen();
}, false);
addEventListener("CloseVideo", closeFullScreen, false);
addEventListener("StartVideo", startPlayback, false);
addEventListener("PlayVideo", function() {
sendAsyncMessage("Browser:FullScreenVideo:Play");

View File

@ -104,8 +104,7 @@ function init() {
showUI();
resetIdleTimer();
video.controls = true;
video.play();
sendStartEvent(video);
}, false);
// Automatically close this window when the playback ended, unless the user
@ -128,6 +127,12 @@ function init() {
video.mozLoadFrom(contentVideo);
}
function sendStartEvent(aElt) {
let event = document.createEvent("Event");
event.initEvent("StartVideo", true, true);
aElt.dispatchEvent(event);
}
window.addEventListener("unload", function () {
if (video.currentSrc) {
contentVideo.currentTime = video.currentTime;
@ -221,6 +226,6 @@ function hideUI() {
</head>
<body class="loadingdata" onload="init();">
<span id="close"/>
<video/>
<video controls="true"/>
</body>
</html>