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
RemoteAudioTrackStats
RemoteDataTrack
RemoteParticipant
RemoteTrackStats
RemoteVideoTrack
RemoteVideoTrackStats
Room
RoomConnectFailedError
RoomCreateFailedError
RoomMaxParticipantsExceededError
RoomMaxParticipantsOutOfRangeError
RoomNameCharsInvalidError
RoomNameInvalidError
RoomNameTooLongError
RoomNotFoundError
RoomRoomExistsError
RoomStatusCallbackInvalidError
RoomStatusCallbackMethodInvalidError
RoomStatusInvalidError
RoomTimeoutOutOfRangeError
RoomTypeInvalidError
SignalingConnectionDisconnectedError
SignalingConnectionError
SignalingConnectionTimeoutError
SignalingIncomingMessageInvalidError
SignalingOutgoingMessageInvalidError
StatsReport
Track
TrackInvalidError
TrackNameCharsInvalidError
TrackNameInvalidError
TrackNameIsDuplicatedError
TrackNameTooLongError
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:

trackAdded

A LocalTrack was added by the LocalParticipant.

Parameters:
Name Type Description
track LocalTrack

The LocalTrack that was added

Overrides:

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:

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.


trackAdded

A Track was added by the Participant.

Parameters:
Name Type Description
track Track

The Track that was added


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


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


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


disconnected

The Participant has disconnected.

Parameters:
Name Type Description
participant Participant

The Participant that disconnected.

Inherited From:

trackAdded

A RemoteTrack was added by the RemoteParticipant.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was added

Overrides:

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


trackRemoved

A RemoteTrack was removed by the RemoteParticipant.

Parameters:
Name Type Description
track RemoteTrack

The RemoteTrack that was removed

Overrides:

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


trackUnsubscribed

A RemoteParticipant's RemoteTrack was unsubscribed from.

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


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();
  });
});

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();
    });
  });
});

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

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


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

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());
});

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();
  });
});

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