Skip to content

Commit

Permalink
feat(UI): Allow customizate FullScreen element (shaka-project#4963)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Feb 3, 2023
1 parent 5d93b8f commit c471d23
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ui/controls.js
Expand Up @@ -594,7 +594,8 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
if (document.pictureInPictureElement) {
await document.exitPictureInPicture();
}
await this.videoContainer_.requestFullscreen({navigationUI: 'hide'});
const fullScreenElement = this.config_.fullScreenElement;
await fullScreenElement.requestFullscreen({navigationUI: 'hide'});

if (this.config_.forceLandscapeOnFullscreen && screen.orientation) {
// Locking to 'landscape' should let it be either
Expand Down
6 changes: 5 additions & 1 deletion ui/externs/ui.js
Expand Up @@ -85,7 +85,8 @@ shaka.extern.UIVolumeBarColors;
* enableFullscreenOnRotation: boolean,
* forceLandscapeOnFullscreen: boolean,
* enableTooltips: boolean,
* keyboardSeekDistance: number
* keyboardSeekDistance: number,
* fullScreenElement: HTMLElement
* }}
*
* @property {!Array.<string>} controlPanelElements
Expand Down Expand Up @@ -183,6 +184,9 @@ shaka.extern.UIVolumeBarColors;
* right keyboard keys when the video is selected. If less than or equal to 0,
* no seeking will occur.
* Defaults to 5 seconds.
* @property {HTMLElement} fullScreenElement
* DOM element on which fullscreen will be done.
* Defaults to Shaka Player Container.
* @exportDoc
*/
shaka.extern.UIConfiguration;
Expand Down
4 changes: 4 additions & 0 deletions ui/ui.js
Expand Up @@ -34,6 +34,9 @@ shaka.ui.Overlay = class {
/** @private {shaka.Player} */
this.player_ = player;

/** @private {HTMLElement} */
this.videoContainer_ = videoContainer;

/** @private {!shaka.extern.UIConfiguration} */
this.config_ = this.defaultConfig_();

Expand Down Expand Up @@ -240,6 +243,7 @@ shaka.ui.Overlay = class {
forceLandscapeOnFullscreen: true,
enableTooltips: false,
keyboardSeekDistance: 5,
fullScreenElement: this.videoContainer_,
};

// Check AirPlay support
Expand Down

0 comments on commit c471d23

Please sign in to comment.