Classes

Classes

AccessTokenExpiredError
AccessTokenGrantsInvalidError
AccessTokenHeaderInvalidError
AccessTokenInvalidError
AccessTokenIssuerInvalidError
AccessTokenNotYetValidError
AccessTokenSignatureInvalidError
AudioTrack
ConfigurationAcquireFailedError
ConfigurationAcquireTurnFailedError
LocalAudioTrack
LocalAudioTrackPublication
LocalAudioTrackStats
LocalDataTrack
LocalDataTrackPublication
LocalParticipant
LocalTrackPublication
LocalTrackStats
LocalVideoTrack
LocalVideoTrackPublication
LocalVideoTrackStats
MediaClientLocalDescFailedError
MediaClientRemoteDescFailedError
MediaConnectionError
MediaNoSupportedCodecError
MediaServerLocalDescFailedError
MediaServerRemoteDescFailedError
Participant
ParticipantDuplicateIdentityError
ParticipantIdentityCharsInvalidError
ParticipantIdentityInvalidError
ParticipantIdentityTooLongError
ParticipantMaxTracksExceededError
ParticipantNotFoundError
RemoteAudioTrack
RemoteAudioTrackPublication
RemoteAudioTrackStats
RemoteDataTrack
RemoteDataTrackPublication
RemoteParticipant
RemoteTrackPublication
RemoteTrackStats
RemoteVideoTrack
RemoteVideoTrackPublication
RemoteVideoTrackStats
Room
RoomCompletedError
RoomConnectFailedError
RoomCreateFailedError
RoomInvalidParametersError
RoomMaxParticipantsExceededError
RoomMaxParticipantsOutOfRangeError
RoomMediaRegionInvalidError
RoomMediaRegionUnavailableError
RoomNameCharsInvalidError
RoomNameInvalidError
RoomNameTooLongError
RoomNotFoundError
RoomRoomExistsError
RoomStatusCallbackInvalidError
RoomStatusCallbackMethodInvalidError
RoomStatusInvalidError
RoomSubscriptionOperationNotSupportedError
RoomTimeoutOutOfRangeError
RoomTypeInvalidError
SignalingConnectionDisconnectedError
SignalingConnectionError
SignalingConnectionTimeoutError
SignalingIncomingMessageInvalidError
SignalingOutgoingMessageInvalidError
StatsReport
Track
TrackInvalidError
TrackNameCharsInvalidError
TrackNameInvalidError
TrackNameIsDuplicatedError
TrackNameTooLongError
TrackPublication
TrackServerTrackCapacityReachedError
TrackStats
TwilioError
VideoTrack

Events


disabled

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

Parameters:
Name Type Description
track AudioTrack

The AudioTrack that was disabled


enabled

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

Parameters:
Name Type Description
track AudioTrack

The AudioTrack that was enabled


started

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

Parameters:
Name Type Description
track AudioTrack

The AudioTrack that started


disabled

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

Parameters:
Name Type Description
track LocalAudioTrack

The LocalAudioTrack that was disabled

Overrides:

enabled

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

Parameters:
Name Type Description
track LocalAudioTrack

The LocalAudioTrack that was enabled

Overrides:

started

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

Parameters:
Name Type Description
track LocalAudioTrack

The LocalAudioTrack that started

Overrides:

stopped

The LocalAudioTrack stopped, either because LocalAudioTrack#stop was called or because the underlying MediaStreamTrack ended).

Parameters:
Name Type Description
track LocalAudioTrack

The LocalAudioTrack that stopped


disconnected

The Participant has disconnected.

Parameters:
Name Type Description
participant Participant

The Participant that disconnected.

Inherited From:

networkQualityLevelChanged

Parameters:
Name Type Description
networkQualityLevel NetworkQualityLevel

The new NetworkQualityLevel

Inherited From:

trackAdded

A LocalTrack was added by the LocalParticipant.

Parameters:
Name Type Description
track LocalTrack

The LocalTrack that was added

Overrides:
Deprecated:

trackDimensionsChanged

One of the LocalParticipant's LocalVideoTrack's dimensions changed.

Parameters:
Name Type Description
track LocalVideoTrack

