← Back to release summary

MediaSession: Return Promise<undefined> from setMicrophoneActive() and setCameraActive()

Category
Multimedia
Type
Chromium catches up
Status
Proposed (Chrome Proposed)
Intent stage
None

WPT details: https://wpt.fyi/results/mediasession/idlharness.window.html https://wpt.fyi/results/mediasession/setmicrophoneactive.html https://wpt.fyi/results/mediasession/setcameraactive.html

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.

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.

Standards & signals

Ecosystem

View on chromestatus.com