Bug 1822999 - allow mute from PiP window for YouTube Shorts r=pip-reviewers,niklas

Differential Revision: https://phabricator.services.mozilla.com/D179378
This commit is contained in:
Katherine Patenio 2023-06-20 16:14:53 +00:00
parent 65be1cbe7a
commit 44662a6086

View File

@ -6,7 +6,13 @@
class PictureInPictureVideoWrapper {
constructor(video) {
this.player = video.closest("#movie_player")?.wrappedJSObject;
// Use shorts player only if video is from YouTube Shorts.
let shortsPlayer = video.closest("#shorts-player")?.wrappedJSObject;
let isYTShorts = !!(video.baseURI.includes("shorts") && shortsPlayer);
this.player = isYTShorts
? shortsPlayer
: video.closest("#movie_player")?.wrappedJSObject;
}
isLive(video) {
return !!document.querySelector(".ytp-live");