diff --git a/toolkit/content/widgets/videocontrols.xml b/toolkit/content/widgets/videocontrols.xml index 6c4cb237c831..8a82146f47d9 100644 --- a/toolkit/content/widgets/videocontrols.xml +++ b/toolkit/content/widgets/videocontrols.xml @@ -1234,12 +1234,38 @@ }, onFullscreenChange() { + this.updateOrientationState(this.isVideoInFullScreen()); if (this.isVideoInFullScreen()) { Utils._hideControlsTimeout = setTimeout(this._hideControlsFn, this.HIDE_CONTROLS_TIMEOUT_MS); } this.setFullscreenButtonState(); }, + updateOrientationState(lock) { + if (!this.video.mozOrientationLockEnabled) { + return; + } + if (lock) { + if (this.video.mozIsOrientationLocked) { + return; + } + let dimenDiff = this.video.videoWidth - this.video.videoHeight; + if (dimenDiff > 0) { + this.video.mozIsOrientationLocked = window.screen.mozLockOrientation("landscape"); + } else if (dimenDiff < 0) { + this.video.mozIsOrientationLocked = window.screen.mozLockOrientation("portrait"); + } else { + this.video.mozIsOrientationLocked = window.screen.mozLockOrientation(window.screen.orientation); + } + } else { + if (!this.video.mozIsOrientationLocked) { + return; + } + window.screen.mozUnlockOrientation(); + this.video.mozIsOrientationLocked = false; + } + }, + clickToPlayClickHandler(e) { if (e.button != 0) { return; @@ -1836,6 +1862,7 @@ , which meant that the XBL machinery // undefined the property when the element was unbound. The code in // this file actually depends on this, so now that randomID is an