Bug 264473
| Summary: | No sound from HTMLAudioElement when navigator.audioSession.type is set to "transient" or "transient-solo" | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Danny Moerkerke <drmoerkerke> |
| Component: | Media | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | drmoerkerke, jer.noble, webkit-bug-importer, youennf |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 17 | ||
| Hardware: | iPhone / iPad | ||
| OS: | iOS 17 | ||
Danny Moerkerke
In Safari 17 on iOS 17 when an HTMLAudioElement is playing audio and navigator.audioSession.type is set to "transient" or "transient-solo" the audio continues playing but there is no sound anymore.
When audio is played by another app, for example Music, the audio from that app is paused, regardless to what navigator.audioSession.type is set to.
The Feature Flags AudioSession API and AudioSession full API are both on.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/118503217>
youenn fablet
I had a try on iOS 17.4 and it seems to work as expected, using https://jsfiddle.net/e9ahcb35/.
Setting "transient" triggers using https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616560-ambient.
If the silent switch is on, video is muted, otherwise it is not.
Maybe that is what you experienced?
As of mixing with other apps, I tried the following:
1. Launch music app
2. Open https://jsfiddle.net/e9ahcb35/ and play.
I can hear both audio in that case.
If the page is backgrounded, audio is stopped, which seems expected as well.
Marking as Invalid although it should really be "Behave as expected".
@Danny, feel free to reopen the bug especially if there is a particular point I missed.
Danny Moerkerke
(In reply to youenn fablet from comment #2)
> I had a try on iOS 17.4 and it seems to work as expected, using
> https://jsfiddle.net/e9ahcb35/.
>
> Setting "transient" triggers using
> https://developer.apple.com/documentation/avfaudio/avaudiosession/category/
> 1616560-ambient.
>
> If the silent switch is on, video is muted, otherwise it is not.
> Maybe that is what you experienced?
>
> As of mixing with other apps, I tried the following:
> 1. Launch music app
> 2. Open https://jsfiddle.net/e9ahcb35/ and play.
> I can hear both audio in that case.
>
> If the page is backgrounded, audio is stopped, which seems expected as well.
>
> Marking as Invalid although it should really be "Behave as expected".
>
> @Danny, feel free to reopen the bug especially if there is a particular
> point I missed.
Thanks, when the options "transient" and "transient-solo" are selected, the audio from the web app is now mixed with the audio coming from the Music App on iOS, but on MacOS Sonoma 14.4 the audio from the web app is always mixed with the audio from other apps, regardless to what navigator.audioSession.type is set to.
When navigator.audioSession.type is set to "play-and-record" on iOS 17.4 it still pauses the audio from other apps when the mic is accessed from the web app with navigator.mediaDevices.getUserMedia.
Danny Moerkerke
On iOS 18 when "transient" is selected, the audio plays but without sound.
On macOS Sequoia 15, there is sound when "transient" is selected and sound from the web app is always mixed with sound from other apps, regardless of the setting of navigator.audioSession.type.
To reproduce:
1. go to https://whatpwacando.today/audiosession on iOS 18
2. select "transient" and play the audio
3. no sound will be heard
1. go to https://whatpwacando.today/audiosession on macOS Sequoia 15
2. play audio from the app
3. play audio from another app
4. sound from both apps is always mixed, regardless of the setting of navigator.audioSession.type or which audio is started first
Danny Moerkerke
Why is this marked as resolved/invalid?
youenn fablet
I only tried iOS but the following happens when doing the above steps on iOS 18:
- sound will be heard if the silent switch is off
- sound will not be heard if the silent switch is on.
This behavior is aligned with https://developer.apple.com/documentation/avfaudio/avaudiosession/category-swift.struct/ambient?language=objc.
It should really be `work as expected` I think.
Danny Moerkerke
So then how exactly is this supposed to work?
When I go to https://develop.d2xzysuz5yen89.amplifyapp.com/audiosession on iOS 18.3.1, select "transient" and play the audio there is *no sound*.
The same is true when I select "transient-solo" and play audio: *no sound*.
The only difference is now that when I play audio from another app and then select "transient-solo" and play the audio, the audio from the other app is muted but there is still no sound fromt he demo app.
Is this is "works as expected" then what is the whole point of this API?