Classes

Classes

AccessTokenInvalidError
AudioTrack
ConfigurationAcquireFailedError
ConfigurationAcquireTurnFailedError
LocalAudioTrack
LocalAudioTrackStats
LocalParticipant
LocalTrack
LocalTrackStats
LocalVideoTrack
LocalVideoTrackStats
MediaClientLocalDescFailedError
MediaClientRemoteDescFailedError
MediaNoSupportedCodecError
MediaServerLocalDescFailedError
MediaServerRemoteDescFailedError
Participant
ParticipantIdentityCharsInvalidError
ParticipantIdentityInvalidError
ParticipantIdentityTooLongError
ParticipantMaxTracksExceededError
ParticipantNotFoundError
RemoteAudioTrackStats
RemoteTrackStats
RemoteVideoTrackStats
Room
RoomConnectFailedError
RoomCreateFailedError
RoomMaxParticipantsExceededError
RoomNameCharsInvalidError
RoomNameInvalidError
RoomNameTooLongError
RoomNotFoundError
SignalingConnectionDisconnectedError
SignalingConnectionError
SignalingConnectionTimeoutError
SignalingIncomingMessageInvalidError
SignalingOutgoingMessageInvalidError
StatsReport
Track
TrackInvalidError
TrackNameCharsInvalidError
TrackNameInvalidError
TrackNameTooLongError
TrackStats
TwilioError
VideoTrack

Events


disabled

The Track was disabled. For AudioTracks this means "muted", and for VideoTracks this means "paused".

Parameters:
Name Type Description
track Track

The Track that was disabled

Inherited From:

enabled

The Track was enabled. For AudioTracks this means "unmuted", and for VideoTracks this means "unpaused".

Parameters:
Name Type Description
track Track

The Track that was enabled

Inherited From:

started

The Track started. This means that the Track contains enough audio or video to begin playback.

Parameters:
Name Type Description
track Track

The Track that started

Inherited From:

disabled

The Track was disabled. For AudioTracks this means "muted", and for VideoTracks this means "paused".

Parameters:
Name Type Description
track Track

The Track that was disabled

Inherited From:
Overrides:

enabled

The Track was enabled. For AudioTracks this means "unmuted", and for VideoTracks this means "unpaused".

Parameters:
Name Type Description
track Track

The Track that was enabled

Inherited From:
Overrides:

started

The Track started. This means that the Track contains enough audio or video to begin playback.

Parameters:
Name Type Description
track Track

The Track that started

Inherited From:
Overrides:

stopped

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

Parameters:
Name Type Description
track LocalTrack

The LocalTrack that stopped

Inherited From:

disconnected

The Participant has disconnected.

Parameters:
Name Type Description
participant Participant

The Participant that disconnected.

Inherited From:

trackAdded

A Track was added by the Participant.

Parameters:
Name Type Description
track Track

The Track that was added

Inherited From:

trackDimensionsChanged

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

Parameters:
Name Type Description
track VideoTrack

The VideoTrack whose dimensions changed

Inherited From:

trackDisabled

A Track was disabled by the Participant.

Parameters:
Name Type Description
track Track

The Track that was disabled

Inherited From:

trackEnabled

A Track was enabled by the Participant.

Parameters:
Name Type Description
track Track

The Track that was enabled

Inherited From:

trackRemoved

A Track was removed by the Participant.

Parameters:
Name Type Description
track Track

The Track that was removed

Inherited From:

trackStarted

One of the Participant's Tracks started.

Parameters:
Name Type Description
track Track

The Track that started

Inherited From:

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


disabled

The Track was disabled. For AudioTracks this means "muted", and for VideoTracks this means "paused".

Parameters:
Name Type Description
track Track

The Track that was disabled

Inherited From:

enabled

The Track was enabled. For AudioTracks this means "unmuted", and for VideoTracks this means "unpaused".

Parameters:
Name Type Description
track Track

The Track that was enabled

Inherited From:

started

The Track started. This means that the Track contains enough audio or video to begin playback.

Parameters:
Name Type Description
track Track

The Track that started

Inherited From:

stopped

The LocalTrack was 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 Track was disabled. For AudioTracks this means "muted", and for VideoTracks this means "paused".

Parameters:
Name Type Description
track Track

The Track that was disabled

Inherited From:
Overrides:

enabled

The Track was enabled. For AudioTracks this means "unmuted", and for VideoTracks this means "unpaused".

Parameters:
Name Type Description
track Track

The Track that was enabled

Inherited From:
Overrides:

started

The Track started. This means that the Track contains enough audio or video to begin playback.

Parameters:
Name Type Description
track Track

The Track that started

Inherited From:
Overrides:

stopped

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

Parameters:
Name Type Description
track LocalTrack

The LocalTrack that stopped

Inherited From:

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


disconnected

Your Client was disconnected from the Room and all other Participants.

Parameters:
Name Type Argument Description
room Room

The Room your Client was disconnected from

error TwilioError <nullable>

Present when the Client 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 Participant joined the Room.

Parameters:
Name Type Description
participant Participant

The Participant who joined

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

participantDisconnected

A Participant left the Room.

Parameters:
Name Type Description
participant Participant

The Participant 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 Track was added by a Participant in the Room.

Parameters:
Name Type Description
track Track

The Track that was added

participant Participant

The Participant who added the Track

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

trackDimensionsChanged

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

Parameters:
Name Type Description
track VideoTrack

The VideoTrack whose dimensions changed

participant Participant

The Participant whose VideoTrack's dimensions changed


trackDisabled

A Track was disabled by a Participant in the Room.

Parameters:
Name Type Description
track Track

The Track that was disabled

participant Participant

The Participant who disabled the Track


trackEnabled

A Track was enabled by a Participant in the Room.

Parameters:
Name Type Description
track Track

The Track that was enabled

participant Participant

The Participant who enabled the Track


trackRemoved

A Track was removed by a Participant in the Room.

Parameters:
Name Type Description
track Track

The Track that was removed

participant Participant

The Participant who removed the Track

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

trackStarted

One of a Participant's Tracks in the Room started.

Parameters:
Name Type Description
track Track

The Track that started

participant Participant

The Participant whose Track started


disabled

The Track was disabled. For AudioTracks this means "muted", and for VideoTracks this means "paused".

Parameters:
Name Type Description
track Track

The Track that was disabled


enabled

The Track was enabled. For AudioTracks this means "unmuted", and for VideoTracks this means "unpaused".

Parameters:
Name Type Description
track Track

The Track that was enabled


started

The Track started. This means that the Track contains enough audio or video to begin playback.

Parameters:
Name Type Description
track Track

The Track that started


dimensionsChanged

The VideoTrack's dimensions changed.

Parameters:
Name Type Description
track VideoTrack

The VideoTrack whose dimensions changed


disabled

The Track was disabled. For AudioTracks this means "muted", and for VideoTracks this means "paused".

Parameters:
Name Type Description
track Track

The Track that was disabled

Inherited From:

enabled

The Track was enabled. For AudioTracks this means "unmuted", and for VideoTracks this means "unpaused".

Parameters:
Name Type Description
track Track

The Track that was enabled

Inherited From:

started

The Track started. This means that the Track contains enough audio or video to begin playback.

Parameters:
Name Type Description
track Track

The Track that started

Inherited From: