MediaDevices

Overview

The MediaDevices interface provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data.

Location

Required Methods


getDisplayMedia

Prompts the user to select a display or portion of a display (such as a window) to capture as a MediaStream for sharing or recording purposes. Returns a promise that resolves to a MediaStream.

 

method getDisplayMedia(parconstraints: dynamic): MediaStream

 

MediaStream getDisplayMedia(dynamic parconstraints)

 

func getDisplayMedia(_ parconstraints: dynamic) -> MediaStream

 

MediaStream getDisplayMedia(dynamic parconstraints)

 

Function getDisplayMedia(parconstraints As dynamic) As MediaStream

Parameters:

  • parconstraints:

getSupportedConstraints

Returns an object conforming to MediaTrackSupportedConstraints indicating which constrainable properties are supported on the MediaStreamTrack interface. See Capabilities and constraints in Media Capture and Streams API (Media Stream) to learn more about constraints and how to use them.

 

method getSupportedConstraints: MediaStreamTrack

 

MediaStreamTrack getSupportedConstraints()

 

func getSupportedConstraints() -> MediaStreamTrack

 

MediaStreamTrack getSupportedConstraints()

 

Function getSupportedConstraints() As MediaStreamTrack

getUserMedia

With the user's permission through a prompt, turns on a camera and/or a microphone on the system and provides a MediaStream containing a video track and/or an audio track with the input.

 

method getUserMedia(parconstraints: dynamic): MediaStream

 

MediaStream getUserMedia(dynamic parconstraints)

 

func getUserMedia(_ parconstraints: dynamic) -> MediaStream

 

MediaStream getUserMedia(dynamic parconstraints)

 

Function getUserMedia(parconstraints As dynamic) As MediaStream

Parameters:

  • parconstraints: