> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # getUserMedia > getUserMedia function in the WebRTC namespace. ### getUserMedia * `Const` **getUserMedia**(`constraints?`): `Promise` — See [MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream) for more details. Prompts the user to share one or more media devices and asynchronously returns an associated [MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream) object. For more information, see [`MediaDevices.getUserMedia()`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia). #### Parameters **`constraints`** `MediaStreamConstraints` An optional [MediaStreamConstraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints) object specifying requirements for the returned [MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream). --- #### Returns `Promise` #### Examples To only request audio media: ```javascript await SignalWire.WebRTC.getUserMedia({ audio: true, video: false }); // MediaStream {id: "HCXy...", active: true, ...} ``` To request both audio and video, specifying constraints for the video: ```javascript const constraints = { audio: true, video: { width: { min: 1024, ideal: 1280, max: 1920 }, height: { min: 576, ideal: 720, max: 1080 }, }, }; await SignalWire.WebRTC.getUserMedia(constraints); // MediaStream {id: "EDVk...", active: true, ...} ``` > getUserMedia function in the WebRTC namespace.