The LocalVideoTrack whose dimensions changed

Overrides:

trackDisabled

A LocalTrack was disabled by the LocalParticipant.

Parameters:
Name Type Description
track LocalTrack

The LocalTrack that was disabled

Overrides:

trackEnabled

A LocalTrack was enabled by the LocalParticipant.

Parameters:
Name Type Description
track LocalTrack

The LocalTrack that was enabled

Overrides:

trackPublicationFailed

A LocalTrack failed to publish. Check the error message for more information.

Parameters:
Name Type Description
error TwilioError

A TwilioError explaining why publication failed

localTrack LocalTrack

The LocalTrack that failed to publish


trackPublished

A LocalTrack was successfully published.

Parameters:
Name Type Description
publication LocalTrackPublication

The resulting LocalTrackPublication for the published LocalTrack


trackRemoved

A LocalTrack was removed by the LocalParticipant.

Parameters:
Name Type Description
track LocalTrack

The LocalTrack that was removed

Overrides:
Deprecated:

trackStarted

One of the LocalParticipant's LocalTracks started.

Parameters:
Name Type Description
track LocalTrack

The LocalTrack that started

Overrides:

trackStopped

One of the LocalParticipant's LocalTracks stopped, either because LocalTrack#stop was called or because the underlying MediaStreamTrack ended).

Parameters:
Name Type Description
track LocalTrack

The LocalTrack that stopped


dimensionsChanged

The VideoTrack's dimensions changed.

Parameters:
Name Type Description
track VideoTrack

The VideoTrack whose dimensions changed

Inherited From:

disabled

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

Parameters:
Name Type Description
track LocalVideoTrack

The LocalVideoTrack that was disabled

Overrides:

enabled

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

Parameters:
Name Type Description
track LocalVideoTrack

The LocalVideoTrack that was enabled

Overrides:

started

The LocalVideoTrack started. This means there is enough video data to begin playback.

Parameters:
Name Type Description
track LocalVideoTrack

The LocalVideoTrack that started

Overrides:

stopped

The LocalVideoTrack stopped, either because LocalVideoTrack#stop was called or because the underlying MediaStreamTrack ended).

Parameters:
Name Type Description
track LocalVideoTrack

The LocalVideoTrack that stopped


disconnected

The Participant has disconnected.

Parameters:
Name Type Description
participant Participant

The Participant that disconnected.


networkQualityLevelChanged

Parameters:
Name Type Description
networkQualityLevel NetworkQualityLevel

The new NetworkQualityLevel


trackAdded

A Track was added by the Participant.

Parameters:
Name Type Description
track Track

The Track that was added

Deprecated:
  • Yes

trackDimensionsChanged

One of the Participant's VideoTrack's dimensions changed.

Parameters:
Name Type Description
track VideoTrack

The VideoTrack whose dimensions changed


trackDisabled

A Track was disabled by the Participant.

Parameters:
Name Type Description
track Track

The Track that was disabled.


trackEnabled

A Track was enabled by the Participant.

Parameters:
Name Type Description
track Track

The Track that was enabled


trackRemoved

A Track was removed by the Participant.

Parameters:
Name Type Description
track Track

The Track that was removed

Deprecated:
  • Yes

trackStarted

One of the Participant's Tracks started.

Parameters:
Name Type Description
track Track

The Track that started


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:

subscribed

Your LocalParticipant subscribed to the RemoteAudioTrack.

Parameters:
Name Type Description
track RemoteAudioTrack

the RemoteAudioTrack that was subscribed to


trackDisabled

The RemoteAudioTrack was disabled.


trackEnabled

The RemoteAudioTrack was enabled.


unsubscribed

Your LocalParticipant unsubscribed from the RemoteAudioTrack.

Parameters:
Name Type Description
track RemoteAudioTrack

the RemoteAudioTrack that was unsubscribed from


message

A message was received over the RemoteDataTrack.

Parameters:
Name Type Description
data string | ArrayBuffer
track RemoteDataTrack

The RemoteDataTrack that received the message


unsubscribed

The RemoteDataTrack was unsubscribed from.

