mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-10 05:47:04 +00:00
Bug 876380. Update 'show clickToPlay button' state after each load. r=dolske
This commit is contained in:
parent
c962242550
commit
07b9d50661
@ -348,8 +348,10 @@
|
|||||||
// Since the play button will be showing, we don't want to
|
// Since the play button will be showing, we don't want to
|
||||||
// show the throbber behind it. The throbber here will
|
// show the throbber behind it. The throbber here will
|
||||||
// only show if needed after the play button has been pressed.
|
// only show if needed after the play button has been pressed.
|
||||||
if (!this.clickToPlay.hidden)
|
if (!this.clickToPlay.hidden) {
|
||||||
|
this.startFadeOut(this.statusOverlay, true);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var show = false;
|
var show = false;
|
||||||
if (this.video.seeking ||
|
if (this.video.seeking ||
|
||||||
@ -463,6 +465,26 @@
|
|||||||
this.video.addEventListener("media-showStatistics", this._handleCustomEventsBound, false, true);
|
this.video.addEventListener("media-showStatistics", this._handleCustomEventsBound, false, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setupNewLoadState : function() {
|
||||||
|
// videocontrols.css hides the control bar by default, because if script
|
||||||
|
// is disabled our binding's script is disabled too (bug 449358). Thus,
|
||||||
|
// the controls are broken and we don't want them shown. But if script is
|
||||||
|
// enabled, the code here will run and can explicitly unhide the controls.
|
||||||
|
//
|
||||||
|
// For videos with |autoplay| set, we'll leave the controls initially hidden,
|
||||||
|
// so that they don't get in the way of the playing video. Otherwise we'll
|
||||||
|
// go ahead and reveal the controls now, so they're an obvious user cue.
|
||||||
|
//
|
||||||
|
// (Note: the |controls| attribute is already handled via layout/style/html.css)
|
||||||
|
var shouldShow = this.video.paused &&
|
||||||
|
(!(this.video.autoplay && this.video.mozAutoplayEnabled) ||
|
||||||
|
!this.dynamicControls);
|
||||||
|
// Hide the overlay if the video time is non-zero or if an error occurred to workaround bug 718107.
|
||||||
|
this.startFade(this.clickToPlay, shouldShow && !this.isAudioOnly &&
|
||||||
|
this.video.currentTime == 0 && !this.hasError(), true);
|
||||||
|
this.startFade(this.controlBar, shouldShow, true);
|
||||||
|
},
|
||||||
|
|
||||||
handleCustomEvents : function (e) {
|
handleCustomEvents : function (e) {
|
||||||
if (!e.isTrusted)
|
if (!e.isTrusted)
|
||||||
return;
|
return;
|
||||||
@ -553,6 +575,8 @@
|
|||||||
this.statusIcon.setAttribute("type", "throbber");
|
this.statusIcon.setAttribute("type", "throbber");
|
||||||
this.isAudioOnly = (this.video instanceof HTMLAudioElement);
|
this.isAudioOnly = (this.video instanceof HTMLAudioElement);
|
||||||
this.setPlayButtonState(true);
|
this.setPlayButtonState(true);
|
||||||
|
this.setupNewLoadState();
|
||||||
|
this.setupStatusFader();
|
||||||
break;
|
break;
|
||||||
case "progress":
|
case "progress":
|
||||||
this.statusIcon.removeAttribute("stalled");
|
this.statusIcon.removeAttribute("stalled");
|
||||||
@ -596,6 +620,7 @@
|
|||||||
break;
|
break;
|
||||||
case "emptied":
|
case "emptied":
|
||||||
this.bufferBar.value = 0;
|
this.bufferBar.value = 0;
|
||||||
|
this.showPosition(0, 0);
|
||||||
break;
|
break;
|
||||||
case "seeking":
|
case "seeking":
|
||||||
this.showBuffered();
|
this.showBuffered();
|
||||||
@ -1379,23 +1404,7 @@
|
|||||||
this.stats.framesPainted = document.getAnonymousElementByAttribute(binding, "class", "statFramesPainted");
|
this.stats.framesPainted = document.getAnonymousElementByAttribute(binding, "class", "statFramesPainted");
|
||||||
|
|
||||||
this.setupInitialState();
|
this.setupInitialState();
|
||||||
|
this.setupNewLoadState();
|
||||||
// videocontrols.css hides the control bar by default, because if script
|
|
||||||
// is disabled our binding's script is disabled too (bug 449358). Thus,
|
|
||||||
// the controls are broken and we don't want them shown. But if script is
|
|
||||||
// enabled, the code here will run and can explicitly unhide the controls.
|
|
||||||
//
|
|
||||||
// For videos with |autoplay| set, we'll leave the controls initially hidden,
|
|
||||||
// so that they don't get in the way of the playing video. Otherwise we'll
|
|
||||||
// go ahead and reveal the controls now, so they're an obvious user cue.
|
|
||||||
//
|
|
||||||
// (Note: the |controls| attribute is already handled via layout/style/html.css)
|
|
||||||
var shouldShow = (!(this.video.autoplay && this.video.mozAutoplayEnabled) || !this.dynamicControls);
|
|
||||||
// Hide the overlay if the video time is non-zero or if the video is already playing
|
|
||||||
// or if an error occurred to workaround bug 718107.
|
|
||||||
this.startFade(this.clickToPlay, shouldShow && this.video.paused && !this.isAudioOnly &&
|
|
||||||
this.video.currentTime == 0 && !this.hasError(), true);
|
|
||||||
this.startFade(this.controlBar, shouldShow, true);
|
|
||||||
|
|
||||||
// Use the handleEvent() callback for all media events.
|
// Use the handleEvent() callback for all media events.
|
||||||
// The "error" event listener must capture, so that it can trap error events
|
// The "error" event listener must capture, so that it can trap error events
|
||||||
|
Loading…
Reference in New Issue
Block a user