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
- MediaDTLSTransportFailedError
- MediaNoSupportedCodecError
- MediaServerLocalDescFailedError
- MediaServerRemoteDescFailedError
- NetworkQualityAudioStats
- NetworkQualityBandwidthStats
- NetworkQualityFractionLostStats
- NetworkQualityLatencyStats
- NetworkQualityMediaStats
- NetworkQualityRecvStats
- NetworkQualitySendOrRecvStats
- NetworkQualitySendStats
- NetworkQualityStats
- NetworkQualityVideoStats
- Participant
- ParticipantDuplicateIdentityError
- ParticipantIdentityCharsInvalidError
- ParticipantIdentityInvalidError
- ParticipantIdentityTooLongError
- ParticipantMaxTracksExceededError
- ParticipantNotFoundError
- PreflightTest
- RemoteAudioTrack
- RemoteAudioTrackPublication
- RemoteAudioTrackStats
- RemoteDataTrack
- RemoteDataTrackPublication
- RemoteParticipant
- RemoteTrackPublication
- RemoteTrackStats
- RemoteVideoTrack
- RemoteVideoTrackPublication
- RemoteVideoTrackStats
- Room
- RoomAudioOnlyFlagNotSupportedError
- RoomCompletedError
- RoomConnectFailedError
- RoomCreateFailedError
- RoomInvalidParametersError
- RoomMaxParticipantsExceededError
- RoomMaxParticipantsOutOfRangeError
- RoomMediaRegionInvalidError
- RoomMediaRegionUnavailableError
- RoomNameCharsInvalidError
- RoomNameInvalidError
- RoomNameTooLongError
- RoomNotFoundError
- RoomRoomExistsError
- RoomStatusCallbackInvalidError
- RoomStatusCallbackMethodInvalidError
- RoomStatusInvalidError
- RoomSubscriptionOperationNotSupportedError
- RoomTimeoutOutOfRangeError
- RoomTrackKindNotSupportedError
- RoomTypeInvalidError
- SignalingConnectionDisconnectedError
- SignalingConnectionError
- SignalingConnectionTimeoutError
- SignalingIncomingMessageInvalidError
- SignalingOutgoingMessageInvalidError
- SignalingServerBusyError
- 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
-
event
-
The SDK raised an EventListenerEvent.
Parameters:
Name Type Description event
EventListenerEvent Context about the event raised by the SDK. This can be one of the following:
-
disabled
-
The LocalAudioTrack was disabled, i.e. the audio source was muted by the user.
Parameters:
Name Type Description track
LocalAudioTrack The LocalAudioTrack that was disabled
- Overrides:
-
enabled
-
The LocalAudioTrack was enabled, i.e. the audio source was unmuted by the user.
Parameters:
Name Type Description track
LocalAudioTrack The LocalAudioTrack that was enabled
- Overrides:
-
muted
-
The LocalAudioTrack was muted because the audio source stopped sending samples, most likely due to another application taking said audio source, especially on mobile devices.
Parameters:
Name Type Description track
LocalAudioTrack The LocalAudioTrack that was muted
-
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 or LocalAudioTrack#restart was called or because the underlying MediaStreamTrack ended.
Parameters:
Name Type Description track
LocalAudioTrack The LocalAudioTrack that stopped
-
unmuted
-
The LocalAudioTrack was unmuted because the audio source resumed sending samples, most likely due to the application that took over the said audio source has released it back to the application, especially on mobile devices. This event is also fired when LocalAudioTrack#restart is called on a muted LocalAudioTrack with a new audio source.
Parameters:
Name Type Description track
LocalAudioTrack The LocalAudioTrack that was unmuted
-
trackDisabled
-
The published Track was disabled.
- Inherited From:
- Overrides:
-
trackEnabled
-
The published Track was enabled.
- Inherited From:
- Overrides:
-
warning
-
The published LocalTrack encountered a warning. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.Parameters:
Name Type Description name
string The warning that was raised.
- Inherited From:
- Overrides:
-
warningsCleared
-
The published LocalTrack cleared all warnings. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.- Inherited From:
- Overrides:
-
trackDisabled
-
The published Track was disabled.
- Inherited From:
- Overrides:
-
trackEnabled
-
The published Track was enabled.
- Inherited From:
- Overrides:
-
warning
-
The published LocalTrack encountered a warning. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.Parameters:
Name Type Description name
string The warning that was raised.
- Inherited From:
- Overrides:
-
warningsCleared
-
The published LocalTrack cleared all warnings. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.- Inherited From:
- Overrides:
-
disconnected
-
The Participant has disconnected.
Parameters:
Name Type Description participant
Participant The Participant that disconnected.
- Inherited From:
- Overrides:
-
networkQualityLevelChanged
-
The Participant's NetworkQualityLevel changed.
Parameters:
Name Type Argument Description networkQualityLevel
NetworkQualityLevel The new NetworkQualityLevel
networkQualityStats
NetworkQualityStats <nullable>
The NetworkQualityStats based on which NetworkQualityLevel is calculated, if any
- Inherited From:
- Overrides:
-
reconnected
-
The LocalParticipant has reconnected to the Room after a signaling connection disruption.
- Overrides:
-
reconnecting
-
The LocalParticipant is reconnecting to the Room after a signaling connection disruption.
- 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
-
trackEnabled
-
A LocalTrack was enabled by the LocalParticipant.
Parameters:
Name Type Description track
LocalTrack The LocalTrack that was enabled
-
trackPublicationFailed
-
A LocalTrack failed to publish. Check the error message for more information. In a Large Group Room (Maximum Participants greater than 50), this event is raised with a ParticipantMaxTracksExceededError either when attempting to publish the LocalTrack will exceed the Maximum Published Tracks limit of 16, or the LocalTrack is part of a set of LocalTracks which along with the published Tracks exceeds 16.
Parameters:
Name Type Description error
TwilioError A TwilioError explaining why publication failed
localTrack
LocalTrack The LocalTrack that failed to publish
-
trackPublished
-
A LocalTrack that was added using LocalParticipant#publishTrack was successfully published. This event is not raised for LocalTracks added in ConnectOptions
.tracks
or auto-created withinconnect
.Parameters:
Name Type Description publication
LocalTrackPublication The resulting LocalTrackPublication for the published LocalTrack
-
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
-
trackWarning
-
One of the LocalParticipant's LocalTrackPublications encountered a warning. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.Parameters:
Name Type Description name
string The warning that was raised.
publication
LocalTrackPublication The LocalTrackPublication that encountered the warning.
-
trackWarningsCleared
-
One of the LocalParticipant's LocalTrackPublications cleared all warnings. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.Parameters:
Name Type Description publication
LocalTrackPublication The LocalTrackPublication that cleared all warnings.
-
trackDisabled
-
The published Track was disabled.
- Inherited From:
- Overrides:
-
trackEnabled
-
The published Track was enabled.
- Inherited From:
- Overrides:
-
warning
-
The published LocalTrack encountered a warning. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.Parameters:
Name Type Description name
string The warning that was raised.
-
warningsCleared
-
The published LocalTrack cleared all warnings. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
. -
dimensionsChanged
-
The VideoTrack's dimensions changed.
Parameters:
Name Type Description track
VideoTrack The VideoTrack whose dimensions changed
- Inherited From:
- Overrides:
-
disabled
-
The LocalVideoTrack was disabled, i.e. the video source was paused by the user.
Parameters:
Name Type Description track
LocalVideoTrack The LocalVideoTrack that was disabled
- Overrides:
-
enabled
-
The LocalVideoTrack was enabled, i.e. the video source was unpaused by the user.
Parameters:
Name Type Description track
LocalVideoTrack The LocalVideoTrack that was enabled
- Overrides:
-
muted
-
The LocalVideoTrack was muted because the video source stopped sending frames, most likely due to another application taking said video source, especially on mobile devices.
Parameters:
Name Type Description track
LocalVideoTrack The LocalVideoTrack that was muted
-
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 or LocalVideoTrack#restart was called or because the underlying MediaStreamTrack ended.
Parameters:
Name Type Description track
LocalVideoTrack The LocalVideoTrack that stopped
-
unmuted
-
The LocalVideoTrack was unmuted because the video source resumed sending frames, most likely due to the application that took over the said video source has released it back to the application, especially on mobile devices. This event is also fired when LocalVideoTrack#restart is called on a muted LocalVideoTrack with a new video source.
Parameters:
Name Type Description track
LocalVideoTrack The LocalVideoTrack that was unmuted
-
trackDisabled
-
The published Track was disabled.
- Inherited From:
- Overrides:
-
trackEnabled
-
The published Track was enabled.
- Inherited From:
- Overrides:
-
warning
-
The published LocalTrack encountered a warning. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.Parameters:
Name Type Description name
string The warning that was raised.
- Inherited From:
- Overrides:
-
warningsCleared
-
The published LocalTrack cleared all warnings. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.- Inherited From:
- Overrides:
-
disconnected
-
The Participant has disconnected.
Parameters:
Name Type Description participant
Participant The Participant that disconnected.
-
networkQualityLevelChanged
-
The Participant's NetworkQualityLevel changed.
Parameters:
Name Type Argument Description networkQualityLevel
NetworkQualityLevel The new NetworkQualityLevel
networkQualityStats
NetworkQualityStats <nullable>
The NetworkQualityStats based on which NetworkQualityLevel is calculated, if any
-
reconnected
-
The Participant has reconnected to the Room after a signaling connection disruption.
-
reconnecting
-
The Participant is reconnecting to the Room after a signaling connection disruption.
-
trackDimensionsChanged
-
One of the Participant's VideoTrack's dimensions changed.
Parameters:
Name Type Description track
VideoTrack The VideoTrack whose dimensions changed
-
trackStarted
-
One of the Participant's Tracks started.
Parameters:
Name Type Description track
Track The Track that started
-
completed
-
Preflight test has completed successfully.
Parameters:
Name Type Description report
PreflightTestReport Results of the test.
-
failed
-
Preflight test has encountered a failure and is now stopped.
Parameters:
Name Type Description error
TwilioError | Error A TwilioError or a DOMException. Possible TwilioErrors include Signaling and Media related errors which can be found here.
report
PreflightTestReport Partial results gathered during the test. Use this information to help determine the cause of failure.
-
progress
-
Emitted to indicate progress of the test
Parameters:
Name Type Description progress
PreflightProgress Indicates the status completed.
-
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:
-
switchedOff
-
A RemoteAudioTrack was switched off.
Parameters:
Name Type Description track
RemoteAudioTrack The RemoteAudioTrack that was switched off
-
switchedOn
-
A RemoteAudioTrack was switched on.
Parameters:
Name Type Description track
RemoteAudioTrack The RemoteAudioTrack that was switched on
-
subscribed
-
Your LocalParticipant subscribed to the RemoteAudioTrack.
Parameters:
Name Type Description track
RemoteAudioTrack the RemoteAudioTrack that was subscribed to
-
subscriptionFailed
-
Your LocalParticipant failed to subscribe to the RemoteAudioTrack.
Parameters:
Name Type Description error
TwilioError the reason the RemoteAudioTrack could not be 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
-
switchedOff
-
A RemoteDataTrack was switched off.
Parameters:
Name Type Description track
RemoteDataTrack The RemoteDataTrack that was switched off
-
switchedOn
-
A RemoteDataTrack was switched on.
Parameters:
Name Type Description track
RemoteDataTrack The RemoteDataTrack that was switched on
-
subscribed
-
Your LocalParticipant subscribed to the RemoteDataTrack.
Parameters:
Name Type Description track
RemoteDataTrack the RemoteDataTrack that was subscribed to
-
subscriptionFailed
-
Your LocalParticipant failed to subscribe to the RemoteDataTrack.
Parameters:
Name Type Description error
TwilioError the reason the RemoteDataTrack could not be 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:
- Overrides:
-
networkQualityLevelChanged
-
The Participant's NetworkQualityLevel changed.
Parameters:
Name Type Argument Description networkQualityLevel
NetworkQualityLevel The new NetworkQualityLevel
networkQualityStats
NetworkQualityStats <nullable>
The NetworkQualityStats based on which NetworkQualityLevel is calculated, if any
- Inherited From:
- Overrides:
-
reconnected
-
The RemoteParticipant has reconnected to the Room after a signaling connection disruption.
- Overrides:
-
reconnecting
-
The RemoteParticipant is reconnecting to the Room after a signaling connection disruption.
- 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 publication
RemoteTrackPublication The RemoteTrackPublication associated with the disabled RemoteTrack
-
trackEnabled
-
A RemoteTrack was enabled by the RemoteParticipant.
Parameters:
Name Type Description publication
RemoteTrackPublication The RemoteTrackPublication associated with the enabled RemoteTrack
-
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); });
-
trackPublishPriorityChanged
-
The RemoteTrackPublication's publish Track.Priority was changed by the RemoteParticipant.
Parameters:
Name Type Description priority
Track.Priority the RemoteTrack's new publish Track.Priority;
publication
RemoteTrackPublication The RemoteTrackPublication for the RemoteTrack that changed priority
-
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
publication
RemoteTrackPublication The RemoteTrackPublication for 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
-
trackSwitchedOff
-
A RemoteParticipant's RemoteTrack was subscribed to.
Parameters:
Name Type Description track
RemoteTrack The RemoteTrack that was switched off
publication
RemoteTrackPublication The RemoteTrackPublication for the RemoteTrack that was switched off
-
trackSwitchedOn
-
A RemoteParticipant's RemoteTrack was switched on.
Parameters:
Name Type Description track
RemoteTrack The RemoteTrack that was switched on.
publication
RemoteTrackPublication The RemoteTrackPublication for the RemoteTrack that was switched on
-
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
publication
RemoteTrackPublication The RemoteTrackPublication for the RemoteTrack that was unsubscribed from
-
publishPriorityChanged
-
The RemoteTrack's publish Track.Priority was changed by the RemoteParticipant.
Parameters:
Name Type Description priority
Track.Priority the RemoteTrack's new publish Track.Priority; RemoteTrackPublication#publishPriority is also updated accordingly
-
subscribed
-
Your LocalParticipant subscribed to the RemoteTrack.
Parameters:
Name Type Description track
RemoteTrack the RemoteTrack that was subscribed to
-
subscriptionFailed
-
Your LocalParticipant failed to subscribe to the RemoteTrack.
Parameters:
Name Type Description error
TwilioError the reason the RemoteTrack could not be subscribed to
-
trackDisabled
-
The RemoteTrack was disabled.
- Overrides:
-
trackEnabled
-
The RemoteTrack was enabled.
- Overrides:
-
trackSwitchedOff
-
The RemoteTrack was switched off.
Parameters:
Name Type Description track
RemoteTrack the RemoteTrack that was switched off
-
trackSwitchedOn
-
The RemoteTrack was switched on.
Parameters:
Name Type Description track
RemoteTrack the RemoteTrack that was switched on
-
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. "resumed".
Parameters:
Name Type Description track
RemoteVideoTrack The RemoteVideoTrack that was enabled
- Overrides:
-
started
-
The RemoteVideoTrack started. This means there is enough video data to begin playback.
Parameters:
Name Type Description track
RemoteVideoTrack The RemoteVideoTrack that started
- Overrides:
-
switchedOff
-
A RemoteVideoTrack was switched off.
Parameters:
Name Type Description track
RemoteVideoTrack The RemoteVideoTrack that was switched off
-
switchedOn
-
A RemoteVideoTrack was switched on.
Parameters:
Name Type Description track
RemoteVideoTrack The RemoteVideoTrack that was switched on
-
subscribed
-
Your LocalParticipant subscribed to the RemoteVideoTrack.
Parameters:
Name Type Description track
RemoteVideoTrack the RemoteVideoTrack that was subscribed to
-
subscriptionFailed
-
Your LocalParticipant failed to subscribe to the RemoteVideoTrack.
Parameters:
Name Type Description error
TwilioError the reason the RemoteVideoTrack could not be 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. In Large Group Rooms (Maximum Participants greater than 50), this event is raised only when a RemoteParticipant publishes at least one LocalTrack.
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. In Large Group Rooms (Maximum Participants greater than 50), this event is raised only when a RemoteParticipant unpublishes all its LocalTracks.
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(); }); }); });
-
participantReconnected
-
A RemoteParticipant has reconnected to the Room after a signaling connection disruption.
Parameters:
Name Type Description participant
RemoteParticipant The RemoteParticipant that has reconnected.
Example
myRoom.on('participantReconnected', participant => { console.log(participant.identity + ' reconnected to the Room'); });
-
participantReconnecting
-
A RemoteParticipant is reconnecting to the Room after a signaling connection disruption.
Parameters:
Name Type Description participant
RemoteParticipant The RemoteParticipant that is reconnecting.
Example
myRoom.on('participantReconnecting', participant => { console.log(participant.identity + ' is reconnecting to the Room'); });
-
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. This happens when there is a disruption in your signaling connection and/or 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
MediaConnectionError | SignalingConnectionDisconnectedError A MediaConnectionError if your application is reconnecting due to a disruption in your media connection, or a SignalingConnectionDisconnectedError if your application is reconnecting due to a disruption in your signaling connection
Example
myRoom.on('reconnecting', error => { if (error.code === 53001) { console.log('Reconnecting your signaling connection!', error.message); } else if (error.code === 53405) { console.log('Reconnecting your media connection!', error.message); } });
-
recordingStarted
-
The Room is now being recorded
-
recordingStopped
-
The Room is no longer being recorded
-
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 publication
RemoteTrackPublication The RemoteTrackPublication that represents disabled RemoteTrack
participant
RemoteParticipant The RemoteParticipant who disabled the RemoteTrack
-
trackEnabled
-
A RemoteTrack was enabled by a RemoteParticipant in the Room.
Parameters:
Name Type Description publication
RemoteTrackPublication The RemoteTrackPublication that represents enabled RemoteTrack
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
RemoteDataTrack 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)); });
-
trackPublishPriorityChanged
-
The RemoteTrack's publish Track.Priority was changed by the RemoteParticipant.
Parameters:
Name Type Description priority
Track.Priority the RemoteTrack's new publish Track.Priority;
publication
RemoteTrackPublication The RemoteTrackPublication for the RemoteTrack that changed priority
participant
RemoteParticipant The RemoteParticipant whose RemoteTrack changed priority
-
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
publication
RemoteTrackPublication The RemoteTrackPublication for the RemoteTrack that was subscribed to
participant
RemoteParticipant The RemoteParticipant whose RemoteTrack was subscribed
Example
room.on('trackSubscribed', function(track, publication, 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
-
trackSwitchedOff
-
A RemoteParticipant's RemoteTrack was switched off.
Parameters:
Name Type Description track
RemoteTrack The RemoteTrack that was switched off
publication
RemoteTrackPublication The RemoteTrackPublication for the RemoteTrack that was subscribed to
participant
RemoteParticipant The RemoteParticipant whose RemoteTrack was switched off
-
trackSwitchedOn
-
A RemoteParticipant's RemoteTrack was switched on.
Parameters:
Name Type Description track
RemoteTrack The RemoteTrack that was switched on
publication
RemoteTrackPublication The RemoteTrackPublication for the RemoteTrack that was subscribed to
participant
RemoteParticipant The RemoteParticipant whose RemoteTrack was switched on
-
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
publication
RemoteTrackPublication The RemoteTrackPublication for the RemoteTrack that was unsubscribed from
participant
RemoteParticipant The RemoteParticipant whose RemoteTrack was unsubscribed
Example
room.on('trackUnsubscribed', function(track, publication, participant) { track.detach().forEach(function(mediaElement) { mediaElement.remove(); }); });
-
trackWarning
-
One of the LocalParticipant's LocalTrackPublications in the Room encountered a warning. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.Parameters:
Name Type Description name
string The warning that was raised.
publication
LocalTrackPublication The LocalTrackPublication that encountered the warning.
participant
LocalParticipant The LocalParticipant
Example
room.on('trackWarning', (name, publication, participant) => { if (name === 'recording-media-lost') { log(`LocalTrack ${publication.track.name} is not recording media.`, name, publication, participant); // Wait a reasonable amount of time to clear the warning. const timer = setTimeout(() => { // If the warning is not cleared, you can manually // reconnect to the room, or show a dialog to the user }, 5000); room.once('trackWarningsCleared', (publication, participant) => { log('LocalTrack warnings have cleared!', publication, participant); clearTimeout(timer); }); } });
-
trackWarningsCleared
-
One of the LocalParticipant's LocalTrackPublications in the Room cleared all warnings. This event is only raised if you enabled warnings using
notifyWarnings
inConnectOptions
.Parameters:
Name Type Description publication
LocalTrackPublication The LocalTrackPublication that cleared all warnings.
participant
LocalParticipant The LocalParticipant
-
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