Events triggered by SkylinkJS. Event constants referenced here - SkylinkConstants.EVENTS
- Source:
Example
Import SkylinkEventManager and SkylinkConstants from 'skylinkjs'
Example 1: Adding a listener
SkylinkEventManager.addEventListener(SkylinkConstants.EVENTS.ON_INCOMING_STREAM, evt => {
const { detail } = evt;
// do something
});
Example 2: Removing a listener
SkylinkEventManager.removeEventListener(SkylinkConstants.EVENTS.ON_INCOMING_STREAM, evt => {
const { detail } = evt;
// do something
});
Events
candidateGenerationState
Event triggered when a Peer connection ICE gathering state has changed.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
candidateProcessingState
Event triggered when remote ICE candidate processing state has changed when Peer is using trickle ICE.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
candidatesGathered
Event triggered when all remote ICE candidates gathering has completed and been processed.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
channelClose
Event triggered when socket connection to Signaling server has closed.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
channelError
This may be caused by Javascript errors in the event listener when subscribing to events.
It may be resolved by checking for code errors in your Web App in the event subscribing listener.
Event triggered when socket connection encountered exception.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
channelMessage
Note that this is used only for SDK developer purposes. Event triggered when receiving socket message from the Signaling server.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
channelOpen
Event triggered when socket connection to Signaling server has opened.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
channelReopen
Event triggered when socket connection to Signaling server has re-opened.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
Example
Example 1: Listen on channelReopen to handle successful socket reconnection if socket was disconnected
(channelClose event emitted).
SkylinkEventManager.addEventListener(SkylinkConstants.EVENTS.CHANNEL_REOPEN, evt => {
const { detail } = evt;
skylink.leaveRoom() // call leaveRoom to ensure that previous peer information will be removed
.then(() => skylink.joinRoom(joinRoomOptions))
.then((streams) => {
window.attachMediaStream(el, stream);
})
});
channelRetry
Event triggered when attempting to establish socket connection to Signaling server when failed.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
encryptSecretsUpdated
Event triggered when encrypt secret data is updated.
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
getConnectionStatusStateChange
Event triggered when
method
retrieval state changes.PeerConnection.getConnectionStatus
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload/ Properties
|
- Source:
getPeersStateChange
Event triggered when getPeers()
method retrieval state changes.
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload Properties
|
- Source:
handshakeProgress
Event triggered when a Peer connection establishment state has changed.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
iceConnectionState
Learn more about how ICE works in this article here. Event triggered when a Peer connection ICE connection state has changed.
Parameters:
Name | Type | Description |
---|---|---|
state |
SkylinkEvents.ICE_CONNECTION_STATE |
The current Peer connection ICE connection state. |
peerId |
String |
The Peer ID. |
localMediaMuted
Event triggered when muteStreams()
method changes User Streams audio and video tracks muted status.
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
loggedOnConsole
Event triggered when Skylink logs to browser's console.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
mediaAccessError
Event triggered when retrieval of Stream failed.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
mediaAccessFallback
Event triggered when Stream retrieval fallback state has changed.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
mediaAccessRequired
Event triggered when retrieval of Stream is required to complete joinRoom()
method request.
Parameters:
Name | Type | Description |
---|---|---|
detail |
Object |
Event's payload. |
- Source:
mediaAccessStopped
Event triggered when Stream has stopped streaming.
Parameters:
Name | Type | Description |
---|---|---|
detail.isScreensharing |
Object |
The flag if event occurred during |
detail.isAudioFallback |
boolean |
The flag if event occurred during retrieval of audio tracks only when |
detail.streamId |
String |
The Stream ID. |
- Source:
mediaAccessSuccess
Event triggered when retrieval of Stream is successful.
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Properties
|
- Source:
onDataChannelStateChanged
Event triggered when a Datachannel connection state has changed.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
onIncomingMessage
Event triggered when receiving message from Peer.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
onIncomingScreenStream
Event triggered when receving Peer Screenshare Stream.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
onIncomingStream
Event triggered when receiving Peer Stream.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
peerConnectionState
Event triggered when a Peer connection session description exchanging state has changed.
Learn more about how ICE works in this article here.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload Properties
|
- Source:
peerJoined
Event triggered when a Peer joins the room.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload Properties
|
- Source:
peerLeft
Event triggered when a Peer leaves the room.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
peerUpdated
Event triggered when a Peer session information has been updated.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
persistentMessageState
Event triggered when persistent message state changes.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
readyStateChange
Event triggered when init()
method ready state changes.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
recordingState
Event triggered when recording session state has changed.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
roomLock
Event triggered when Room locked status has changed.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload Properties
|
- Source:
rtmpState
Event triggered when rtmp session state has changed.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
serverPeerJoined
Event triggered when a server Peer joins the room.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
serverPeerLeft
Event triggered when a server Peer leaves the room.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload Properties
|
- Source:
sessionDisconnect
Event triggered when Room session has ended abruptly due to network disconnections.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
socketError
Event triggered when attempt to establish socket connection to Signaling server has failed.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
storedMessages
Event triggered when receiving stored messages from the Signaling Server.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
streamEnded
Event triggered when a Peer Stream streaming has stopped. Note that it may not be the currently sent Stream to User, and it also triggers when User leaves the Room for any currently sent Stream to User from Peer.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
streamMuted
Event triggered when Peer Stream audio or video tracks has been muted / unmuted.
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source:
systemAction
Event triggered when Signaling server reaction state has changed.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
detail |
Object |
Event's payload. Properties
|
- Source: