From 7c6434f6ff9fab3b146caa7c7bea0f638c612ef7 Mon Sep 17 00:00:00 2001
From: Tove Petersson [=Prompt the user to choose=] a display device, for a
- {{PermissionDescriptor}} with its
- {{PermissionDescriptor/name}} set to "display-capture",
- resulting in a set of provided media.MediaDevices Additions
The provided media MUST include precisely one video - track.
+The [=capture-source-set=] MUST include precisely one + video track.
+The provided media MUST include at most one audio track.
- This audio track MUST NOT be included if audio was not
- specified in requestedMediaTypes, or if it was
- specified as false
.
The [=capture-source-set=] MUST include at most one
+ audio track. This audio track MUST NOT be included if
+ audio was not specified in
+ requestedMediaTypes, or if it was specified
+ as false
.
The devices chosen MUST be the ones determined by the - user. Once selected, the source of a {{MediaStreamTrack}} - MUST NOT change, unless the user permits it through their - interaction with the user agent.
+The sources in the [=capture-source-set=] MUST + represent the devices determined by the user. Once + selected, the source of a {{MediaStreamTrack}} MUST NOT + change, unless the user permits it through their + interaction with the user agent.
+User agents are encouraged to warn users against sharing @@ -439,9 +451,9 @@
If the result of the request is
- {{PermissionState/"granted"}}, then for each device that is
- sourcing the provided media, using a stable and private id
- for the device, deviceId, set
+ {{PermissionState/"granted"}}, then for each device with a
+ source in [=capture-source-set=], using a stable and private
+ id for the device, deviceId, set
[[\devicesLiveMap]][deviceId] to
true
, if it isn’t already true
, and
set the [[\devicesAccessibleMap]][deviceId] to
@@ -512,7 +524,8 @@
This invocation of {{MediaDevices/getDisplayMedia()}} is now considered to have produced a new - capture-session.
+ capture-session, with the associated + [=capture-source-set=], sources.+ The user agent MUST NOT change the [=display surface=] + associated with a [=capture-session=] unless the user has + explicitly indicated that they want this change to be + performed by interacting with user agent or operating system. + + If the user indicates a change of [=display surface=], the + user agent MUST run the following steps: +
+ + +If the [=capture-session=] does not have an associated + {{CaptureController}}, controller, abort these steps.
+If controller.{{CaptureController/[[DisplaySurfaceChangeCallback]]}} + is null, abort these steps.
+Stop delivering frames from all sources in the + [=capture-source-set=] associated with the [=capture-session=]. +
+Let newSources be the set of sources selected by the + user when the user chose a new [=display surface=].
+ + ++ newSources MUST fulfill the same requirements as the + [=capture-source-set=] formed when {{MediaDevices/getDisplayMedia}} + is called.
+Queue a task to:
++ Set the [=capture-source-set=] + associated with the [=capture-session=] to newSources. +
+Let stream be a new {{MediaStream}} with a new + {{MediaStreamTrack}} for each source in newSources. +
Run the [=ApplyConstraints algorithm=] on all tracks in + stream with the appropriate constraints. Should + this fail, abort these steps.
+Set + controller.{{CaptureController/[[Source]]}} to + the stream's video track's + [[\Source]].
+Set + controller.{{CaptureController/[[DisplaySurfaceType]]}} + to the stream's video track's + {{DisplayCaptureSurfaceType}}.
+Invoke + controller.{{CaptureController/[[DisplaySurfaceChangeCallback]]}} + with stream as the argument.
+Queue tasks to end all tracks connected to sources in the + [=capture-source-set=] associated with the [=capture-session=]. +
++ Used to receive a new {{MediaStream}} if the [=display surface=] + associated with a [=capture-session=] changes. +
+callback DisplaySurfaceChangeCallback = undefined + (MediaStream stream);+
null
+ Run the following steps:
+ + +Let callback be the method's first argument.
+If [=this=].{{CaptureController/[[IsBound]]}} is
+ true
,
+ [=exception/throw=] an "{{InvalidStateError}}"
+ {{DOMException}}.
If
+ [=this=].{{CaptureController/[[DisplaySurfaceChangeCallback]]}}
+ is not null
, [=exception/throw=] an
+ "{{InvalidStateError}}" {{DOMException}}.
Set + [=this=].{{CaptureController/[[DisplaySurfaceChangeCallback]]}} + to callback.
+