From 3b0367ec3a3c6ddae8509e46884146e4be6a41bd Mon Sep 17 00:00:00 2001 From: Jacob Trimble Date: Mon, 29 Jul 2019 11:21:40 -0700 Subject: [PATCH] Exit PIP on unload in the demo. 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 --- demo/close_button.js | 6 ------ demo/main.js | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/demo/close_button.js b/demo/close_button.js index 4e172788b7..2c4c8003d8 100644 --- a/demo/close_button.js +++ b/demo/close_button.js @@ -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(); }); diff --git a/demo/main.js b/demo/main.js index 66a00bf839..86bb4f8fee 100644 --- a/demo/main.js +++ b/demo/main.js @@ -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.