Repository navigation
Player: the audio output can be chosen (Firefox's own device chooser) - #580
Merged
Merged
Conversation
The audio button's list gets an "Audio output" part: Default output, the device chosen, and "Choose an output..." (Firefox's selectAudioOutput). All of the player's sound runs through Web Audio and Firefox has no AudioContext.setSinkId, so for a chosen device the graph's end moves to a MediaStreamAudioDestinationNode that a hidden <audio> plays on the device (setSinkId); the default output is unchanged. Measured on Firefox 158: the chooser needs a click, also for a known device, and a device is usable only in the page it was chosen in. So the choice is kept, and each new video starts on the default output and says so: one click on the notice opens the chooser with that device picked. An unplugged device goes back to the default output with the same notice. The player's iframe gets allow="speaker-selection" (Firefox refuses both calls without it). - AudioOutputDevice.mjs, its tests drafted by glm-5.3-flash and checked; glm's two reviews found six real bugs (a frozen kept choice, overtaken routes, an abandoned choice saved, the channel count, a gone preselected device, a stale notice), each with a test red without it. - StatusManager: a message may have a click of its own (it shows as clickable). - 7 strings in 16 locales (gemma4:cloud, checked; six "choose it again" fixed by hand). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # chrome/_locales/de/messages.json # chrome/_locales/en/messages.json # chrome/_locales/es/messages.json # chrome/_locales/fr/messages.json # chrome/_locales/id/messages.json # chrome/_locales/it/messages.json # chrome/_locales/ja/messages.json # chrome/_locales/ko/messages.json # chrome/_locales/ms/messages.json # chrome/_locales/nl/messages.json # chrome/_locales/pl/messages.json # chrome/_locales/pt_BR/messages.json # chrome/_locales/ru/messages.json # chrome/_locales/tr/messages.json # chrome/_locales/zh_CN/messages.json # chrome/_locales/zh_TW/messages.json # combined-locales.json
… and counts track rows only The audio list has an "Audio output" part under its tracks now (AudioOutputDevice), and its button shows wherever this Firefox can choose an output, also with one track; the test expected it hidden there (CI's Linux and Firefox Beta playback shards). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The sound can now play on another device than the system's default, headphones for example. The audio button's list gets an Audio output part with three rows: Default output, the device chosen, and Choose an output…, which opens Firefox's own device chooser.
How it routes the sound
AudioContext.setSinkId.MediaStreamAudioDestinationNode, and a hidden<audio>plays that stream on the device (setSinkId).Measured in Firefox 158 first (extension pages; the harness answers the chooser with
media.navigator.permission.disabled):selectAudioOutput, elementsetSinkIdAudioContext.setSinkIdallow="speaker-selection"NotAllowedError, permissions policy);content.jsnow gives the player's iframe the tokenselectAudioOutputwithout a click, even with a knowndeviceIdInvalidStateError: requires transient user activationNotFoundErrorSo each new video starts on the default output and says so
devicechange) sends the sound back to the default output, with the same notice.Not established
glm-5.3-flash as helper and checker
choose()could save a choice the user had already abandoned;new Audio()does not setautoplay.Tests
AudioOutputDevice.test.mjs(20).statusLevels.test.mjs: a clickable message; both tests are red on the old StatusManager.audio-output.e2e.mjsin a page's iframe: choose a device, the next video's notice and its click, back to the default. It passed in Firefox 158 and skips on a machine without audio output (CI's runners may have none).🤖 Generated with Claude Code