Skip to main content

Browser & DOM Types

CanvasCaptureMediaStreamTrack

Media-stream track produced by CanvasElement.captureStream. Adds the requestFrame operation and a back-reference to the source canvas on top of the standard MediaStreamTrack shape. Mirrors the DOM CanvasCaptureMediaStreamTrack interface (MDN).

interface CanvasCaptureMediaStreamTrack {
canvas: CanvasElement;
enabled: boolean;
id: string;
kind: string;
label: string;
muted: boolean;
}

CanvasElement

Canvas drawing surface that can be captured as a MediaStream. Mirrors a subset of the DOM HTMLCanvasElement interface (MDN) — only the members consumed by this codebase are declared.

interface CanvasElement {
height: number;
width: number;
}

InputDeviceInfo

Input-only device that exposes additional capability metadata beyond MediaDeviceInfo.

interface InputDeviceInfo {
deviceId: string;
groupId: string;
label: string;
}

MediaDeviceInfo

Describes a media input or output device available to the user agent. Mirrors the DOM MediaDeviceInfo interface (MDN).

interface MediaDeviceInfo {
deviceId: string;
groupId: string;
label: string;
}

PermissionStatus

Live status of a named permission. Dispatches change events when the decision state transitions. Mirrors the DOM PermissionStatus interface (MDN).

interface PermissionStatus {
name: PermissionName;
}

VideoElement

Video playback surface consumed by this codebase. Mirrors a subset of the DOM HTMLVideoElement interface (MDN) — only the members actually used here are declared, plus vendor-prefixed Safari fullscreen aliases.

interface VideoElement {
autoplay: boolean;
buffered: TimeRanges;
currentTime: number;
duration: number;
ended: boolean;
error: MediaError | literal;
height: number;
loop: boolean;
muted: boolean;
paused: boolean;
playbackRate: number;
readyState: number;
src: string;
srcObject: unknown;
style?: object;
videoHeight: number;
videoWidth: number;
volume: number;
width: number;
}

ConstrainBoolean

Boolean constraint value for a media track — a plain boolean or an { exact, ideal } object. Mirrors the WebRTC ConstrainBoolean type.

type ConstrainBoolean = boolean | ConstrainBooleanParameters
boolean | ConstrainBooleanParameters

ConstrainDOMString

String constraint value for a media track — a single string, an array of candidates, or an { exact, ideal } object. Mirrors the WebRTC ConstrainDOMString type.

type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters
string | string[] | ConstrainDOMStringParameters

ConstrainDouble

Floating-point constraint value for a media track — a single target value or a range with optional min, max, exact, and ideal bounds. Mirrors the WebRTC ConstrainDouble type.

type ConstrainDouble = number | ConstrainDoubleRange
number | ConstrainDoubleRange

ConstrainULong

Unsigned-integer constraint value for a media track — a single target value or a range with optional min, max, exact, and ideal bounds. Mirrors the WebRTC ConstrainULong type.

type ConstrainULong = number | ConstrainULongRange
number | ConstrainULongRange

Listener

Generic event-listener signature parameterised by event type.

type Listener<T> = object
unknown

MediaDeviceKind

Classification of a media device.

type MediaDeviceKind = audioinput | audiooutput | videoinput
unknown | unknown | unknown

MediaStream

Bundle of media tracks routed together as a single source. Mirrors the WebRTC MediaStream interface (MDN).

type MediaStream = {
active: boolean;
id: string;
}

MediaStreamConstraints

Constraints requested from getUserMedia() or getDisplayMedia() for the audio and video tracks of a media stream.

type MediaStreamConstraints = {
}

MediaStreamTrack

Single audio or video track within a MediaStream. Mirrors the WebRTC MediaStreamTrack interface (MDN).

type MediaStreamTrack = {
enabled: boolean;
id: string;
kind: video | audio | string;
label: string;
muted: boolean;
}

MediaStreamTrackState

Lifecycle state of a media track — live while producing samples, ended once the source has stopped.

type MediaStreamTrackState = ended | live
unknown | unknown

MediaTrackCapabilities

Capabilities a media track exposes via getCapabilities() — the ranges and categorical values the underlying source can produce. Mirrors the WebRTC MediaTrackCapabilities dictionary (MDN).

type MediaTrackCapabilities = {
aspectRatio?: DoubleRange;
deviceId?: string;
facingMode?: string[];
frameRate?: DoubleRange;
groupId?: string;
height?: DoubleRange;
resizeMode?: string[];
width?: DoubleRange;
}

MediaTrackConstraints

Constraints requested for a media track via applyConstraints() or getUserMedia(). Mirrors the WebRTC MediaTrackConstraints dictionary (MDN).

type MediaTrackConstraints = {
aspectRatio?: ConstrainDouble;
autoGainControl?: ConstrainBoolean;
channelCount?: ConstrainULong;
deviceId?: ConstrainDOMString;
echoCancellation?: ConstrainBoolean;
facingMode?: ConstrainDOMString;
frameRate?: ConstrainDouble;
height?: ConstrainULong;
latency?: ConstrainDouble;
noiseSuppression?: ConstrainBoolean;
resizeMode?: ConstrainDOMString;
sampleRate?: ConstrainULong;
sampleSize?: ConstrainULong;
}

MediaTrackSettings

Effective settings a media track is using, as reported by getSettings(). Mirrors the WebRTC MediaTrackSettings dictionary (MDN).

type MediaTrackSettings = {
aspectRatio?: number;
autoGainControl?: boolean;
channelCount?: number;
deviceId?: string;
echoCancellation?: boolean;
facingMode?: string;
frameRate?: number;
groupId?: string;
height?: number;
latency?: number;
noiseSuppression?: boolean;
resizeMode?: string;
sampleRate?: number;
sampleSize?: number;
width?: number;
}

PermissionState

Decision state returned by the Permissions API for a named permission.

type PermissionState = denied | granted | prompt
unknown | unknown | unknown