Parameters:
Name Type Description
track RemoteDataTrack

The RemoteDataTrack that was unsubscribed from

Deprecated:

subscribed

Your LocalParticipant subscribed to the RemoteDataTrack.

Parameters:
Name Type Description
track RemoteDataTrack

the RemoteDataTrack that was subscribed to


unsubscribed

Your LocalParticipant unsubscribed from the RemoteDataTrack.

Parameters:
Name Type Description
track RemoteDataTrack

the RemoteDataTrack that was unsubscribed from


disconnected

The Participant has disconnected.

Parameters:
Name Type Description
participant Participant

The Participant that disconnected.

Inherited From:

networkQualityLevelChanged

Parameters:
Name Type Description
networkQualityLevel NetworkQualityLevel

The new NetworkQualityLevel

Inherited From:

trackAdded

A RemoteTrack was added by the RemoteParticipant.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was added

Overrides:
Deprecated:
  • Use RemoteParticipant#trackSubscribed instead

trackDimensionsChanged

One of the RemoteParticipant's RemoteVideoTrack's dimensions changed.

Parameters:
Name Type Description
track RemoteVideoTrack

The RemoteVideoTrack whose dimensions changed

Overrides:

trackDisabled

A RemoteTrack was disabled by the RemoteParticipant.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was disabled

Overrides:

trackEnabled

A RemoteTrack was enabled by the RemoteParticipant.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was enabled

Overrides:

trackMessage

A message was received over one of the RemoteParticipant's RemoteDataTracks.

Parameters:
Name Type Description
data string | ArrayBuffer
track RemoteDataTrack

The RemoteDataTrack over which the message was received


trackPublished

A RemoteTrack was published by the RemoteParticipant after connecting to the Room. This event is not emitted for RemoteTracks that were published while the RemoteParticipant was connecting to the Room.

Parameters:
Name Type Description
publication RemoteTrackPublication

The RemoteTrackPublication which represents the published RemoteTrack

Example
function trackPublished(publication) {
  console.log(`Track ${publication.trackSid} was published`);
}

room.on('participantConnected', participant => {
  // Handle RemoteTracks published while connecting to the Room.
  participant.trackPublications.forEach(trackPublished);

  // Handle RemoteTracks published after connecting to the Room.
  participant.on('trackPublished', trackPublished);
});

trackRemoved

A RemoteTrack was removed by the RemoteParticipant.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was removed

Overrides:
Deprecated:
  • Use RemoteParticipant#trackUnsubscribed instead

trackStarted

One of the RemoteParticipant's RemoteTracks started.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that started

Overrides:

trackSubscribed

A RemoteParticipant's RemoteTrack was subscribed to.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was subscribed to


trackSubscriptionFailed

A RemoteParticipant's RemoteTrack could not be subscribed to.

Parameters:
Name Type Description
error TwilioError

The reason the RemoteTrack could not be subscribed to

publication RemoteTrackPublication

The RemoteTrackPublication for the RemoteTrack that could not be subscribed to


trackUnpublished

A RemoteTrack was unpublished by the RemoteParticipant.

Parameters:
Name Type Description
publication RemoteTrackPublication

The RemoteTrackPublication which represents the unpublished RemoteTrack


trackUnsubscribed

A RemoteParticipant's RemoteTrack was unsubscribed from.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was unsubscribed from


subscribed

Your LocalParticipant subscribed to the RemoteTrack.

Parameters:
Name Type Description
track RemoteTrack

the RemoteTrack that was subscribed to


trackDisabled

The RemoteTrack was disabled.


trackEnabled

The RemoteTrack was enabled.


unsubscribed

Your LocalParticipant unsubscribed from the RemoteTrack.

Parameters:
Name Type Description
track RemoteTrack

the RemoteTrack that was unsubscribed from


dimensionsChanged

The RemoteVideoTrack's dimensions changed.

Parameters:
Name Type Description
track RemoteVideoTrack

The RemoteVideoTrack whose dimensions changed

Overrides:

disabled

The RemoteVideoTrack was disabled, i.e. "paused".

Parameters:
Name Type Description
track RemoteVideoTrack

