w3c / audio-session

https://w3c.github.io/audio-session/
Other
2 stars 3 forks source link

Consider exposing/implementing audioSession options #18

Open doraorak opened 3 months ago

doraorak commented 3 months ago

In ios there are multiple options to configure AVAudioSession instances (https://developer.apple.com/documentation/avfaudio/avaudiosessioncategoryoptions?language=objc). Since this API is just changing the Category of the AVAudioSession in the webprocess where WKWebView is getting rendered and playing audio, it only makes sense we should be able to set its options as well. Thanks.

youennf commented 2 months ago

Do you have a specific use-case in mind that would not be covered by the existing API?

doraorak commented 2 months ago

For example it would allow us to have normal output volume (instead of low) when using play-and-record category (https://developer.apple.com/documentation/avfaudio/avaudiosessioncategoryoptions/avaudiosessioncategoryoptiondefaulttospeaker?language=objc) or mix external audio (like spotify) with the wkwebview's audio while the ringer switch is on silent (https://developer.apple.com/documentation/avfaudio/avaudiosessioncategoryoptions/avaudiosessioncategoryoptionmixwithothers?language=objc)

Most importantly it would improve the coherence between native and web/hybrid applications

youennf commented 2 months ago

Thanks for the input, this is useful.

The first usecase is related to speaker selection, which is something AudioSession could tackle.

The second one is related to ongoing discussions on how a tab audio can mix with other tabs or other apps.