Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/evt/mod.ts>dom.MediaDevices

💧EventEmitter's typesafe replacement
Go to Latest
interface dom.MediaDevices
implements EventTarget
import { type dom } from "https://deno.land/x/evt@v2.4.8/mod.ts";
const { MediaDevices } = dom;

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.

Properties

ondevicechange: ((this: MediaDevices, ev: Event) => any) | null

Methods

enumerateDevices(): Promise<MediaDeviceInfo[]>
getSupportedConstraints(): MediaTrackSupportedConstraints
getUserMedia(constraints?: MediaStreamConstraints): Promise<MediaStream>
addEventListener<K extends keyof MediaDevicesEventMap>(
type: K,
listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
removeEventListener<K extends keyof MediaDevicesEventMap>(
type: K,
listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void