From 38cfc230483133862cc41153931f4dc170eb4a75 Mon Sep 17 00:00:00 2001 From: Theodore Abshire Date: Tue, 27 Jul 2021 12:59:41 -0700 Subject: [PATCH] Feat(UI): Exit PiP when destroying UI The UI can open up Picture-in-Picture mode, through the PiP button, but it does not automatically leave PiP mode when being destroyed. This CL adds leaving PiP mode to the destroy process. Closes #3553 Change-Id: I6830a7ceed7e4ca4fbd0e7d36b8257d564e0226c --- ui/controls.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/controls.js b/ui/controls.js index 7660ccaf20..b27143d20a 100644 --- a/ui/controls.js +++ b/ui/controls.js @@ -198,6 +198,10 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget { * @export */ async destroy() { + if (document.pictureInPictureElement == this.localVideo_) { + await document.exitPictureInPicture(); + } + if (this.eventManager_) { this.eventManager_.release(); this.eventManager_ = null;