From f90a2793ff7c5149a5580542cd36ae4ea23358b5 Mon Sep 17 00:00:00 2001 From: Youenn Fablet Date: Thu, 15 Feb 2024 08:55:20 +0100 Subject: [PATCH] Add screenshare support --- index.bs | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/index.bs b/index.bs index d09d212..cf7077d 100644 --- a/index.bs +++ b/index.bs @@ -390,6 +390,10 @@ platform UI or media keys, thereby improving the user experience. togglecamera: the action's intent is to turn the user's active camera on or off. +
  • + togglescreenshare: the action's intent + is to turn the user's active screenshare on or off. +
  • hangup: the action's intent is to end a call. @@ -524,14 +528,15 @@ platform UI or media keys, thereby improving the user experience. A user agent MAY implement a default handler for the togglemicrophone, togglecamera, or togglescreenshare, or hangup media session actions if none was provided for the active media session.

    - A user agent MAY expose microphone and camera state to web pages via - {{MediaStreamTrack}}'s {{MediaStreamTrack/muted}} attribute in addition - to {{MediaSessionAction/togglemicrophone}} or - {{MediaSessionAction/togglecamera}} [=media session action=]. In that + A user agent MAY expose microphone, camera and screenshare state to web pages + via {{MediaStreamTrack}}'s {{MediaStreamTrack/muted}} attribute in addition + to {{MediaSessionAction/togglemicrophone}}, {{MediaSessionAction/togglecamera}} + or {{MediaSessionAction/togglescreenshare}} [=media session action=]. In that case, the user agent MUST execute the corresponding {{MediaSessionActionHandler}} before running, as different tasks, the steps defined to [$set a track's muted state$]. @@ -707,6 +712,7 @@ enum MediaSessionAction { "seekto", "togglemicrophone", "togglecamera", + "togglescreenshare", "hangup", "previousslide", "nextslide", @@ -728,6 +734,8 @@ interface MediaSession { Promise<undefined> setMicrophoneActive(boolean active); Promise<undefined> setCameraActive(boolean active); + + Promise<undefined> setScreenshareActive(boolean active); }; @@ -899,6 +907,24 @@ interface MediaSession {

  • +

    + Similarly, the setScreenshareActive(active) + method indicates to the user agent the screenshare capture state desired by the page. + When invoked, it MUST perform the following steps: +

      +
    1. + Let document be [=this=]'s [=relevant global object=]'s + [=associated Document=]. +
    2. +
    3. + Let captureKind be "screenshare". +
    4. +
    5. + Return the result of running the [=update capture state algorithm=] with + document, active and captureKind. +
    6. +
    +

    The update capture state algorithm, when invoked with document, active and captureKind, MUST @@ -980,10 +1006,11 @@ interface MediaSession {

    - Both the setMicrophoneActive(active) and setCameraActive(active) - methods can reject based on user agent specific heuristics. This might in - particular happen when the web page asks to activate (aka unmute) microphone - or camera. The user agent could decide to require [=transient activation=] in + The setMicrophoneActive(active), setCameraActive(active) + and setScreenshareActive(active) methods + can reject based on user agent specific heuristics. This might in + particular happen when the web page asks to activate (aka unmute) microphone, + camera or screenshare. The user agent could decide to require [=transient activation=] in that case. It might also require user input through a prompt to make the actual decision.