*Contact emails*
[email protected]

*Explainer*
https://github.com/w3c/mediasession/pull/312

*Specification*
https://w3c.github.io/mediasession/#dom-mediasession-setmicrophoneactive

*Summary*
Updates navigator.mediaSession.setMicrophoneActive() and
navigator.mediaSession.setCameraActive() to return a Promise<undefined>
instead of undefined, matching the W3C Media Session specification. In a
fully active document, the returned promise resolves with undefined; if the
associated document is not fully active, it returns a promise rejected with
an InvalidStateError DOMException.

*Blink component*
Blink>Media>Session
<https://issues.chromium.org/issues?q=customfield1222907:%22Blink%3EMedia%3ESession%22>

*Web Feature ID*
media-session <https://webstatus.dev/features/media-session>

*Motivation*
When MediaSession.setMicrophoneActive() and MediaSession.setCameraActive()
were originally specified and shipped in Chrome 93, their WebIDL return
type was void (undefined). The W3C Media Session specification was
subsequently updated (https://github.com/w3c/mediasession/pull/312) so that
both methods return Promise<undefined> to support user agents that apply a
capture pause policy or prompt the user asynchronously. Updating Chromium's
implementation to return Promise<undefined> aligns Chrome with the W3C
Media Session specification and fixes 4 failing subtests in WPT's
mediasession/idlharness.window.html.

*Initial public proposal*
*No information provided*

*TAG review*
N/A — This is a minor spec-compliance update to the return type (undefined
-> Promise<undefined>) of two already-shipped MediaSession methods, already
specified in the W3C Media Session Working Draft (
https://github.com/w3c/mediasession/pull/312) and shipped in Safari.

*TAG review status*
Not applicable

*Goals for experimentation*
None

*Risks*


*Interoperability and Compatibility*
Compatibility risk is very low. Existing callers that ignore the return
value of setMicrophoneActive() and setCameraActive() are unaffected because
the returned promise always resolves with undefined in an active document
(so fire-and-forget callers will not encounter unhandled promise
rejections). The promise only rejects with InvalidStateError when called on
a MediaSession whose associated Document is no longer fully active (such as
a detached iframe), or with TypeError when called with too few arguments or
an invalid receiver per WebIDL rules for promise-returning operations.
Interoperability is improved, as Safari already ships Promise<undefined>
for both methods and Firefox is implementing the same WebIDL signature.

*Gecko*: Positive (https://github.com/mozilla/standards-positions/issues/504
)

*WebKit*: Shipped/Shipping
(https://bugs.webkit.org/show_bug.cgi?id=277421) Shipped
in Safari 18.4

*Web developers*: No signals N/A — Minor spec-compliance fix to return
Promise<undefined> instead of undefined.

*Other signals*:

*WebView application risks*

Does this intent deprecate or change behavior of existing APIs, such that
it has potentially high risk for Android WebView-based applications?
*No information provided*


*Debuggability*
*No information provided*

*Will this feature be supported on all six Blink platforms (Windows, Mac,
Linux, ChromeOS, Android, and Android WebView)?*
Yes

*Is this feature fully tested by web-platform-tests
<https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>?*
Yes
https://wpt.fyi/results/mediasession/idlharness.window.html
https://wpt.fyi/results/mediasession/setmicrophoneactive.html
https://wpt.fyi/results/mediasession/setcameraactive.html

*Flag name on about://flags*
*No information provided*

*Finch feature name*
*No information provided*

*Non-finch justification*
Changing a WebIDL method's return type from void to Promise<undefined>
cannot be guarded behind a runtime feature flag in Blink's generated
bindings without changing the IDL return type to 'any' and losing WebIDL's
automatic promise-rejection wrapping for invalid arguments/receivers.
Compatibility risk is negligible because the returned promise always
resolves in an active document.

*Rollout plan*
Will ship enabled for all users

*Requires code in //chrome?*
False

*Tracking bug*
https://crbug.com/576328036

*Estimated milestones*
Shipping on desktop 159
Shipping on Android 159

*Anticipated spec changes*

Open questions about a feature may be a source of future web compat or
interop issues. Please list open issues (e.g. links to known github issues
in the project for the feature specification) whose resolution may
introduce web compat/interop risk (e.g., changing to naming or structure of
the API in a non-backward-compatible way).
*No information provided*

*Link to entry on the Chrome Platform Status*
https://chromestatus.com/feature/5188639100370944?gate=5532358353747968

This intent message was generated by Chrome Platform Status
<https://chromestatus.com/>.

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAE-AwArmrmUK0D45B8cPYA20cCM%3DB1-sW4vM4Vz67bLzzrsxDQ%40mail.gmail.com.

Reply via email to