MediaDevices
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. Available only in secure contexts.
interface MediaDevices extends EventTarget {
ondevicechange: ((this: MediaDevices, ev: Event) => any) | null;
addEventListener<K extends keyof MediaDevicesEventMap>(
type: K,
listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;enumerateDevices(): Promise<MediaDeviceInfo[]>;
getDisplayMedia(constraints?: DisplayMediaStreamConstraints): Promise<MediaStream>;
getSupportedConstraints(): MediaTrackSupportedConstraints;
getUserMedia(constraints?: MediaStreamConstraints): Promise<MediaStream>;
removeEventListener<K extends keyof MediaDevicesEventMap>(
type: K,
listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;removeEventListener(
}type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;var MediaDevices: {
prototype: MediaDevices;
new (): MediaDevices;
};§Extends
§Properties
§
ondevicechange: ((this: MediaDevices, ev: Event) => any) | null
[src]§Methods
§
addEventListener<K extends keyof MediaDevicesEventMap>(
[src]type: K,
listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void§
addEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void§
enumerateDevices(): Promise<MediaDeviceInfo[]>
[src]§
getDisplayMedia(constraints?: DisplayMediaStreamConstraints): Promise<MediaStream>
[src]§
getSupportedConstraints(): MediaTrackSupportedConstraints
[src]§
getUserMedia(constraints?: MediaStreamConstraints): Promise<MediaStream>
[src]§
removeEventListener<K extends keyof MediaDevicesEventMap>(
[src]type: K,
listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void§
removeEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void