Merge pull request #7796 from cbackas/dev

Feature: Add checks for sound before auto toggling PiP
This commit is contained in:
mr. m
2025-04-22 14:24:08 +02:00
committed by GitHub
2 changed files with 24 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
diff --git a/toolkit/actors/PictureInPictureChild.sys.mjs b/toolkit/actors/PictureInPictureChild.sys.mjs
index 7ae1aa58bbaeab7a1835a3ea8328735d4f4ecfb1..9d0679dde3c031c2459c09ffbc157f32bc7d003a 100644
--- a/toolkit/actors/PictureInPictureChild.sys.mjs
+++ b/toolkit/actors/PictureInPictureChild.sys.mjs
@@ -291,6 +291,7 @@ export class PictureInPictureLauncherChild extends JSWindowActorChild {
if (
video &&
PictureInPictureChild.videoIsPlaying(video) &&
+ !video.muted &&
PictureInPictureChild.videoIsPiPEligible(video)
) {
this.togglePictureInPicture({ video, reason: "AutoPip" }, false);

View File

@@ -1,8 +1,18 @@
diff --git a/toolkit/components/pictureinpicture/PictureInPicture.sys.mjs b/toolkit/components/pictureinpicture/PictureInPicture.sys.mjs
index 5da0404b2672ba8cce7bcf808bf2373474776654..3b93217b38f25f54d7ef44d151e314bc1c5e5ce3 100644
index 5da0404b2672ba8cce7bcf808bf2373474776654..6a22fce1212bd6ac6bdd4962b8247c3db956f0eb 100644
--- a/toolkit/components/pictureinpicture/PictureInPicture.sys.mjs
+++ b/toolkit/components/pictureinpicture/PictureInPicture.sys.mjs
@@ -494,7 +494,7 @@ export var PictureInPicture = {
@@ -126,6 +126,9 @@ export class PictureInPictureToggleParent extends JSWindowActorParent {
if (browser.ownerGlobal.gBrowser.selectedBrowser == browser) {
break;
}
+ if (browser.audioMuted) {
+ break;
+ }
let actor = browsingContext.currentWindowGlobal.getActor(
"PictureInPictureLauncher"
);
@@ -494,7 +497,7 @@ export var PictureInPicture = {
// focus the tab's window
tab.ownerGlobal.focus();