Skip to content

MediaStreamTrack

Types

mediaTrackCapabilities

type mediaTrackCapabilities = MediaCaptureAndStreamsTypes.mediaTrackCapabilities = {
mutable width?: MediaCaptureAndStreamsTypes.uLongRange,
mutable height?: MediaCaptureAndStreamsTypes.uLongRange,
mutable aspectRatio?: MediaCaptureAndStreamsTypes.doubleRange,
mutable frameRate?: MediaCaptureAndStreamsTypes.doubleRange,
mutable facingMode?: array<string>,
mutable sampleRate?: MediaCaptureAndStreamsTypes.uLongRange,
mutable sampleSize?: MediaCaptureAndStreamsTypes.uLongRange,
mutable echoCancellation?: array<bool>,
mutable autoGainControl?: array<bool>,
mutable noiseSuppression?: array<bool>,
mutable channelCount?: MediaCaptureAndStreamsTypes.uLongRange,
mutable deviceId?: string,
mutable groupId?: string,
mutable backgroundBlur?: array<bool>,
mutable displaySurface?: string,
}

Record fields

width
option< MediaCaptureAndStreamsTypes.uLongRange >
height
option< MediaCaptureAndStreamsTypes.uLongRange >
aspectRatio
option< MediaCaptureAndStreamsTypes.doubleRange >
frameRate
option< MediaCaptureAndStreamsTypes.doubleRange >
facingMode
option< array< string > >
sampleRate
option< MediaCaptureAndStreamsTypes.uLongRange >
sampleSize
option< MediaCaptureAndStreamsTypes.uLongRange >
echoCancellation
option< array< bool > >
autoGainControl
option< array< bool > >
noiseSuppression
option< array< bool > >
channelCount
option< MediaCaptureAndStreamsTypes.uLongRange >
deviceId
option< string >
groupId
option< string >
backgroundBlur
option< array< bool > >
displaySurface
option< string >

mediaTrackConstraints

type mediaTrackConstraints = MediaCaptureAndStreamsTypes.mediaTrackConstraints = {
mutable width?: int,
mutable height?: int,
mutable aspectRatio?: float,
mutable frameRate?: float,
mutable facingMode?: string,
mutable sampleRate?: int,
mutable sampleSize?: int,
mutable echoCancellation?: bool,
mutable autoGainControl?: bool,
mutable noiseSuppression?: bool,
mutable channelCount?: int,
mutable deviceId?: string,
mutable groupId?: string,
mutable backgroundBlur?: bool,
mutable displaySurface?: string,
mutable advanced?: array<
MediaCaptureAndStreamsTypes.mediaTrackConstraintSet,
>,
}

Record fields

width
option< int >
height
option< int >
aspectRatio
option< float >
frameRate
option< float >
facingMode
option< string >
sampleRate
option< int >
sampleSize
option< int >
echoCancellation
option< bool >
autoGainControl
option< bool >
noiseSuppression
option< bool >
channelCount
option< int >
deviceId
option< string >
groupId
option< string >
backgroundBlur
option< bool >
displaySurface
option< string >
advanced
option< array< MediaCaptureAndStreamsTypes.mediaTrackConstraintSet > >

mediaTrackSettings

type mediaTrackSettings = MediaCaptureAndStreamsTypes.mediaTrackSettings = {
mutable width?: int,
mutable height?: int,
mutable aspectRatio?: float,
mutable frameRate?: float,
mutable facingMode?: string,
mutable sampleRate?: int,
mutable sampleSize?: int,
mutable echoCancellation?: bool,
mutable autoGainControl?: bool,
mutable noiseSuppression?: bool,
mutable channelCount?: int,
mutable deviceId?: string,
mutable groupId?: string,
mutable backgroundBlur?: bool,
mutable displaySurface?: string,
}

Record fields

width
option< int >
height
option< int >
aspectRatio
option< float >
frameRate
option< float >
facingMode
option< string >
sampleRate
option< int >
sampleSize
option< int >
echoCancellation
option< bool >
autoGainControl
option< bool >
noiseSuppression
option< bool >
channelCount
option< int >
deviceId
option< string >
groupId
option< string >
backgroundBlur
option< bool >
displaySurface
option< string >

t

type t = MediaCaptureAndStreamsTypes.mediaStreamTrack = {
kind: string,
id: string,
label: string,
mutable enabled: bool,
muted: bool,
readyState: MediaCaptureAndStreamsTypes.mediaStreamTrackState,
mutable contentHint: string,
}

Record fields

kind
string
id
string
label
string
enabled
bool
muted
bool
readyState
MediaCaptureAndStreamsTypes.mediaStreamTrackState
contentHint
string

Values

addEventListener

Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. Read more on MDN

let addEventListener: (
t,
EventTypes.eventType,
EventTypes.eventListener<'event>,
~options: EventTypes.addEventListenerOptions=?,
) => unit

Parameters

t EventTypes.eventType EventTypes.eventListener option< EventTypes.addEventListenerOptions >

Return type

unit

addEventListenerWithCapture

Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. Read more on MDN

let addEventListenerWithCapture: (
t,
EventTypes.eventType,
EventTypes.eventListener<'event>,
) => unit

Parameters

t EventTypes.eventType EventTypes.eventListener

Return type

unit

applyConstraints

let applyConstraints: (t, ~constraints: mediaTrackConstraints=?) => promise<unit>

Parameters

t option< mediaTrackConstraints >

Return type

promise< unit >

asEventTarget

let asEventTarget: t => EventTypes.eventTarget

Parameters

t

Return type

EventTypes.eventTarget

clone

let clone: t => t

Parameters

t

Return type

t

dispatchEvent

Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. Read more on MDN

let dispatchEvent: (t, EventTypes.event) => bool

Parameters

t EventTypes.event

Return type

bool

getCapabilities

let getCapabilities: t => mediaTrackCapabilities

Parameters

t

Return type

mediaTrackCapabilities

getConstraints

let getConstraints: t => mediaTrackConstraints

Parameters

t

Return type

mediaTrackConstraints

getSettings

let getSettings: t => mediaTrackSettings

Parameters

t

Return type

mediaTrackSettings

removeEventListener

Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN

let removeEventListener: (
t,
EventTypes.eventType,
EventTypes.eventListener<'event>,
~options: EventTypes.eventListenerOptions=?,
) => unit

Parameters

t EventTypes.eventType EventTypes.eventListener option< EventTypes.eventListenerOptions >

Return type

unit

removeEventListenerUseCapture

Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN

let removeEventListenerUseCapture: (
t,
EventTypes.eventType,
EventTypes.eventListener<'event>,
) => unit

Parameters

t EventTypes.eventType EventTypes.eventListener

Return type

unit

stop

let stop: t => unit

Parameters

t

Return type

unit