The RemoteVideoTrack that was disabled

Overrides:

enabled

The RemoteVideoTrack was enabled, i.e. "unpaused".

Parameters:
Name Type Description
track RemoteVideoTrack

The RemoteVideoTrack that was enabled

Overrides:

started

The VideoTrack started. This means there is enough video data to begin playback.

Parameters:
Name Type Description
track VideoTrack

The VideoTrack that started

Inherited From:

unsubscribed

The RemoteVideoTrack was unsubscribed from.

Parameters:
Name Type Description
track RemoteVideoTrack

The RemoteVideoTrack that was unsubscribed from

Deprecated:

subscribed

Your LocalParticipant subscribed to the RemoteVideoTrack.

Parameters:
Name Type Description
track RemoteVideoTrack

the RemoteVideoTrack that was subscribed to


trackDisabled

The RemoteVideoTrack was disabled.


trackEnabled

The RemoteVideoTrack was enabled.


unsubscribed

Your LocalParticipant unsubscribed from the RemoteVideoTrack.

Parameters:
Name Type Description
track RemoteVideoTrack

the RemoteVideoTrack that was unsubscribed from


disconnected

Your LocalParticipant was disconnected from the Room and all other RemoteParticipants.

Parameters:
Name Type Argument Description
room Room

The Room your LocalParticipant was disconnected from

error TwilioError <nullable>

Present when the LocalParticipant got disconnected from the Room unexpectedly

Example
myRoom.on('disconnected', function(room, error) {
  if (error) {
    console.log('Unexpectedly disconnected:', error);
  }
  myRoom.localParticipant.tracks.forEach(function(track) {
    track.stop();
    track.detach();
  });
});

dominantSpeakerChanged

The Dominant Speaker in the Room changed. Either the Dominant Speaker is a new RemoteParticipant or the Dominant Speaker has been reset and is now null.

Parameters:
Name Type Argument Description
dominantSpeaker RemoteParticipant <nullable>

The Dominant Speaker in the Room, if any


participantConnected

A RemoteParticipant joined the Room.

Parameters:
Name Type Description
participant RemoteParticipant

The RemoteParticipant who joined

Example
myRoom.on('participantConnected', function(participant) {
  console.log(participant.identity + ' joined the Room');
});

participantDisconnected

A RemoteParticipant left the Room.

Parameters:
Name Type Description
participant RemoteParticipant

The RemoteParticipant who left

Example
myRoom.on('participantDisconnected', function(participant) {
  console.log(participant.identity + ' left the Room');
  participant.tracks.forEach(function(track) {
    track.detach().forEach(function(mediaElement) {
      mediaElement.remove();
    });
  });
});

reconnected

Your application successfully reconnected to the Room. When this event is emitted, the Room is in state "connected".

Example
myRoom.on('reconnected', () => {
  console.log('Reconnected!');
});

reconnecting

Your application is reconnecting to the Room. Typically this happens when there is a disruption in your media connection. When this event is emitted, the Room is in state "reconnecting". If reconnecting succeeds, the Room will emit a "reconnected" event.

Parameters:
Name Type Description
error TwilioError

A TwilioError explaining why your application is reconnecting

Example
myRoom.on('reconnecting', error => {
  console.warn('Reconnecting!', error);
});

recordingStarted

The Room is now being recorded


recordingStopped

The Room is no longer being recorded


trackAdded

A RemoteTrack was added by a RemoteParticipant in the Room.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was added

participant RemoteParticipant

The RemoteParticipant who added the RemoteTrack

Deprecated:
  • Use RemoteParticipant#trackSubscribed instead
Example
room.on('trackAdded', function(track, participant) {
  var participantView = document.getElementById('participant-view-' + participant.identity);
  participantView.appendChild(track.attach());
});

trackDimensionsChanged

One of the RemoteParticipant's VideoTrack's dimensions changed.

Parameters:
Name Type Description
track RemoteVideoTrack

The RemoteVideoTrack whose dimensions changed

participant RemoteParticipant

The RemoteParticipant whose RemoteVideoTrack's dimensions changed


trackDisabled

A RemoteTrack was disabled by a RemoteParticipant in the Room.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was disabled

