WebAudio / web-audio-api

The Web Audio API v1.0, developed by the W3C Audio WG
https://webaudio.github.io/web-audio-api/
Other
1.04k stars 165 forks source link

BF cache support for setSinkId #2519

Closed alvinjiooo closed 1 year ago

alvinjiooo commented 1 year ago

I would like to start a discussion regarding BF cache and Web Audio setSinkId API. Different browsers might implement it differently. But on Chromium there are some APIs are marked as not supporting BF cache. MediaDevice.enumerateDevices() is one of them. Ref: https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/back_forward_cache_disable.h That means, when users try to fetch available sinkId by calling MediaDevice.enumerateDevices(), on Chromium, BF cache is disabled for this page. I wonder should we add the description in SPEC regarding this limitation (use setSinkId will block BF cache support)?

karlt commented 1 year ago

The user agent is free to choose for any reason not to place a document in b/f cache:

If the user agent does not intend to keep document alive in a session history entry (such that it can be reused later on history traversal), set document's salvageable state to false.

If there is something about a particular API (such as Web Locks) that should mean that no user-agent persist after unload a document using that API, then having the spec state that would be helpful.

I'm not aware of any reason why a choice to persist a document that has called enumerateDevices() would be detrimental, but please let me know if there is such a reason.

If there is no such reason, then there is no need for the Web Audio API to repeat that persistence of a document is optional.

alvinjiooo commented 1 year ago

Thanks Karl for the input! From what I learned now is that it seems because the detail behavior for BF cache is not finalized for those device related API (USB/Bluetooth/Serial/MediaDevice/etc.) so they are temporary in the block list. Though we don't know the exact timeline they are taken from the list. I think it will be a good idea if we could have spec states the restriction until things changed in future.

hoch commented 1 year ago

This question is more about MediaDevice.enumerateDevices() and BFCache, not Web Audio API.

@alvinjiooo Please reopen if you still have a concern or a question.