You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: files/en-us/web/api/mediadevices/getdisplaymedia/index.md
+23-12Lines changed: 23 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ getDisplayMedia(options)
24
24
### Parameters
25
25
26
26
-`options` {{optional_inline}}
27
-
- : An optional object specifying requirements for the returned {{domxref("MediaStream")}}.
27
+
- : An object specifying requirements for the returned {{domxref("MediaStream")}}.
28
28
The options for `getDisplayMedia()` work in the same as the [constraints](/en-US/docs/Web/API/MediaDevices/getUserMedia#parameters) for the {{domxref("MediaDevices.getUserMedia()")}} method, although in that case only `audio` and `video` can be specified.
29
29
The list of possible option properties for `getDisplayMedia()` is as follows:
- : An enumerated value specifying whether the browser should offer entire screens in the screen capture options presented to the user alongside tab and window options.
41
41
This option is intended to protect companies from leakage of private information through employee error when using video conferencing apps.
42
-
Possible values are `include`, which hints that the browser should include screen options, and `exclude`, which hints that they should be excluded.
43
-
A default value is not mandated by the spec; see the [Browser compatibility](#browser_compatibility) section for browser-specific defaults.
42
+
Possible values are:
43
+
-`include`: Hints that the browser should include screen options.
44
+
-`exclude`: Hints that screen options should be excluded.
44
45
45
46
> [!NOTE]
46
47
> You cannot set `monitorTypeSurfaces: "exclude"` at the same time as [`displaySurface: "monitor"`](/en-US/docs/Web/API/MediaTrackConstraints/displaySurface) as the two settings are contradictory.
47
48
> Trying to do so will result in the `getDisplayMedia()` call failing with a `TypeError`.
- : A boolean; a value of `true` instructs the browser to offer the current tab as the most prominent capture source, i.e., as a separate "This Tab" option in the "Choose what to share" options presented to the user.
51
+
- : A boolean; a value of `true` instructs the browser to offer the current tab as the most prominent capture source, that is, as a separate "This Tab" option in the "Choose what to share" options presented to the user.
51
52
This is useful as many app types generally just want to share the current tab.
52
53
For example, a slide deck app might want to let the user stream the current tab containing the presentation to a virtual conference.
53
-
A default value is not mandated by the spec; see the [Browser compatibility](#browser_compatibility) section for browser-specific defaults.
- : An enumerated value specifying whether the browser should allow the user to select the current tab for capture.
56
56
This helps to avoid the "infinite hall of mirrors" effect experienced when a video conferencing app inadvertently shares its own display.
57
-
Possible values are `include`, which hints that the browser should include the current tab in the choices offered for capture, and `exclude`, which hints that it should be excluded.
58
-
A default value is not mandated by the spec; see the [Browser compatibility](#browser_compatibility) section for browser-specific defaults.
57
+
Possible values are:
58
+
-`include`: Hints that the browser should include the current tab in the choices offered for capture.
59
+
-`exclude`: Hints that the current tab should be excluded from the choices.
- : An enumerated value specifying whether the browser should display a control to allow the user to dynamically switch the shared tab during screen-sharing.
61
-
This is much more convenient than having to go through the whole sharing process again each time a user wants to switch the shared tab.
62
-
Possible values are `include`, which hints that the browser should include the control, and `exclude`, which hints that it should not be shown.
63
-
A default value is not mandated by the spec; see the [Browser compatibility](#browser_compatibility) section for browser-specific defaults.
62
+
This is more convenient than having to go through the whole sharing process again each time a user wants to switch the shared tab.
63
+
Possible values are:
64
+
-`include`: Hints that the browser should include the control.
65
+
-`exclude`: Hints that the control should not be shown.
- : An enumerated value specifying whether the browser should include the system audio among the possible audio sources offered to the user.
66
-
Possible values are `include`, which hints that the browser should include the system audio in the list of choices, and `exclude`, which hints that it should be excluded.
67
-
A default value is not mandated by the spec; see the [Browser compatibility](#browser_compatibility) section for browser-specific defaults.
68
+
Possible values are:
69
+
-`include`: Hints that the browser should include the system audio in the list of choices.
70
+
-`exclude`: Hints that system audio should be excluded from the choices shown.
- : An enumerated value that hints to the browser what audio sharing option the user should be presented with alongside window sharing options. Possible values are:
73
+
-`exclude`: Hints that audio should not be shareable when a window sharing option is chosen.
74
+
-`window`: Hints that when a window sharing option is chosen, only audio originating from that window should be shared.
75
+
-`system`: Hints that when a window sharing option is chosen, all system audio should be shared.
76
+
77
+
> [!NOTE]
78
+
> For most of these options, a default value is not mandated by the spec. For standalone options, where a default is not mentioned, see the [Browser compatibility](#browser_compatibility) section for browser-specific defaults.
68
79
69
80
> [!NOTE]
70
81
> See the article [Capabilities, constraints, and settings](/en-US/docs/Web/API/Media_Capture_and_Streams_API/Constraints) for a lot more detail on how these options work.
0 commit comments