MediaDevices

@native @JSType

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.

class Object
trait Any
class Object
trait Matchable
class Any

Value members

Concrete methods

def enumerateDevices(): Promise[Array[MediaDeviceInfo]]

Obtains an array of information about the media input and output devices available on the system.

Obtains an array of information about the media input and output devices available on the system.

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 Streams) to learn more about constraints and how to use them.

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 Streams) to learn more about constraints and how to use them.

def getUserMedia(constraints: MediaStreamConstraints): Promise[MediaStream]

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

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

Inherited methods

def addEventListener[T <: Event](`type`: String, listener: Function1[T, _], options: EventListenerOptions): Unit

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

This implementation accepts a settings object of type EventListenerOptions.

Inherited from:
EventTarget
def addEventListener[T <: Event](`type`: String, listener: Function1[T, _], useCapture: Boolean): Unit

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

Inherited from:
EventTarget
def dispatchEvent(evt: Event): Boolean

Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().

Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().

Inherited from:
EventTarget
def hasOwnProperty(v: String): Boolean
Inherited from:
Object
def isPrototypeOf(v: Object): Boolean
Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from:
Object
def removeEventListener[T <: Event](`type`: String, listener: Function1[T, _], options: EventListenerOptions): Unit

Removes the event listener previously registered with EventTarget.addEventListener.

Removes the event listener previously registered with EventTarget.addEventListener.

This implementation accepts a settings object of type EventListenerOptions.

Inherited from:
EventTarget
def removeEventListener[T <: Event](`type`: String, listener: Function1[T, _], useCapture: Boolean): Unit

Removes the event listener previously registered with EventTarget.addEventListener.

Removes the event listener previously registered with EventTarget.addEventListener.

Inherited from:
EventTarget
def toLocaleString(): String
Inherited from:
Object
def valueOf(): Any
Inherited from:
Object

Concrete fields

var ondevicechange: Function1[Event, Any]

The event handler for the devicechange event. This event is delivered to the MediaDevices object when a media input or output device is attached to or removed from the user's computer.

The event handler for the devicechange event. This event is delivered to the MediaDevices object when a media input or output device is attached to or removed from the user's computer.