Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we expose implicit audio session state #2

Open
youennf opened this issue Nov 8, 2022 · 5 comments
Open

Should we expose implicit audio session state #2

youennf opened this issue Nov 8, 2022 · 5 comments
Labels
TPAC2024 Topic for discussion at TPAC 2024

Comments

@youennf
Copy link

youennf commented Nov 8, 2022

When playing a HTMLMediaElement, starting an AudioContext or capturing microphone, the User Agent is modifying its internal AudioSession.
Should we expose this AudioSession and its states?
For instance, the implicit AudioSession might change from playback to play-and-record when calling getUserMedia.
Should this audio session type change be exposed?

@youennf
Copy link
Author

youennf commented Nov 8, 2022

One use case to expose the implicit audio session is to expose the suspended state.
navigator.audioSession could be overridden when the session type changes for instance.
Say getUserMedia is called, getUserMedia algorithm would try to use the current audio session if the type allows it.
If the type is not matching, the algorithm would create a new one AudioSession and inactivating/overriding the current one, thus triggering corresponding events.

@youennf
Copy link
Author

youennf commented Nov 8, 2022

Ditto with HTMLMediaElement or AudioContext:

  • When HTMLMediaElement starts playing audio and audio session is null, a new one is created with type 'playback'.
  • When AudioContext starts playing audio and audio session is null, a new one is created with type 'ambient'.

Otherwise the current audio session is used.

@youennf
Copy link
Author

youennf commented Nov 8, 2022

The alternative is to introduce a type setter, plus event in case UA has to override/change the audio session type: audioSession.type = "play-and-record"

@jernoble
Copy link

I don't think we should expose the underlying session state; leaving it as "auto" is sufficient.

@chrisn chrisn added the TPAC2024 Topic for discussion at TPAC 2024 label Aug 1, 2024
@youennf
Copy link
Author

youennf commented Sep 19, 2024

Tentative TPAC 2024 proposal: keep auto as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TPAC2024 Topic for discussion at TPAC 2024
Projects
None yet
Development

No branches or pull requests

3 participants