Bug 237322
| Summary: | webaudio api is muted when the iOS ringer is muted | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Derk-Jan Hartman <hartman.wiki> |
| Component: | Web Audio | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED CONFIGURATION CHANGED | ||
| Severity: | Normal | CC: | adrian+webkit, bfulgham, carlosj-webkit-bugzilla, cdumez, chrisguttandin, ddp.bkdn, jean-yves.avenard, jer.noble, mattwindwer, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 15 | ||
| Hardware: | iPhone / iPad | ||
| OS: | iOS 15 | ||
Derk-Jan Hartman
1. Set your iPhone to silent with the side toggle
2. Play an <audio> or <video> element. Both are audible
3. Try to use anything with WebAudio API. AudioContext/AudioBufferSourceNode/Webaudio API is muted.
This is a difference in the channel used by the APIs. Audio and video element are on the media channel, where webaudio seems to be on the default/ringer channel of iOS.
This is HIGHLY confusing. I cannot count the amount of times where I have begun playback using webaudio and figured the webpage had broken, only to figure out that because I always have my phone set to Silent, the audio is muted.
There are even workaround for this in the wild, where people play a clip of silence using <audio> on loop, to open up the media audio channel and force the mixer to merge both audio sources and output the webaudio api to the media channel.
WebAudio API should either:
1. use the media channel (as it already requires a user interaction to unmute, I'm not sure why it would NOT be on the media channel)
2. at the very least present some visual feedback indicating that audio is muted because the ringer is muted.
I hope this can be fixed.
Wikipedia tracking ticket: https://phabricator.wikimedia.org/T301741
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/89964986>
Derk-Jan Hartman
Wikipedia has applied the mentioned workaround as well now. But a proper fix would be appreciated as this is rather suboptimal and impacts performance.
var el = document.createElement( 'audio' );
el.src = 'silence.mp3'; // media file with tiny bit of silence
el.play();
context = new AudioContext();
Brent Fulgham
This is actually being tracked here:
rdar://43514261
Adrian Holovaty
This comes up so often for our customers at Soundslice that we made a dedicated help page for the issue:
https://www.soundslice.com/help/en/player/troubleshooting/235/no-sound-on-ios/
Carlos J.
The workaround also means the lock-screen will display media-controls for the silent file running in the background. Which is highly confusing for users.
Jean-Yves Avenard [:jya]
Since iOS 17, you can set the audio session type to "playback".
Add in your code something like `navigator.audioSession.type = "playback"` and audio will not be suspended.
By default the type is `ambient` and so audio will be muted if the phone is muted.