participant RemoteParticipant

The RemoteParticipant who disabled the RemoteTrack


trackEnabled

A RemoteTrack was enabled by a RemoteParticipant in the Room.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was enabled

participant RemoteParticipant

The RemoteParticipant who enabled the RemoteTrack


trackMessage

A message was received over one of the RemoteParticipant's RemoteDataTrack's.

Parameters:
Name Type Description
data string | ArrayBuffer
track RemoteVideoTrack

The RemoteDataTrack over which the message was received

participant RemoteParticipant

The RemoteParticipant whose RemoteDataTrack received the message


trackPublished

A RemoteTrack was published by a RemoteParticipant after connecting to the Room. This event is not emitted for RemoteTracks that were published while the RemoteParticipant was connecting to the Room.

Parameters:
Name Type Description
publication RemoteTrackPublication

The RemoteTrackPublication which represents the published RemoteTrack

participant RemoteParticipant

The RemoteParticipant who published the RemoteTrack

Example
function trackPublished(publication, participant) {
  console.log(`RemoteParticipant ${participant.sid} published Track ${publication.trackSid}`);
}

// Handle RemoteTracks published after connecting to the Room.
room.on('trackPublished', trackPublished);

room.on('participantConnected', participant => {
  // Handle RemoteTracks published while connecting to the Room.
  participant.trackPublications.forEach(publication => trackPublished(publication, participant));
});

trackRemoved

A RemoteTrack was removed by a RemoteParticipant in the Room.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was removed

participant RemoteParticipant

The RemoteParticipant who removed the RemoteTrack

Deprecated:
  • Use RemoteParticipant#trackUnsubscribed instead
Example
room.on('trackRemoved', function(track, participant) {
  track.detach().forEach(function(mediaElement) {
    mediaElement.remove();
  });
});

trackStarted

One of a RemoteParticipant's RemoteTracks in the Room started.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that started

participant RemoteParticipant

The RemoteParticipant whose RemoteTrack started


trackSubscribed

A RemoteParticipant's RemoteTrack was subscribed to.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was subscribed

participant RemoteParticipant

The RemoteParticipant whose RemoteTrack was subscribed

Example
room.on('trackSubscribed', function(track, participant) {
  var participantView = document.getElementById('participant-view-' + participant.identity);
  participantView.appendChild(track.attach());
});

trackSubscriptionFailed

A RemoteParticipant's RemoteTrack could not be subscribed to.

Parameters:
Name Type Description
error TwilioError

The reason the RemoteTrack could not be subscribed to

publication RemoteTrackPublication

The RemoteTrackPublication for the RemoteTrack that could not be subscribed to

participant RemoteParticipant

The RemoteParticipant whose RemoteTrack could not be subscribed to


trackUnpublished

A RemoteTrack was unpublished by a RemoteParticipant to the Room.

Parameters:
Name Type Description
publication RemoteTrackPublication

The RemoteTrackPublication which represents the unpublished RemoteTrack

participant RemoteParticipant

The RemoteParticipant who unpublished the RemoteTrack


trackUnsubscribed

A RemoteParticipant's RemoteTrack was unsubscribed from.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was unsubscribed

participant RemoteParticipant

The RemoteParticipant whose RemoteTrack was unsubscribed

Example
room.on('trackUnsubscribed', function(track, participant) {
  track.detach().forEach(function(mediaElement) {
    mediaElement.remove();
  });
});

trackDisabled

The published Track was disabled.


trackEnabled

The published Track was enabled.


dimensionsChanged

The VideoTrack's dimensions changed.

Parameters:
Name Type Description
track VideoTrack

The VideoTrack whose dimensions changed


disabled

The VideoTrack was disabled, i.e. "paused".

Parameters:
Name Type Description
track VideoTrack

The VideoTrack that was disabled


enabled

The VideoTrack was enabled, i.e. "unpaused".

Parameters:
Name Type Description
track VideoTrack

The VideoTrack that was enabled


started

The VideoTrack started. This means there is enough video data to begin playback.

Parameters:
Name Type Description
track VideoTrack

The VideoTrack that started