From b2ddaaeeb7eed51d265ac0960641039453e8792c Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Thu, 28 Dec 2023 23:53:45 +0800 Subject: [PATCH] getUserMedia() | remove from GroupData & update exception section (#31372) * remove extra method * style fix * update exception section * revert * Update files/en-us/web/api/mediadevices/getusermedia/index.md --------- Co-authored-by: Jean-Yves Perrier --- .../api/mediadevices/getusermedia/index.md | 26 +++++++++---------- files/jsondata/GroupData.json | 5 +--- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/files/en-us/web/api/mediadevices/getusermedia/index.md b/files/en-us/web/api/mediadevices/getusermedia/index.md index 9e42c1daca74657..1e8917e5eab7f21 100644 --- a/files/en-us/web/api/mediadevices/getusermedia/index.md +++ b/files/en-us/web/api/mediadevices/getusermedia/index.md @@ -8,7 +8,7 @@ browser-compat: api.MediaDevices.getUserMedia {{securecontext_header}}{{APIRef("Media Capture and Streams")}} -The {{domxref("MediaDevices")}}**`.getUserMedia()`** method prompts the user for permission to use a media input which produces a {{domxref("MediaStream")}} with tracks containing the requested types of media. +The **`getUserMedia()`** method of the {{domxref("MediaDevices")}} interface prompts the user for permission to use a media input which produces a {{domxref("MediaStream")}} with tracks containing the requested types of media. That stream can include, for example, a video track (produced by either a hardware or virtual video source such as a camera, video recording device, screen sharing service, and so forth), an audio track (similarly, produced by a physical or virtual audio source like a microphone, A/D converter, or the like), and possibly other track types. @@ -55,6 +55,10 @@ object when the requested media has successfully been obtained. and no hardware issues occurred that would cause a `NotReadableError` {{domxref("DOMException")}}, throw if some problem occurred which prevented the device from being used. +- `InvalidStateError` {{domxref("DOMException")}} + + - : Thrown if current document is not fully active. + - `NotAllowedError` {{domxref("DOMException")}} - : Thrown if one or more of the requested source devices cannot be used at this time. This will @@ -145,8 +149,7 @@ is over. ### Security -There are a number of ways security management and controls in a {{Glossary("user - agent")}} can cause `getUserMedia()` to return a security-related error. +There are a number of ways security management and controls in a {{Glossary("user agent")}} can cause `getUserMedia()` to return a security-related error. #### Permissions Policy @@ -432,13 +435,10 @@ const constraints = { ## See also -- The older {{domxref("navigator.getUserMedia()")}} legacy API -- {{domxref("mediaDevices.enumerateDevices()")}}: Listing available media devices -- [WebRTC API](/en-US/docs/Web/API/WebRTC_API) -- [Media Capture and Streams API (Media Streams)](/en-US/docs/Web/API/Media_Capture_and_Streams_API) -- [Screen Capture API](/en-US/docs/Web/API/Screen_Capture_API): Capturing - screen contents as a {{domxref("MediaStream")}} -- {{domxref("mediaDevices.getDisplayMedia()")}}: Getting a stream containing screen - contents -- [Taking webcam photos](/en-US/docs/Web/API/Media_Capture_and_Streams_API/Taking_still_photos): A tutorial on using `getUserMedia()` to take still photos - rather than video +- The older {{domxref("Navigator.getUserMedia()")}} legacy API +- {{domxref("MediaDevices.enumerateDevices()")}}: Listing available media devices +- {{domxref("WebRTC API", "", "", "nocode")}} +- {{domxref("Media Capture and Streams API", "", "", "nocode")}} +- {{domxref("Screen Capture API", "", "", "nocode")}}: Capturing screen contents as a {{domxref("MediaStream")}} +- {{domxref("MediaDevices.getDisplayMedia()")}}: Getting a stream containing screen contents +- {{domxref("Media Capture and Streams API/Taking Still Photos", "Taking webcam photos", "", "nocode")}}: A tutorial on using `getUserMedia()` to take still photos rather than video diff --git a/files/jsondata/GroupData.json b/files/jsondata/GroupData.json index be461b74ca8290b..c3744f7dcc6515e 100644 --- a/files/jsondata/GroupData.json +++ b/files/jsondata/GroupData.json @@ -905,10 +905,7 @@ "MediaTrackSettings", "MediaTrackSupportedConstraints" ], - "methods": [ - "HTMLCanvasElement.captureStream()", - "MediaDevices.getUserMedia()" - ], + "methods": ["HTMLCanvasElement.captureStream()"], "properties": ["Navigator.mediaDevices"], "events": ["HTMLMediaElement: ended", "HTMLMediaElement: ratechange"] },