Last active
January 1, 2023 02:19
-
-
Save steimelchrome/d52f0fb9a0a13c63a3cf2d4134b71682 to your computer and use it in GitHub Desktop.
Media Session video conferencing actions explainer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In order to make the Media Session API more useful for video conferencing websites using WebRTC, | |
we should add the following actions: | |
"togglemicrophone" | |
"togglecamera" | |
"hangup" | |
We would allow the UA to have default handlers for these actions if they so wish (e.g. stop the | |
website from receiving microphone data when the user toggles the microphone off). | |
Since the UA doesn't necessarily know what states the microphone and camera are in, we would also | |
need to add two new methods to the MediaSession object to get the current states: | |
setMicrophoneActive(boolean active) | |
setCameraActive(boolean active) | |
Here is an example usage: | |
navigator.mediaSession.setActionHandler("togglemicrophone", function() { | |
// Handle muting or unmuting the microphone. | |
// Will likely call "navigator.mediaSession.setMicrophoneActive(true|false);" at some point. | |
}); | |
navigator.mediaSession.setMicrophoneActive(true); | |
In Chrome we currently expose UI for Media Session actions in various places, for example | |
notifications on mobile, the global media controls on desktop, and the picture-in-picture window. | |
We could add microphone/camera/hangup buttons to these UI when the user is in a video call on a | |
video conferencing website that supports these actions. For example, the user could click our | |
"hangup" button on one of those browser UIs and the website could handle hanging up the video | |
call. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment