Skip to content

Commit

Permalink
Exit PIP on unload in the demo.
Browse files Browse the repository at this point in the history
When unloading content (e.g. when closing or when deleting offline
content), we should exit the PIP window and fullscreen.  This moves
these actions to the unload() method so they affect other sources of
unloads.

Fixes #2055

Change-Id: Ie1b5ac0f7cb814ff6bae3b08cc4c1fc80967d941
  • Loading branch information
TheModMaker committed Jul 29, 2019
1 parent 2c51de2 commit 3b0367e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 0 additions & 6 deletions demo/close_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ shakaDemo.CloseButton = class extends shaka.ui.Element {
this.parent.appendChild(this.button_);

this.button_.addEventListener('click', () => {
if (document.fullscreenElement) {
document.exitFullscreen();
}
if (document.pictureInPictureElement) {
document.exitPictureInPicture();
}
shakaDemoMain.unload();
});

Expand Down
6 changes: 6 additions & 0 deletions demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,12 @@ shakaDemo.Main = class {
this.hideNode_(videoBar);
this.video_.poster = shakaDemo.Main.mainPoster_;

if (document.fullscreenElement) {
document.exitFullscreen();
}
if (document.pictureInPictureElement) {
document.exitPictureInPicture();
}
this.player_.unload();

// The currently-selected asset changed, so update asset cards.
Expand Down

0 comments on commit 3b0367e

Please sign in to comment.