Open Bug 1341559 Opened 7 years ago Updated 2 years ago

Expose volume per Tabs to WebExtensions

Categories

(WebExtensions :: General, defect, P5)

defect

Tracking

(Not tracked)

REOPENED

People

(Reporter: baku, Unassigned)

Details

(Whiteboard: [triaged] tabs)

For each window we have a full control of the mute/unmute state and the volume. I think it would be nice to expose this values (read/write) to WebExtensions.
We should also send a notification when a page starts/stops producing audio.
I think a nice way to expose this feature would be to extend the Window object introducing:

Window.audio instanceOf WindowAudio

WindowAudio {
  float volume;
  bool muted;
}

Note that we can have muted = true and volume = 1.0. muted doesn't mean volume == 0.

About callbacks:

browser.windows.onAudioChanged = function(Window) { ...
It seems we have something for 'mute' here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs
We should extend it in order to support volume as well.
Summary: Expose volume/mute per window to WebExtensions → Expose volume per Tabs to WebExtensions
We already support the mute property on tabs (both for reading its state and to update it), and so I think that it "sounds" more than reasonable to expose a similar feature for the actual volume.

If we want to provide it through an API similar to how the mute is currently exposed, the API could be probably something like:

```
browser.tabs.onUpdated.addListener((tab) => {
  console.log("Tab volume", tab.volume);
});
browser.tabs.update(tabId, {volume: 20});
```

Side notes: 
the mute is also visible in the browser UI as a small icon in the tab UI, and the user can mute/unmute the tab by clicking on it.
Is the volume currently accessible somewhere from the existent browser UI?
In other words, if the user cannot change or restore the volume otherwise, what should it happen if the addon has been disabled/uninstalled?
> In other words, if the user cannot change or restore the volume otherwise,
> what should it happen if the addon has been disabled/uninstalled?

This is actually a good point. I don't have an answer. Is this a blocker for implementing this feature?
We already expose muting and sound playing information (including notifications when it changes) via the tabs API. We don't expose volume information, though.

If we want to expose muting at a browser window level in addition to the tab level, I suppose that would be doable enough.
Priority: -- → P5
Whiteboard: [triaged] tabs
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
Status: RESOLVED → REOPENED
Resolution: INACTIVE → ---
Product: Toolkit → WebExtensions
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.