Skip to main content

Interface: MediaControl

MediaControl Interface

Properties

MediaEventType

MediaEventType: typeof MediaEventType

MediaStreamTrack Events

Remarks

See MDN Events


deviceChanged

deviceChanged: (fn: (event: DeviceChangedChanges) => void) => () => void

Type declaration

▸ (fn): () => void

Unified interface for subscribing DeviceChangedChanges Event

Parameters
NameType
fn(event: DeviceChangedChanges) => void
Returns

fn

▸ (): void

Returns

void


getDevices

getDevices: () => Promise<MediaDeviceInfo[]>

Type declaration

▸ (): Promise<MediaDeviceInfo[]>

Future proofing: in case we want to alter the values or type returned by enumerateDevices

Returns

Promise<MediaDeviceInfo[]>

a list of currently available devices


getUserMedia

getUserMedia: (__namedParameters: MediaDeviceRequest) => Promise<MediaStream>

Type declaration

▸ («destructured»): Promise<MediaStream>

Get MediaStream with provided input constraints

Parameters
NameType
«destructured»MediaDeviceRequest
Returns

Promise<MediaStream>


setDefaultConstraints

setDefaultConstraints: (newConstraints: MediaStreamConstraints) => void

Type declaration

▸ (newConstraints): void

Set default media stream constraints

A MediaStreamConstraints object specifying the types of media to request, along with any requirements for each type.

Parameters
NameType
newConstraintsMediaStreamConstraints
Returns

void


subscribe

subscribe: (listener: (event: MediaEvent) => void) => () => void

Type declaration

▸ (listener): () => void

Subscribe media events

Parameters
NameType
listener(event: MediaEvent) => void
Returns

fn

▸ (): void

Returns

void