Skip to main content

Media Capture & Devices

ExistsStreamPolicy

Policy applied when a controller is asked to acquire a media stream while a previous stream still exists.

enum ExistsStreamPolicy {
error = '3',
ignore = '2',
stale = '0',
wait = '1',
}

CapturableElement

Capturable element exposing a standards-compliant captureStream().

interface CapturableElement {
}

MediaControllerAPI

Centralised manager for media devices and stream controllers. Handles device enumeration, permission state, and the creation of MediaStreamControllerAPI instances.

interface MediaControllerAPI {
camPermission: PermissionStatus | literal;
devices: Readonly<Record<string, Readonly<MediaDeviceInfo>>>;
devicesInUse: typeOperator;
isDisposed: boolean;
micPermission: PermissionStatus | literal;
supportSharedDevices: boolean;
}

MediaControllerEvents

Event map emitted by the MediaControllerAPI. Subscribers receive device-list updates, permission changes, and not-allowed / not-found signals.

interface MediaControllerEvents {
audioNotAllowed: void;
audioNotFound: void;
deviceListChanged: typeOperator;
devicesInUse: typeOperator;
dispose: void;
permissionsChanged: object;
videoNotAllowed: void;
videoNotFound: void;
}

MediaStreamControllerAPI

Stream-level controller for one or more media tracks. Combines a SourceProvider over a MediaStream with an event emitter (MediaStreamControllerEvents) and the Disposable contract. Exposes per-track settings — mute, pause, resolution, frame rate, gain, echo cancellation, noise suppression — and the device-transition state.

interface MediaStreamControllerAPI {
aspectRatio: number | tuple | literal;
audioDeviceId: string | literal;
audioDeviceRemoved: string | literal;
audioDisabled: boolean | placeholder;
audioMuted: boolean;
autoGainControl: boolean | literal;
availableResolutions: number[];
capturable: Capturable | literal;
echoCancellation: boolean | literal;
facingMode: FacingMode | literal;
frameRate: ConstrainDouble | literal;
gain: number;
inAudioDeviceTransition: boolean;
inVideoDeviceTransition: boolean;
isScreenCaptured: boolean;
kind: media-stream;
logger: Logger;
maxHeight: number | literal;
maxWidth: number | literal;
noiseSuppression: boolean | literal;
resolution: number | tuple | object | literal;
settings: object;
videoDeviceId: string | literal;
videoDeviceRemoved: string | literal;
videoDisabled: boolean | placeholder;
videoPaused: boolean;
}

Resolution

A concrete resolution as a { width, height } pair in pixels. Returned by CameraController.availableResolutions — each entry is a standard height tier the active camera can actually deliver at a given aspect ratio (width derived from the height via that ratio), so a square-max webcam (e.g. a FaceTime camera whose getCapabilities reports 1920×1920) never lists a tier it cannot render at, say, 16:9.

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

ResolutionsInUseManagerAPI

API for managing video device resolutions in use

interface ResolutionsInUseManagerAPI {
currentAvailableResolutions: number[] | literal;
devicesInUse: Map<string, DeviceInUse>;
isDisposed: boolean;
}

ResolutionsInUseManagerConstructor

Constructor interface for creating a new ResolutionsInUseManager

interface ResolutionsInUseManagerConstructor {
displayName?: string;
name: string;
}

Capturable

Reference to a capturable source — a canvas or video element together with the desired capture frame rate.

type Capturable = {
framerate?: number;
}

DeviceInUse

Represents a video device that is currently in use

type DeviceInUse = {
allAvailableResolutions: number[];
currentAvailableResolutions: number[] | literal;
videoDevice: Readonly<MediaDeviceInfo>;
}

FacingMode

Camera-facing direction reported by the device and accepted as a constraint.

type FacingMode = back | front | environment | user
unknown | unknown | unknown | unknown

MediaControllerOptions

Configuration options for MediaControllerAPI.init. Every field is optional.

type MediaControllerOptions = Partial<object>
Partial

MediaStreamControllerEvents

Event map emitted by a MediaStreamControllerAPI. Subscribers receive device-change events, mute/disable transitions, constraint errors, and the live source stream.

interface MediaStreamControllerEvents {
disposed: void;
source: MediaStream;
tracksChanged: MediaStream;
aspectRatio: indexedAccess;
audioConstraintsError: object;
audioDeviceChanged: Readonly<MediaDeviceInfo> | literal;
audioDeviceChanging: Readonly<MediaDeviceInfo> | literal;
audioDeviceRemoved: indexedAccess;
audioDisabled: indexedAccess;
audioMuted: indexedAccess;
autoGainControl: indexedAccess;
availableResolutions: indexedAccess;
captureStreamStarted: void;
changeDevicesError: object;
echoCancellation: indexedAccess;
error: Error;
facingMode: indexedAccess;
frameRate: indexedAccess;
gain: indexedAccess;
maxHeight: indexedAccess;
maxWidth: indexedAccess;
noiseSuppression: indexedAccess;
resolution: indexedAccess;
videoConstraintsError: object;
videoDeviceChanged: Readonly<MediaDeviceInfo> | literal;
videoDeviceChanging: Readonly<MediaDeviceInfo> | literal;
videoDeviceRemoved: indexedAccess;
videoDisabled: indexedAccess;
videoPaused: indexedAccess;
}

MediaStreamControllerOptions

Construction options for a MediaStreamControllerAPI. Specifies the default and fallback track constraints, lock policy, and optional canvas-or-video capturable source.

type MediaStreamControllerOptions = {
capturable?: Capturable;
defaultConstraints: object;
defaultLockPolicy: ExistsStreamPolicy;
displayName?: string;
fallbackConstraints: object | literal;
noEchoGainAmplifier?: boolean;
replaceTracks: boolean;
requestAudioPermission?: boolean;
waitingDelay: number;
}

MozCapturableElement

Capturable element exposing the Mozilla-prefixed mozCaptureStream() for older Firefox builds.

type MozCapturableElement = {
}

ResolutionInfo

Resolution tuple — [width, height] in pixels. Either value may be null when the dimension is unconstrained.

type ResolutionInfo = tuple
unknown

ResolutionsInUseManagerEvents

Events emitted by the ResolutionsInUseManager

type ResolutionsInUseManagerEvents = {
currentAvailableResolutions: number[];
deviceAvailable: object;
deviceInUse: object;
hadInteraction: boolean;
}

ResolutionsInUseManagerOptions

Input type for ResolutionsInUseManager options. Logger is optional as it has a default value.

type ResolutionsInUseManagerOptions = input<query>
input