Class: RemoteAudioTrack

RemoteAudioTrack

A RemoteAudioTrack represents an AudioTrack published to a Room by a RemoteParticipant.


Properties:
Name Type Description
isSubscribed boolean

Whether the RemoteAudioTrack is currently subscribed to

sid Track.SID

The RemoteAudioTrack's SID

Fires:

Extends

Members


id

The Track's ID.

Properties:
Type Description
Track.ID
Inherited From:
Overrides:

Methods


attach()

Create an HTMLAudioElement and attach the AudioTrack to it.

The HTMLAudioElement's srcObject will be set to a new MediaStream containing the AudioTrack's MediaStreamTrack.

Inherited From:
Overrides:
Returns:

audioElement

Type
HTMLAudioElement
Example
const Video = require('twilio-video');

Video.createLocalAudioTrack().then(function(audioTrack) {
  const audioElement = audioTrack.attach();
  document.body.appendChild(audioElement);
});
  

detach()

Detach the AudioTrack from all previously attached HTMLMediaElements.

Inherited From:
Overrides:
Returns:

mediaElements

Type
Array.<HTMLMediaElement>
Example
const mediaElements = audioTrack.detach();
mediaElements.forEach(mediaElement => mediaElement.remove());
  

Events


disabled

The RemoteAudioTrack was disabled, i.e. "muted".

Parameters:
Name Type Description
track RemoteAudioTrack

The RemoteAudioTrack that was disabled

Overrides:

enabled

The RemoteAudioTrack was enabled, i.e. "unmuted".

Parameters:
Name Type Description
track RemoteAudioTrack

The RemoteAudioTrack that was enabled

Overrides:

started

The RemoteAudioTrack started. This means there is enough audio data to begin playback.

Parameters:
Name Type Description
track RemoteAudioTrack

The RemoteAudioTrack that started

Overrides:

unsubscribed

The RemoteAudioTrack was unsubscribed from.

Parameters:
Name Type Description
track RemoteAudioTrack

The RemoteAudioTrack that was unsubscribed from

Deprecated: