RemoteAudioTrack

更新时间:
复制 MD 格式

A remote audio track. You can obtain this track from the DingRTCRemoteUser.audioTrack object after calling subscribe.

Inherits from: RemoteTrack

Properties

Property

Type

Description

Minimum supported version

isPlaying

boolean

Indicates whether the media track is playing.

1.0.0

Interface List

API

Description

Minimum supported version

getVolume()

Gets the current playback volume.

1.0.0

getVolumeLevel()

Gets the volume level of the remote audio track.

1.0.0

play()

Plays the remote audio track.

1.0.0

setVolume()

Sets the playback volume.

1.0.0

getTrackId()

Gets the stream track ID.

1.0.0

stop()

Stops playback.

1.0.0

off()

Removes the callback function for a specified event listener.

1.0.0

on()

Listens for a specified event and sets a callback function.

1.0.0

once()

Listens for a specified event once. The listener is removed after the callback function is triggered.

1.0.0

removeAllListeners()

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

1.0.0

API details

getVolume()

Retrieves the current playback volume.

Type signature

getVolume(): number;

Returns

number

The current playback volume.

getVolumeLevel()

Retrieves the volume level of the remote audio track.

Type Signature

getVolumeLevel(): number;

Returns

number

play()

Plays the remote audio track.

Type Signature

play(): void;

Back

void

setVolume()

You can set the playback volume.

Type signature

setVolume(volume: number): void;

Parameters

Parameter

Type

Description

volume

number

The volume level. The value ranges from 0 to 1. A value of 0 means muted, and 1 means the original volume.

Returns

void

getTrackId()

Retrieves the stream track ID.

Type Signature

getTrackId(): string;

Returns

string

The ID of the stream track.

play()

You can play the media track on the page.

Type Signature

play(): void;

Returns

void

stop()

Stop playback

Type Signature

stop(): void;

Back

void

on()

Sets a callback function that is called when a specified event occurs.

Type signature

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

Parameters

Parameter

Type

Description

event

string

The specified event to listen for.

fn

Function

The callback function that is triggered when the event occurs.

Back

void

off()

Removes a callback function for a specified event.

Type Signature

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

Parameters

Parameter

Type

Description

event

string

The specified event to listen for.

fn

Function

The callback function that is triggered when the event occurs.

Back

void

once()

Sets a one-time listener for a specified event, which is removed after the callback function is triggered.

Signature

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

Parameters

Parameter

Type

Description

event

string

The specified event to listen for.

fn

Function

The callback function that is triggered when the event occurs.

Returns

void

removeAllListeners()

Removes callback listeners for a specified event or all events from this object.

Type signature

removeAllListeners(event?: string): void;

Parameters

Parameter

Type

Description

event

string

(Optional) If you specify an event, the corresponding callback listeners are removed. If you do not specify this parameter, all event listeners for the object are removed.

Back

void