diff --git a/demo/close_button.js b/demo/close_button.js index e89b6aedd3..570ff38d5c 100644 --- a/demo/close_button.js +++ b/demo/close_button.js @@ -36,7 +36,7 @@ shakaDemo.CloseButton = class extends shaka.ui.Element { window.documentPictureInPicture, 'enter', () => { this.button_.style.display = 'none'; const pipWindow = window.documentPictureInPicture.window; - this.eventManager.listen(pipWindow, 'unload', () => { + this.eventManager.listen(pipWindow, 'pagehide', () => { this.button_.style.display = 'block'; }); }); diff --git a/ui/pip_button.js b/ui/pip_button.js index b57d83ffb9..9fad6837af 100644 --- a/ui/pip_button.js +++ b/ui/pip_button.js @@ -187,7 +187,7 @@ shaka.ui.PipButton = class extends shaka.ui.Element { this.onEnterPictureInPicture_(); // Listen for the PiP closing event to move the player back. - this.eventManager.listenOnce(pipWindow, 'unload', () => { + this.eventManager.listenOnce(pipWindow, 'pagehide', () => { placeholder.replaceWith(/** @type {!Node} */(pipPlayer)); }); }