commit 8429c93bf225f6312c6bfee9470c306da0849bce
parent bcae93afe265d4fe48afb4217c0b8da9b92d6324
Author: Mike Conley <mconley@mozilla.com>
Date: Mon, 1 Dec 2025 21:40:57 +0000
Bug 1997401 - Add a preference to auto-enable video PiP when switching tabs. r=fluent-reviewers,mstriemer,bolsson
Differential Revision: https://phabricator.services.mozilla.com/D273054
Diffstat:
3 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
@@ -191,6 +191,10 @@ Preferences.addAll([
id: "media.videocontrols.picture-in-picture.video-toggle.enabled",
type: "bool",
},
+ {
+ id: "media.videocontrols.picture-in-picture.enable-when-switching-tabs.enabled",
+ type: "bool",
+ },
// Media
{ id: "media.hardwaremediakeys.enabled", type: "bool" },
@@ -528,6 +532,16 @@ Preferences.addSetting({
},
});
Preferences.addSetting({
+ id: "pictureInPictureEnableWhenSwitchingTabs",
+ pref: "media.videocontrols.picture-in-picture.enable-when-switching-tabs.enabled",
+ deps: ["pictureInPictureToggleEnabled"],
+ onUserChange(checked) {
+ if (checked) {
+ Glean.pictureinpictureSettings.enableAutotriggerSettings.record();
+ }
+ },
+});
+Preferences.addSetting({
id: "mediaControlToggleEnabled",
pref: "media.hardwaremediakeys.enabled",
// For media control toggle button, we support it on Windows, macOS and
@@ -2078,6 +2092,12 @@ SettingGroupManager.registerGroups({
id: "pictureInPictureToggleEnabled",
l10nId: "browsing-picture-in-picture-toggle-enabled",
supportPage: "picture-in-picture",
+ items: [
+ {
+ id: "pictureInPictureEnableWhenSwitchingTabs",
+ l10nId: "browsing-picture-in-picture-enable-when-switching-tabs",
+ },
+ ],
},
{
id: "mediaControlToggleEnabled",
diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl
@@ -671,6 +671,10 @@ browsing-picture-in-picture-toggle-enabled =
.label = Enable Picture-in-Picture video controls
.accesskey = E
+browsing-picture-in-picture-enable-when-switching-tabs =
+ .label = Keep playing videos in Picture-in-Picture when switching tabs
+ .accesskey = s
+
browsing-media-control =
.label = Control media via keyboard, headset, or virtual interface
.accesskey = v
diff --git a/browser/modules/BrowserUsageTelemetry.sys.mjs b/browser/modules/BrowserUsageTelemetry.sys.mjs
@@ -525,10 +525,6 @@ export let BrowserUsageTelemetry = {
this._inited = true;
Services.prefs.addObserver("browser.tabs.inTitlebar", this);
- Services.prefs.addObserver(
- "media.videocontrols.picture-in-picture.enable-when-switching-tabs.enabled",
- this
- );
Services.prefs.addObserver("idle-daily", this);
this._recordUITelemetry();
@@ -641,12 +637,6 @@ export let BrowserUsageTelemetry = {
"pref"
);
break;
- case "media.videocontrols.picture-in-picture.enable-when-switching-tabs.enabled":
- if (Services.prefs.getBoolPref(data)) {
- Glean.pictureinpictureSettings.enableAutotriggerSettings.record();
- }
- break;
-
case "idle-daily":
this._recordInitialPrefValues();
break;