Skip to content

Commit

Permalink
Feat(UI): Exit PiP when destroying UI
Browse files Browse the repository at this point in the history
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
  • Loading branch information
theodab authored and joeyparrish committed Oct 12, 2021
1 parent 78981e3 commit b132867
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ui/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b132867

Please sign in to comment.