RemoteVideoTrack

Updated at:

A remote video track.

You can obtain this object from the DingRTCRemoteUser.videoTrack object after calling subscribe.

Inherits from:RemoteTrack

Properties

Property

Type

Description

Minimum supported version

isPlaying

boolean

Indicates whether the media track is playing.

3.0.0

trackMediaType

TrackMediaType

The media track type.

3.0.0

userId

string

The UID of the remote user.

3.0.0

API list

Interface

Description

Minimum supported version

getCurrentFrameData()

Gets the current video frame data.

getMediaStreamTrack()

Gets the media track.

3.0.0

getTrackId()

Gets the stream track ID.

3.0.0

play()

Plays the media track on the page.

3.0.0

replaceTrack()

Replaces the audio or video track.

3.0.0

stop()

Stops playback.

3.0.0

off()

Cancels the listener callback for a specified event.

3.0.0

on()

Listens for a specified event and sets a callback function.

3.0.0

once()

Listens for a specified event once. The callback is removed after it is triggered.

3.0.0

removeAllListeners()

Cancels the listener callbacks for a specified event or all events on this object.

3.0.0

Method details

getCurrentFrameData()

Retrieves the current video frame data.

Type signature

getCurrentFrameData(): string;

Returns

string

A data URL in image/png format.

getMediaStreamTrack()

Retrieves the media track.

Type signature

getMediaStreamTrack(): MediaStreamTrack;

Returns

MediaStreamTrack

The media track.

getTrackId()

Retrieves the stream track ID.

Type Signature

getTrackId(): string;

Back

string

Stream track ID

play()

Plays the media track on the page.

Type Signature

play(element?: string | HTMLElement, config?: VideoPlayerConfig): void;

Parameters

Parameter

Type

Description

element

string | HTMLElement

(Optional) Specifies a DOM element. The SDK creates a video element under this DOM element to play the video track. Two types are supported:

- string: The ID of the DOM element.

- HTMLElement: You can pass a DOM element object directly.

config

VideoPlayerConfig

(Optional) The video media playback parameters.

Returns

void

replaceTrack()

Replaces the audio or video track.

Type Signature

replaceTrack(track: MediaStreamTrack, stopOldTrack?: boolean): void;

Parameter

Type

Description

track

MediaStreamTrack

The audio or video track.

stopOldTrack

boolean

(Optional) Specifies whether to stop the previous track.

Returns

void

stop()

Stops playback.

Signature

stop(): void;

Returns

void

on()

Registers a listener for a specified event.

Type signature

on(event: string, fn: Function): void;

Parameters

Parameter

Type

Description

event

string

The event to listen for.

fn

Function

The callback function to execute when the event is triggered.

Returns

void

off()

Removes the listener for a specified event.

Type Signature

off(event: string, fn: Function): void;

Parameters

Parameter

Type

Description

event

string

The event to listen for.

fn

Function

The callback function to execute when the event is triggered.

Returns

void

once()

Registers a one-time listener for a specified event. The listener is removed after it is triggered.

Type Signature

once(event: string, fn: Function): void;

Parameters

Parameter

Type

Description

event

string

The event to listen for.

fn

Function

The callback function to execute when the event is triggered.

Returns

void

removeAllListeners()

Removes all listeners for a specified event or all listeners on this object.

Type signature

removeAllListeners(event?: string): void;

Parameters

Parameter

Type

Description

event

string

(Optional) If you specify an event, the corresponding listener callbacks are cleared. If you do not specify this parameter, all listener callbacks for all events on the object are cleared.

Returns

void