Skylink Class
Defined in: source/template/header.js:132
Available since 0.5.0
Prerequisites on using Skylink
Before using any Skylink functionalities, you will need to authenticate your App Key using theinit()
method.
To manage or create App Keys, you may access the Skylink Developer Portal here.
To view the list of supported browsers, visit the list here.
Here are some articles to help you get started:
Here are some demos you may use to aid your development:
- Getaroom.io [Demo / Source code]
- Creating a component [Link]
You may see the example below in the Constructor tab to have a general idea how event subscription
and the ordering of init()
and
joinRoom()
methods should be called.
If you have any issues, you may find answers to your questions in the FAQ section on our support portal, asks questions, request features or raise bug tickets as well.
If you would like to contribute to our Temasys SkylinkJS codebase, see the contributing README.
Skylink
()
Example:
// Here's a simple example on how you can start using Skylink. var skylinkDemo = new Skylink();
// Subscribe all events first as a general guideline skylinkDemo.on("incomingStream", function (peerId, stream, peerInfo, isSelf) { if (isSelf) { attachMediaStream(document.getElementById("selfVideo"), stream); } else { var peerVideo = document.createElement("video"); peerVideo.id = peerId; peerVideo.autoplay = "autoplay"; document.getElementById("peersVideo").appendChild(peerVideo); attachMediaStream(peerVideo, stream); } });
skylinkDemo.on("peerLeft", function (peerId, peerInfo, isSelf) { if (!isSelf) { var peerVideo = document.getElementById(peerId); // do a check if peerVideo exists first if (peerVideo) { document.getElementById("peersVideo").removeChild(peerVideo); } else { console.error("Peer video for " + peerId + " is not found."); } } });
// init() should always be called first before other methods other than event methods like on() or off(). skylinkDemo.init("YOUR_APP_KEY_HERE", function (error, success) { if (success) { skylinkDemo.joinRoom("my_room", { userData: "My Username", audio: true, video: true }); } });
Events Sequence:
There is no event sequence for this method._ACKProtocolHandler
()
Function that handles the "ACK" data transfer protocol.
Events Sequence:
There is no event sequence for this method._addIceCandidate
()
Function that adds the ICE candidate to Peer connection.
Events Sequence:
There is no event sequence for this method._addIceCandidateFromQueue
()
Function that adds all the Peer connection buffered ICE candidates received. This should be called only after the remote session description is received and set.
Events Sequence:
There is no event sequence for this method._addIceCandidateToQueue
()
Function that buffers the Peer connection ICE candidate when received before remote session description is received and set.
Events Sequence:
There is no event sequence for this method._addLocalMediaStreams
()
Function that sets User's Stream to send to Peer connection.
Priority for shareScreen()
Stream over getUserMedia()
Stream.
Events Sequence:
There is no event sequence for this method._addPeer
()
Function that starts the Peer connection session. Remember to remove previous method of reconnection (re-creating the Peer connection - destroy and create connection).
Events Sequence:
There is no event sequence for this method._addSDPMediaStreamTrackIDs
()
Function that modifies the session description to append the MediaStream and MediaStreamTrack IDs that seems to be missing from Firefox answer session description to Chrome connection causing freezes in re-negotiation.
Events Sequence:
There is no event sequence for this method._answerHandler
()
Function that handles the "answer" socket message received.
See confluence docs for the "answer" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._approachEventHandler
()
Function that handles the "approach" socket message received.
See confluence docs for the "approach" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._base64ToBlob
()
Function that converts Base64 string into Blob object. This is referenced from devnull69@stackoverflow.com #6850276.
Events Sequence:
There is no event sequence for this method._blobToArrayBuffer
()
Function that converts a Blob object into ArrayBuffer object.
Events Sequence:
There is no event sequence for this method._blobToBase64
()
Function that converts a Blob object into Base64 string.
Events Sequence:
There is no event sequence for this method._byeHandler
()
Function that handles the "bye" socket message received.
See confluence docs for the "bye" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._CANCELProtocolHandler
()
Function that handles the "CANCEL" data transfer protocol.
Events Sequence:
There is no event sequence for this method._candidateHandler
()
Function that handles the "candidate" socket message received.
See confluence docs for the "candidate" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._chunkBlobData
()
Function that chunks Blob object based on the data chunk size provided.
If provided Blob object size is lesser than or equals to the chunk size, it should return an array
of length of 1
.
Events Sequence:
There is no event sequence for this method._chunkDataURL
()
Function that chunks large string into string chunks based on the data chunk size provided.
If provided string length is lesser than or equals to the chunk size, it should return an array
of length of 1
.
Events Sequence:
There is no event sequence for this method._clearAllStoredLogsFn
()
Function that clears the stored logs.
Events Sequence:
There is no event sequence for this method._closeChannel
()
Function that stops the socket connection to the Signaling.
Events Sequence:
There is no event sequence for this method._closeDataChannel
()
Function that stops the Datachannel connection and removes object references.
Events Sequence:
There is no event sequence for this method._condition
()
Function that checks if the current state condition is met before subscribing event handler to wait for condition to be fulfilled.
Events Sequence:
There is no event sequence for this method._createDataChannel
()
Function that starts a Datachannel connection with Peer.
Events Sequence:
There is no event sequence for this method._createPeerConnection
()
Function that creates the Peer connection.
Events Sequence:
There is no event sequence for this method._createSocket
()
Function that creates and opens a socket connection to the Signaling.
Events Sequence:
There is no event sequence for this method._DATAProtocolHandler
()
Function that handles the data transfer chunk received.
Events Sequence:
There is no event sequence for this method._doAnswer
()
Function that creates the Peer connection answer session description. This comes after receiving and setting the offer session description.
Events Sequence:
There is no event sequence for this method._doOffer
()
Function that creates the Peer connection offer session description.
Events Sequence:
There is no event sequence for this method._endOfCandidatesHandler
()
Function that handles the "endOfCandidates" socket message received.
See confluence docs for the "endOfCandidates" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._enterHandler
()
Function that handles the "enter" socket message received.
See confluence docs for the "enter" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._ERRORProtocolHandler
()
Function that handles the "ERROR" data transfer protocol.
Events Sequence:
There is no event sequence for this method._getSDPSelectedCodec
()
Function that retrieves the session description selected codec.
Events Sequence:
There is no event sequence for this method._getStoredLogsFn
()
Function that gets the stored logs.
Events Sequence:
There is no event sequence for this method._getTransferData
()
Function that returns the compiled data transfer data.
Events Sequence:
There is no event sequence for this method._getTransferInfo
()
Function that returns the data transfer session.
Events Sequence:
There is no event sequence for this method._getUserInfo
()
Function that returns the User session information to be sent to Peers.
Events Sequence:
There is no event sequence for this method._handleDataTransferTimeoutForPeer
()
Function that handles the data transfers sessions timeouts.
Events Sequence:
There is no event sequence for this method._handleEndedStreams
()
Function that handles ended streams.
Events Sequence:
There is no event sequence for this method._handleSDPConnectionSettings
()
Function that modifies the session description to handle the connection settings. This is experimental and never recommended to end-users.
Events Sequence:
There is no event sequence for this method._initSelectedRoom
()
Starts initialising for Room credentials for room name provided in joinRoom()
method.
Events Sequence:
There is no event sequence for this method._inRoomHandler
()
Function that handles the "inRoom" socket message received.
See confluence docs for the "inRoom" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._introduceErrorEventHandler
()
Function that handles the "introduceError" socket message received.
See confluence docs for the "introduceError" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._isLowerThanVersion
()
Function that compares the SM / DT protocol versions to see if it in the version.
Events Sequence:
There is no event sequence for this method._loadInfo
()
Loads and checks the dependencies if they are loaded correctly.
Events Sequence:
There is no event sequence for this method._logFn
()
Function that handles the logs received and prints in the Web Console interface according to the log level set.
Events Sequence:
There is no event sequence for this method._MESSAGEProtocolHandler
()
Function that handles the "MESSAGE" data transfer protocol.
Events Sequence:
There is no event sequence for this method._muteAudioEventHandler
()
Function that handles the "muteAudioEvent" socket message received.
See confluence docs for the "muteAudioEvent" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._muteStreams
()
Function that handles the muting of Stream audio and video tracks.
Events Sequence:
There is no event sequence for this method._muteVideoEventHandler
()
Function that handles the "muteVideoEvent" socket message received.
See confluence docs for the "muteVideoEvent" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._offerHandler
()
Function that handles the "offer" socket message received.
See confluence docs for the "offer" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._onIceCandidate
()
Function that handles the Peer connection gathered ICE candidate to be sent.
Events Sequence:
There is no event sequence for this method._onRemoteStreamAdded
()
Function that handles the RTCPeerConnection.onaddstream
remote MediaStream received.
Events Sequence:
There is no event sequence for this method._onStreamAccessError
()
Function that handles the native navigator.getUserMedia()
API failure callback result.
Events Sequence:
There is no event sequence for this method._onStreamAccessSuccess
()
Function that handles the native navigator.getUserMedia()
API success callback result.
Events Sequence:
There is no event sequence for this method._openChannel
()
Function that starts the socket connection to the Signaling. This starts creating the socket connection and called at first not when requiring to fallback.
Events Sequence:
There is no event sequence for this method._parseConnectionStats
()
Function that handles the stats tabulation.
Events Sequence:
There is no event sequence for this method._parseInfo
()
Parses the Room credentials information retrieved from API server.
Events Sequence:
There is no event sequence for this method._parseStreamSettings
()
Function that parses the getUserMedia()
settings provided.
Events Sequence:
There is no event sequence for this method._peerListEventHandler
()
Function that handles the "peerList" socket message received.
See confluence docs for the "peerList" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._printAllStoredLogsFn
()
Function that prints in the Web Console interface the stored logs.
Events Sequence:
There is no event sequence for this method._privateMessageHandler
()
Function that handles the "private" socket message received.
See confluence docs for the "private" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._processDataChannelData
()
Function that handles the data received from Datachannel and routes to the relevant data transfer protocol handler.
Events Sequence:
There is no event sequence for this method._processingSingleMessage
()
Function that handles and processes the socket message received.
Events Sequence:
There is no event sequence for this method._processSigMessage
()
Function that process and parses the socket message string received from the Signaling.
Events Sequence:
There is no event sequence for this method._publicMessageHandler
()
Function that handles the "public" socket message received.
See confluence docs for the "public" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._recordingEventHandler
message
,
)
Handles the RECORDING Protocol message event received from the platform signaling.
Events Sequence:
There is no event sequence for this method.Parameters:
-
message
{JSON}The message object received from platform signaling. This should contain the
RECORDING
payload.-
url
{String}The recording URL if mixing has completed.
-
action
{String}The recording action received.
-
error
{String}The recording error exception received.
-
_redirectHandler
()
Function that handles the "redirect" socket message received.
See confluence docs for the "redirect" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._refreshPeerConnection
()
Function that refresh connections.
Events Sequence:
There is no event sequence for this method._removePeer
()
Function that ends the Peer connection session.
Events Sequence:
There is no event sequence for this method._removeSDPCodecs
()
Function that modifies the session description to remove codecs.
Events Sequence:
There is no event sequence for this method._removeSDPFilteredCandidates
()
Function that modifies the session description to remove non-relay ICE candidates.
Events Sequence:
There is no event sequence for this method._removeSDPFirefoxH264Pref
()
Function that modifies the session description to remove the previous experimental H264 codec that is apparently breaking connections. NOTE: We should perhaps not remove it since H264 is supported?
Events Sequence:
There is no event sequence for this method._removeSDPH264VP9AptRtxForOlderPlugin
()
Function that modifies the session description to remove VP9 and H264 apt/rtx lines to prevent plugin connection breaks.
Events Sequence:
There is no event sequence for this method._removeSDPREMBPackets
()
Function that modifies the session description to remove REMB packets fb.
Events Sequence:
There is no event sequence for this method._requestServerInfo
()
Starts retrieving Room credentials information from API server.
Events Sequence:
There is no event sequence for this method._restartHandler
()
Function that handles the "restart" socket message received.
See confluence docs for the "restart" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._restartMCUConnection
()
Function that handles the _restartPeerConnection
scenario
for MCU enabled Peer connections.
This is implemented currently by making the user leave and join the Room again.
The Peer ID will not stay the same though.
Events Sequence:
There is no event sequence for this method._restartPeerConnection
()
Function that re-negotiates a Peer connection. Remember to remove previous method of reconnection (re-creating the Peer connection - destroy and create connection).
Events Sequence:
There is no event sequence for this method._roomLockEventHandler
()
Function that handles the "roomLockEvent" socket message received.
See confluence docs for the "roomLockEvent" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._sendChannelMessage
()
Function that sends a socket message over the socket connection to the Signaling.
Events Sequence:
There is no event sequence for this method._sendMessageToDataChannel
()
Function that sends data over the Datachannel connection.
Events Sequence:
There is no event sequence for this method._setIceServers
()
Function that filters and configures the ICE servers received from Signaling
based on the init()
configuration and returns the updated
list of ICE servers to be used when constructing Peer connection.
Events Sequence:
There is no event sequence for this method._setLocalAndSendMessage
()
Function that sets the local session description and sends to Peer. If trickle ICE is disabled, the local session description will be sent after ICE gathering has been completed.
Events Sequence:
There is no event sequence for this method._setSDPBitrate
()
Function that modifies the session description to limit the maximum sending bandwidth. Setting this may not necessarily work in Firefox.
Events Sequence:
There is no event sequence for this method._setSDPCodec
()
Function that modifies the session description to set the preferred audio/video codec.
Events Sequence:
There is no event sequence for this method._setSDPOpusConfig
()
Function that modifies the session description to configure settings for OPUS audio codec.
Events Sequence:
There is no event sequence for this method._signalingEndOfCandidates
()
Function that signals the end-of-candidates flag.
Events Sequence:
There is no event sequence for this method._startDataTransfer
()
Function that starts the data transfer to Peers.
Events Sequence:
There is no event sequence for this method._startDataTransferToPeer
()
Function that starts or listens the data transfer status to Peer. This reacts differently during MCU environment.
Events Sequence:
There is no event sequence for this method.Returns:
Returns a Boolean only during MCU environment which flag indicates if Peer requires interop (Use messaging Datachannel connection instead).
_stopStreams
()
Function that handles stopping the Stream streaming.
Events Sequence:
There is no event sequence for this method._streamEventHandler
()
Function that handles the "stream" socket message received.
See confluence docs for the "stream" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._throttle
()
Function that throttles a method function to prevent multiple invokes over a specified amount of time.
Returns a function to be invoked ._throttle(fn, 1000)()
to make throttling functionality work.
Events Sequence:
There is no event sequence for this method._trigger
()
Function that triggers an event.
The rest of the parameters after the eventName
parameter is considered as the event parameter payloads.
Events Sequence:
There is no event sequence for this method._updateUserEventHandler
()
Function that handles the "updateUserEvent" socket message received.
See confluence docs for the "updateUserEvent" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._wait
()
Function that starts an interval check to wait for a condition to be resolved.
Events Sequence:
There is no event sequence for this method._waitForOpenChannel
()
Function that waits for Socket connection to Signaling to be opened.
Events Sequence:
There is no event sequence for this method._welcomeHandler
()
Function that handles the "welcome" socket message received.
See confluence docs for the "welcome" expected properties to be received
based on the current SM_PROTOCOL_VERSION
.
Events Sequence:
There is no event sequence for this method._WRQProtocolHandler
()
Function that handles the "WRQ" data transfer protocol.
Events Sequence:
There is no event sequence for this method.acceptDataTransfer
peerId
,
transferId
,
[accept=false]
,
)
Function that accepts or rejects an upload data transfer request from Peer to User.
Example:
// Example 1: Accept Peer upload data transfer request skylinkDemo.on("incomingDataRequest", function (transferId, peerId, transferInfo, isSelf) { if (!isSelf) { skylinkDemo.acceptDataTransfer(peerId, transferId, true); } });
// Example 2: Reject Peer upload data transfer request skylinkDemo.on("incomingDataRequest", function (transferId, peerId, transferInfo, isSelf) { if (!isSelf) { skylinkDemo.acceptDataTransfer(peerId, transferId, false); } });
Events Sequence:
Event sequence followssendBlobData()
method after acceptDataTransfer()
method is invoked.
Parameters:
-
peerId
{String}The Peer ID.
-
transferId
{String}The data transfer ID.
-
accept
{Boolean} OptionalDEFAULT:false
The flag if User accepts the upload data transfer request from Peer.
cancelDataTransfer
peerId
,
transferId
,
)
For MCU enabled Peer connections, the cancel data transfer functionality may differ, as it will result in all Peers related to the data transfer ID to be terminated.Function that terminates a currently uploading / downloading data transfer from / to Peer.
Example:
// Example 1: Cancel Peer data transfer var transferSessions = {};
skylinkDemo.on("dataTransferState", function (state, transferId, peerId) { if ([skylinkDemo.DATA_TRANSFER_STATE.DOWNLOAD_STARTED, skylinkDemo.DATA_TRANSFER_STATE.UPLOAD_STARTED].indexOf(state) > -1) { if (!Array.isArray(transferSessions[transferId])) { transferSessions[transferId] = []; } transferSessions[transferId].push(peerId); } else { transferSessions[transferId].splice(transferSessions[transferId].indexOf(peerId), 1); } });
function cancelTransfer (peerId, transferId) { skylinkDemo.cancelDataTransfer(peerId, transferId); }
Events Sequence:
Event sequence followssendBlobData()
method after cancelDataTransfer()
method is invoked.
Parameters:
-
peerId
{String}The Peer ID.
-
transferId
{String}The data transfer ID.
disableAudio
()
Deprecation Warning!
This method has been deprecated. Use muteStream()
method instead.
Function that mutes both getUserMedia()
Stream and
shareScreen()
Stream audio tracks.
Example:
function muteAudio () { skylinkDemo.disableAudio(); }
Events Sequence:
- Invokes
muteStream()
method withoptions.audioMuted
value astrue
andoptions.videoMuted
value with currentpeerInfo.mediaStatus.videoMuted
value. SeegetPeerInfo()
method for more information.
disableVideo
()
Deprecation Warning!
This method has been deprecated. Use muteStream()
method instead.
Function that mutes both getUserMedia()
Stream and
shareScreen()
Stream video tracks.
Example:
function muteVideo () { skylinkDemo.disableVideo(); }
Events Sequence:
- Invokes
muteStream()
method withoptions.videoMuted
value astrue
andoptions.audioMuted
value with currentpeerInfo.mediaStatus.audioMuted
value. SeegetPeerInfo()
method for more information.
enableAudio
()
Deprecation Warning!
This method has been deprecated. Use muteStream()
method instead.
Function that unmutes both getUserMedia()
Stream and
shareScreen()
Stream audio tracks.
Example:
function unmuteAudio () { skylinkDemo.enableAudio(); }
Events Sequence:
- Invokes
muteStream()
method withoptions.audioMuted
value asfalse
andoptions.videoMuted
value with currentpeerInfo.mediaStatus.videoMuted
value. SeegetPeerInfo()
method for more information.
enableVideo
()
Deprecation Warning!
This method has been deprecated. Use muteStream()
method instead.
Function that unmutes both getUserMedia()
Stream and
shareScreen()
Stream video tracks.
Example:
function unmuteVideo () { skylinkDemo.enableVideo(); }
Events Sequence:
- Invokes
muteStream()
method withoptions.videoMuted
value asfalse
andoptions.audioMuted
value with currentpeerInfo.mediaStatus.audioMuted
value. SeegetPeerInfo()
method for more information.
generateUUID
()
Function that generates an UUID (Unique ID).
Events Sequence:
There is no event sequence for this method.Returns:
Returns a generated UUID (Unique ID).
getConnectionStatus
[targetPeerId]
,
[callback]
,
)
Function that retrieves Peer connection bandwidth and ICE connection stats.
Example:
// Example 1: Retrieve a Peer connection stats function startBWStatsInterval (peerId) { setInterval(function () { skylinkDemo.getConnectionStatus(peerId, function (error, success) { if (error) return; var sendVideoBytes = success.connectionStats[peerId].video.sending.bytes; var sendAudioBytes = success.connectionStats[peerId].audio.sending.bytes; var recvVideoBytes = success.connectionStats[peerId].video.receiving.bytes; var recvAudioBytes = success.connectionStats[peerId].audio.receiving.bytes; var localCandidate = success.connectionStats[peerId].selectedCandidate.local; var remoteCandidate = success.connectionStats[peerId].selectedCandidate.remote; console.log("Sending audio (" + sendAudioBytes + "bps) video (" + sendVideoBytes + ")"); console.log("Receiving audio (" + recvAudioBytes + "bps) video (" + recvVideoBytes + ")"); console.log("Local candidate: " + localCandidate.ipAddress + ":" + localCandidate.portNumber + "?transport=" + localCandidate.transport + " (type: " + localCandidate.candidateType + ")"); console.log("Remote candidate: " + remoteCandidate.ipAddress + ":" + remoteCandidate.portNumber + "?transport=" + remoteCandidate.transport + " (type: " + remoteCandidate.candidateType + ")"); }); }, 1000); }
// Example 2: Retrieve a list of Peer connection stats function printConnStats (peerId, data) { if (!data.connectionStats[peerId]) return; var sendVideoBytes = data.connectionStats[peerId].video.sending.bytes; var sendAudioBytes = data.connectionStats[peerId].audio.sending.bytes; var recvVideoBytes = data.connectionStats[peerId].video.receiving.bytes; var recvAudioBytes = data.connectionStats[peerId].audio.receiving.bytes; var localCandidate = data.connectionStats[peerId].selectedCandidate.local; var remoteCandidate = data.connectionStats[peerId].selectedCandidate.remote; console.log(peerId + " - Sending audio (" + sendAudioBytes + "bps) video (" + sendVideoBytes + ")"); console.log(peerId + " - Receiving audio (" + recvAudioBytes + "bps) video (" + recvVideoBytes + ")"); console.log(peerId + " - Local candidate: " + localCandidate.ipAddress + ":" + localCandidate.portNumber + "?transport=" + localCandidate.transport + " (type: " + localCandidate.candidateType + ")"); console.log(peerId + " - Remote candidate: " + remoteCandidate.ipAddress + ":" + remoteCandidate.portNumber + "?transport=" + remoteCandidate.transport + " (type: " + remoteCandidate.candidateType + ")"); }
function startBWStatsInterval (peerIdA, peerIdB) { setInterval(function () { skylinkDemo.getConnectionStatus([peerIdA, peerIdB], function (error, success) { if (error) { printConnStats(peerIdA, error.connectionStats); printConnStats(peerIdB, error.connectionStats); } else { printConnStats(peerIdA, success.connectionStats); printConnStats(peerIdB, success.connectionStats); } }); }, 1000); }
// Example 3: Retrieve all Peer connection stats function printConnStats (listOfPeers, data) { listOfPeers.forEach(function (peerId) { if (!data.connectionStats[peerId]) return; var sendVideoBytes = data.connectionStats[peerId].video.sending.bytes; var sendAudioBytes = data.connectionStats[peerId].audio.sending.bytes; var recvVideoBytes = data.connectionStats[peerId].video.receiving.bytes; var recvAudioBytes = data.connectionStats[peerId].audio.receiving.bytes; var localCandidate = data.connectionStats[peerId].selectedCandidate.local; var remoteCandidate = data.connectionStats[peerId].selectedCandidate.remote; console.log(peerId + " - Sending audio (" + sendAudioBytes + "bps) video (" + sendVideoBytes + ")"); console.log(peerId + " - Receiving audio (" + recvAudioBytes + "bps) video (" + recvVideoBytes + ")"); console.log(peerId + " - Local candidate: " + localCandidate.ipAddress + ":" + localCandidate.portNumber + "?transport=" + localCandidate.transport + " (type: " + localCandidate.candidateType + ")"); console.log(peerId + " - Remote candidate: " + remoteCandidate.ipAddress + ":" + remoteCandidate.portNumber + "?transport=" + remoteCandidate.transport + " (type: " + remoteCandidate.candidateType + ")"); }); }
function startBWStatsInterval (peerIdA, peerIdB) { setInterval(function () { skylinkDemo.getConnectionStatus(function (error, success) { if (error) { printConnStats(error.listOfPeers, error.connectionStats); } else { printConnStats(success.listOfPeers, success.connectionStats); } }); }, 1000); }
Events Sequence:
- Retrieves Peer connection stats for all targeted Peers.
- If Peer connection has closed or does not exists: This can be checked with
peerConnectionState
event triggering parameter payloadstate
asCLOSED
for Peer.-
getConnectionStatusStateChange
event triggers parameter payloadstate
asRETRIEVE_ERROR
. - ABORT and return error.
-
getConnectionStatusStateChange
event triggers parameter payloadstate
asRETRIEVING
.- Received response from retrieval.
- If retrieval was successful:
getConnectionStatusStateChange
event triggers parameter payloadstate
asRETRIEVE_SUCCESS
.
- Else:
-
getConnectionStatusStateChange
event triggers parameter payloadstate
asRETRIEVE_ERROR
.
-
- If retrieval was successful:
- If Peer connection has closed or does not exists: This can be checked with
Parameters:
-
targetPeerId
{String | Array} OptionalThe target Peer ID to retrieve connection stats from.
- When provided as an Array, it will retrieve all connection stats from all the Peer IDs provided.
- When not provided, it will retrieve all connection stats from the currently connected Peers in the Room.
-
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by thegetConnectionStatusStateChange
event triggeringstate
parameter payload value asRETRIEVE_SUCCESS
for all Peers targeted for request success. [Rel: Skylink.GET_CONNECTION_STATUS_STATE]-
error
{JSON}The error result in request. Defined as
null
when there are no errors in request-
listOfPeers
{Array}The list of Peer IDs targeted. -
retrievalErrors
{JSON}The list of Peer connection stats retrieval errors. -
retrievalErrors.#peerId
{Error | String}The Peer connection stats retrieval error associated with the Peer ID defined in#peerId
property. If#peerId
value is"self"
, it means that it is the error when there are no Peer connections to refresh with. -
connectionStats
{JSON}The list of Peer connection stats. These are the Peer connection stats that has been managed to be successfully retrieved. -
connectionStats.#peerId
{JSON}The Peer connection stats associated with the Peer ID defined in#peerId
property. Object signature matches thestats
parameter payload received in thegetConnectionStatusStateChange
event.
-
-
success
{JSON}The success result in request. Defined as
null
when there are errors in request-
listOfPeers
{Array}The list of Peer IDs targeted. -
connectionStats
{JSON}The list of Peer connection stats. -
connectionStats.#peerId
{JSON}The Peer connection stats associated with the Peer ID defined in#peerId
property. Object signature matches thestats
parameter payload received in thegetConnectionStatusStateChange
event.
-
-
getPeerInfo
[peerId]
,
)
Function that returns the User / Peer current session information.
Example:
// Example 1: Get Peer current session information var peerPeerInfo = skylinkDemo.getPeerInfo(peerId);
// Example 2: Get User current session information var userPeerInfo = skylinkDemo.getPeerInfo();
Events Sequence:
There is no event sequence for this method.Parameters:
-
peerId
{String} OptionalThe Peer ID to return the current session information from.
- When not provided or that the Peer ID is does not exists, it will return the User current session information.
Returns:
The User / Peer current session information.
Object signature matches the peerInfo
parameter payload received in the
peerJoined
event.
getPeers
[showAll=false]
,
[callback]
,
)
Note that this feature requiresFunction that retrieves the list of Peer IDs from Rooms within the same App space."isPrivileged"
flag to be enabled for the App Key provided in theinit()
method, as only Users connecting using the App Key with this flag enabled (which we call privileged Users / Peers) can retrieve the list of Peer IDs from Rooms within the same App space. Read more about privileged App Key feature here.
Example:
// Example 1: Retrieving the un-privileged Peers skylinkDemo.joinRoom(function (jRError, jRSuccess) { if (jRError) return; skylinkDemo.getPeers(function (error, success) { if (error) return; console.log("The list of only un-privileged Peers in the same App space ->", success); }); });
// Example 2: Retrieving the all Peers (privileged or un-privileged) skylinkDemo.joinRoom(function (jRError, jRSuccess) { if (jRError) return; skylinkDemo.getPeers(true, function (error, success) { if (error) return; console.log("The list of all Peers in the same App space ->", success); }); });
Events Sequence:
- If App Key provided in the
init()
method is not a Privileged enabled Key:- ABORT and return error.
- Retrieves the list of Peer IDs from Rooms within the same App space.
getPeersStateChange
event triggers parameter payloadstate
value asENQUIRED
.- If received list from Signaling server successfully:
getPeersStateChange
event triggers parameter payloadstate
value asRECEIVED
.
Parameters:
-
showAll
{Boolean} OptionalDEFAULT:false
The flag if Signaling server should also return the list of privileged Peer IDs. By default, the Signaling server does not include the list of privileged Peer IDs in the return result.
-
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by thegetPeersStateChange
event triggeringstate
parameter payload value asRECEIVED
for request success. [Rel: Skylink.GET_PEERS_STATE]-
error
{Error | String}The error result in request. Defined as
null
when there are no errors in request Object signature is thegetPeers()
error when retrieving list of Peer IDs from Rooms within the same App space. -
success
{JSON}The success result in request. Defined as
null
when there are errors in request Object signature matches thepeerList
parameter payload received in thegetPeersStateChange
event.
-
getPeersInRoom
()
Function that gets the list of connected Peers in the Room.
Example:
// Example 1: Get the list of currently connected Peers in the same Room var peers = skylinkDemo.getPeersInRoom();
Events Sequence:
There is no event sequence for this method.Returns:
The list of connected Peers.
#peerId
{JSON}The Peer information. Object signature matches the
peerInfo
parameter payload received in thepeerJoined
event except there is theisSelf
flag that determines if Peer is User or not.
getPeersStream
()
Function that gets the list of connected Peers Streams in the Room.
Example:
// Example 1: Get the list of currently connected Peers in the same Room var streams = skylinkDemo.getPeersStream();
Events Sequence:
There is no event sequence for this method.Returns:
The list of Peers Stream.
#peerId
{JSON}The Peer Stream.
stream
{MediaStream}The Stream object.
streamId
{String}The Stream ID.
isSelf
{Boolean}The flag if Peer is User.
getRecordings
()
Note that this feature requires MCU and recording to be enabled for the App Key provided in the
init()
method. If recording feature is not available to
be enabled in the Developer Console, please
contact us on our support portal.
Gets the list of current recording sessions since User has connected to the Room.
Example:
// Example 1: Get recording sessions skylinkDemo.getRecordings();
Events Sequence:
There is no event sequence for this method.Returns:
The list of recording sessions.
#recordingId
{JSON}The recording session.
active
{Boolean}The flag that indicates if the recording session is currently active.
state
{Number}The current recording state. [Rel: Skylink.RECORDING_STATE]
startedDateTime
{String}The recording session started DateTime in ISO 8601 format.Note that this value may not be very accurate as this value is recorded when the start event is received.
endedDateTime
{String}The recording session ended DateTime in ISO 8601 format.Note that this value may not be very accurate as this value is recorded when the stop event is received. Defined only after
state
has triggeredSTOP
.mixingDateTime
{String}The recording session mixing completed DateTime in ISO 8601 format.Note that this value may not be very accurate as this value is recorded when the mixing completed event is received. Defined only when
state
isLINK
.links
{JSON}The recording session links. Object signature matches the
link
parameter payload received in therecordingState
event. Defined only whenstate
isLINK
.error
{Error}The recording session error. Defined only when
state
isERROR
.
getUserData
[peerId]
,
)
Function that returns the User / Peer current custom data.
Example:
// Example 1: Get Peer current custom data var peerUserData = skylinkDemo.getUserData(peerId);
// Example 2: Get User current custom data var userUserData = skylinkDemo.getUserData();
Events Sequence:
There is no event sequence for this method.Parameters:
-
peerId
{String} OptionalThe Peer ID to return the current custom data from.
- When not provided or that the Peer ID is does not exists, it will return the User current custom data.
Returns:
The User / Peer current custom data.
getUserMedia
[options]
,
[callback]
,
)
For a better user experience, the functionality is throttled when invoked many times in less
than the milliseconds interval configured in the init()
method.
Function that retrieves camera Stream.
Example:
// Example 1: Get both audio and video. skylinkDemo.getUserMedia(function (error, success) { if (error) return; attachMediaStream(document.getElementById("my-video"), success); });
// Example 2: Get only audio. skylinkDemo.getUserMedia({ audio: true }, function (error, success) { if (error) return; attachMediaStream(document.getElementById("my-audio"), success); });
// Example 3: Configure resolution for video skylinkDemo.getUserMedia({ audio: true, video: { resolution: skylinkDemo.VIDEO_RESOLUTION.HD } }, function (error, success) { if (error) return; attachMediaStream(document.getElementById("my-video"), success); });
// Example 4: Configure stereo flag for OPUS codec audio (OPUS is always used by default) skylinkDemo.init({ appKey: "xxxxxx", audioCodec: skylinkDemo.AUDIO_CODEC.OPUS }, function (initErr, initSuccess) { skylinkDemo.getUserMedia({ audio: { stereo: true }, video: true }, function (error, success) { if (error) return; attachMediaStream(document.getElementById("my-video"), success); }); });
// Example 5: Configure frameRate for video skylinkDemo.getUserMedia({ audio: true, video: { frameRate: 50 } }, function (error, success) { if (error) return; attachMediaStream(document.getElementById("my-video"), success); });
// Example 6: Configure video and audio based on selected sources. Does not work for Firefox currently. var sources = { audio: [], video: [] };
function selectStream (audioSourceId, videoSourceId) { if (window.webrtcDetectedBrowser === 'firefox') { console.warn("Currently this feature is not supported by Firefox browsers!"); return; } skylinkDemo.getUserMedia({ audio: { optional: [{ sourceId: audioSourceId }] }, video: { optional: [{ sourceId: videoSourceId }] } }, function (error, success) { if (error) return; attachMediaStream(document.getElementById("my-video"), success); }); }
navigator.mediaDevices.enumerateDevices().then(function(devices) { var selectedAudioSourceId = ""; var selectedVideoSourceId = ""; devices.forEach(function(device) { console.log(device.kind + ": " + device.label + " source ID = " + device.deviceId); if (device.kind === "audio") { selectedAudioSourceId = device.deviceId; } else { selectedVideoSourceId = device.deviceId; } }); selectStream(selectedAudioSourceId, selectedVideoSourceId); }).catch(function (error) { console.error("Failed", error); });
Events Sequence:
- If
options.audio
value isfalse
andoptions.video
value isfalse
:- ABORT and return error.
- Retrieve camera Stream.
- If retrieval was succesful:
- If there is any previous
getUserMedia()
Stream:- Invokes
stopStream()
method.
- Invokes
- If there are missing audio or video tracks requested:
mediaAccessFallback
event triggers parameter payloadstate
asFALLBACKED
,isScreensharing
value asfalse
andisAudioFallback
value asfalse
.
- Mutes / Unmutes audio and video tracks based on current muted settings in
peerInfo.mediaStatus
. This can be retrieved withgetPeerInfo()
method. mediaAccessSuccess
event triggers parameter payloadisScreensharing
value asfalse
andisAudioFallback
value asfalse
.
- If there is any previous
- Else:
- If
options.audioFallback
is enabled in theinit()
method,options.audio
value istrue
andoptions.video
value istrue
:mediaAccessFallback
event event triggers parameter payloadstate
asFALLBACKING
,isScreensharing
value asfalse
andisAudioFallback
value astrue
.- Retrieve camera Stream with audio tracks only.
- If retrieval was successful:
- If there is any previous
getUserMedia()
Stream:- Invokes
stopStream()
method.
- Invokes
mediaAccessFallback
event event triggers parameter payloadstate
asFALLBACKED
,isScreensharing
value asfalse
andisAudioFallback
value astrue
.- Mutes / Unmutes audio and video tracks based on current muted settings in
peerInfo.mediaStatus
. This can be retrieved withgetPeerInfo()
method. mediaAccessSuccess
event triggers parameter payloadisScreensharing
value asfalse
andisAudioFallback
value astrue
.
- If there is any previous
- Else:
mediaAccessError
event triggers parameter payloadisScreensharing
value asfalse
andisAudioFallbackError
value astrue
.mediaAccessFallback
event event triggers parameter payloadstate
asERROR
,isScreensharing
value asfalse
andisAudioFallback
value astrue
.- ABORT and return error.
- If retrieval was successful:
- Else:
mediaAccessError
event triggers parameter payloadisScreensharing
value asfalse
andisAudioFallbackError
value asfalse
.- ABORT and return error.
- If
- If retrieval was succesful:
Parameters:
-
options
{JSON} OptionalThe camera Stream configuration options.
- When not provided, the value is set to
{ audio: true, video: true }
. To fallback to retrieve audio track only when retrieving of audio and video tracks failed, enable theaudioFallback
flag in theinit()
method.
-
useExactConstraints
{Boolean} OptionalDEFAULT:false
Note that by enabling this flag, exact values will be requested when retrieving camera Stream, but it does not prevent constraints related errors. By default when not enabled, expected mandatory maximum values (or optional values for source ID) will requested to prevent constraints related errors, with an exception for
The flag ifoptions.video.frameRate
option in Safari and IE (any plugin-enabled) browsers, where the expected maximum value will not be requested due to the lack of support.getUserMedia()
should request for camera Stream to match exact requested values ofoptions.audio.deviceId
andoptions.video.deviceId
,options.video.resolution
andoptions.video.frameRate
when provided. -
audio
{Boolean | JSON} OptionalDEFAULT:false
The audio configuration options.
-
stereo
{Boolean} OptionalDEFAULT:false
The flag if stereo band should be configured when encoding audio codec isOPUS
for sending / receiving audio data. Note that Peers may override the "receiving"stereo
config depending on the Peers configuration. -
usedtx
{Boolean} OptionalNote that this feature might not work depending on the browser support and implementation.
The flag if DTX (Discontinuous Transmission) should be configured when encoding audio codec isOPUS
for sending / receiving audio data. This might help to reduce bandwidth it reduces the bitrate during silence or background noise. When not provided, the default browser configuration is used. Note that Peers may override the "receiving"usedtx
config depending on the Peers configuration. -
useinbandfec
{Boolean} OptionalNote that this feature might not work depending on the browser support and implementation.
The flag if capability to take advantage of in-band FEC (Forward Error Correction) should be configured when encoding audio codec isOPUS
for sending / receiving audio data. This might help to reduce the harm of packet loss by encoding information about the previous packet. When not provided, the default browser configuration is used. Note that Peers may override the "receiving"useinbandfec
config depending on the Peers configuration. -
maxplaybackrate
{Number} OptionalNote that this feature might not work depending on the browser support and implementation.
The maximum output sampling rate rendered in Hertz (Hz) when encoding audio codec isOPUS
for sending / receiving audio data. This value must be between8000
to48000
. When not provided, the default browser configuration is used. Note that Peers may override the "receiving"maxplaybackrate
config depending on the Peers configuration. -
mute
{Boolean} OptionalDEFAULT:false
The flag if audio tracks should be muted upon receiving them. Providing the value asfalse
does nothing topeerInfo.mediaStatus.audioMuted
, but when provided astrue
, this sets thepeerInfo.mediaStatus.audioMuted
value totrue
and mutes any existingshareScreen()
Stream audio tracks as well. -
optional
{Array} OptionalNote that this may result in constraints related error when
Theoptions.useExactConstraints
value istrue
. If you are looking to set the requested source ID of the audio track, useoptions.audio.deviceId
instead.navigator.getUserMedia()
APIaudio: { optional [..] }
property. -
deviceId
{String} OptionalNote this is currently not supported in Firefox browsers.
The audio track source ID of the device to use. The list of available audio source ID can be retrieved by thenavigator.mediaDevices.enumerateDevices
API. -
echoCancellation
{Boolean} OptionalDEFAULT:false
The flag to enable audio tracks echo cancellation.
-
-
video
{Boolean | JSON} OptionalDEFAULT:false
The video configuration options.
-
mute
{Boolean} OptionalDEFAULT:false
The flag if video tracks should be muted upon receiving them. Providing the value asfalse
does nothing topeerInfo.mediaStatus.videoMuted
, but when provided astrue
, this sets thepeerInfo.mediaStatus.videoMuted
value totrue
and mutes any existingshareScreen()
Stream video tracks as well. -
resolution
{JSON} OptionalThe video resolution. By default,VGA
resolution option is selected when not provided. [Rel: Skylink.VIDEO_RESOLUTION] -
resolution.width
{Number | JSON} OptionalThe video resolution width. - When provided as a number, it is the video resolution width. - When provided as a JSON, it is thenavigator.mediaDevices.getUserMedia()
.width
settings. Parameters are"ideal"
for ideal resolution width,"exact"
for exact video resolution width,"min"
for min video resolution width and"max"
for max video resolution width. Note that this may result in constraints related errors depending on the browser/hardware supports. -
resolution.height
{Number | JSON} OptionalThe video resolution height. - When provided as a number, it is the video resolution height. - When provided as a JSON, it is thenavigator.mediaDevices.getUserMedia()
.height
settings. Parameters are"ideal"
for ideal video resolution height,"exact"
for exact video resolution height,"min"
for min video resolution height and"max"
for max video resolution height. Note that this may result in constraints related errors depending on the browser/hardware supports. -
frameRate
{Number | JSON} OptionalThe video frameRate per second (fps). - When provided as a number, it is the video framerate. - When provided as a JSON, it is thenavigator.mediaDevices.getUserMedia()
.frameRate
settings. Parameters are"ideal"
for ideal video framerate,"exact"
for exact video framerate,"min"
for min video framerate and"max"
for max video framerate. Note that this may result in constraints related errors depending on the browser/hardware supports. -
optional
{Array} OptionalNote that this may result in constraints related error when
Theoptions.useExactConstraints
value istrue
. If you are looking to set the requested source ID of the video track, useoptions.video.deviceId
instead.navigator.getUserMedia()
APIvideo: { optional [..] }
property. -
deviceId
{String} OptionalNote this is currently not supported in Firefox browsers.
The video track source ID of the device to use. The list of available video source ID can be retrieved by thenavigator.mediaDevices.enumerateDevices
API.
-
- When not provided, the value is set to
-
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by themediaAccessSuccess
event triggeringisScreensharing
parameter payload value asfalse
for request success.-
error
{Error | String}The error result in request. Defined as
null
when there are no errors in request Object signature is thegetUserMedia()
error when retrieving camera Stream. -
success
{MediaStream}The success result in request. Defined as
null
when there are errors in request Object signature is the camera Stream object.
-
init
options
,
[callback]
,
)
Function that authenticates and initialises App Key used for Room connections.
Example:
// Example 1: Using CORS authentication and connection to default Room skylinkDemo(appKey, function (error, success) { if (error) return; skylinkDemo.joinRoom(); // Goes to default Room });
// Example 2: Using CORS authentication and connection to a different Room skylinkDemo(appKey, function (error, success) { skylinkDemo.joinRoom("testxx"); // Goes to "testxx" Room });
// Example 3: Using credentials authentication and connection to only default Room var defaultRoom = "test", startDateTime = (new Date()).toISOString(), duration = 1, // Allows only User session to stay for 1 hour appKeySecret = "xxxxxxx", hash = CryptoJS.HmacSHA1(defaultRoom + "" + duration + "" + startDateTime, appKeySecret); credentials = encodeURIComponent(hash.toString(CryptoJS.enc.Base64));
skylinkDemo({ defaultRoom: defaultRoom, appKey: appKey, credentials: { duration: duration, startDateTime: startDateTime, credentials: credentials } }, function (error, success) { if (error) return; skylinkDemo.joinRoom(); // Goes to default Room (switching to different Room is not allowed for credentials authentication) });
Events Sequence:
- If parameter
options
is not provided:- ABORT and return error.
- Checks if dependecies and browser APIs are available.
- If AdapterJS is not loaded:
readyStateChange
event triggers parameter payloadstate
asERROR
anderror.errorCode
asADAPTER_NO_LOADED
.- ABORT and return error.
- If socket.io-client is not loaded:
-
readyStateChange
event triggers parameter payloadstate
asERROR
anderror.errorCode
asNO_SOCKET_IO
. - ABORT and return error.
-
- If XMLHttpRequest API is not available:
-
readyStateChange
event triggers parameter payloadstate
asERROR
anderror.errorCode
asNO_XMLHTTPREQUEST_SUPPORT
. - ABORT and return error.
-
- If WebRTC is not supported by device:
readyStateChange
event triggers parameter payloadstate
asERROR
anderror.errorCode
asNO_WEBRTC_SUPPORT
.- ABORT and return error.
- If AdapterJS is not loaded:
- Retrieves Room session token from Auth server.
readyStateChange
event triggers parameter payloadstate
asLOADING
.- If retrieval was successful:
readyStateChange
event triggers parameter payloadstate
asCOMPLETED
.
- Else:
readyStateChange
event triggers parameter payloadstate
asERROR
.- ABORT and return error.
Parameters:
-
options
{JSON | String}The configuration options.
- When provided as a string, it's configured as
options.appKey
.
-
appKey
{String}The App Key. By default,
init()
uses HTTP CORS authentication. For credentials based authentication, see theoptions.credentials
configuration below. You can know more about the in the authentication methods article here for more details on the various authentication methods. If you are using the Persistent Room feature for scheduled meetings, you will require to use the credential based authentication. See the Persistent Room article here for more information. -
defaultRoom
{String} OptionalThe default Room to connect to when no
room
parameter is provided injoinRoom()
method.- When not provided or is provided as an empty string, its value is
options.appKey
. Note that switching Rooms is not available when usingoptions.credentials
based authentication. The Room that User will be connected to is thedefaultRoom
provided.
- When not provided or is provided as an empty string, its value is
-
roomServer
{String} OptionalThe Auth server. Note that this is a debugging feature and is only used when instructed for debugging purposes.
-
enableIceTrickle
{Boolean} OptionalDEFAULT:true
The flag if Peer connections should trickle ICE for faster connectivity.
-
enableDataChannel
{Boolean} OptionalDEFAULT:true
The flag if Datachannel connections should be enabled. This is required to be enabled for
sendBlobData()
method,sendURLData()
method andsendP2PMessage()
method. -
enableTURNServer
{Boolean} OptionalDEFAULT:true
The flag if TURN ICE servers should be used when constructing Peer connections to allow TURN connections when required and enabled for the App Key.
-
enableSTUNServer
{Boolean} OptionalDEFAULT:true
The flag if STUN ICE servers should be used when constructing Peer connections to allow TURN connections when required.
-
forceTURN
{Boolean} OptionalDEFAULT:false
The flag if Peer connections should enforce connections over the TURN server. This overrides
options.enableTURNServer
value totrue
andoptions.enableSTUNServer
value tofalse
,options.filterCandidatesType.host
value totrue
,options.filterCandidatesType.srflx
value totrue
andoptions.filterCandidatesType.relay
value tofalse
. Note that currently for MCU enabled Peer connections, theoptions.filterCandidatesType
configuration is not honoured as Peers connected with MCU is similar as a forced TURN connection. The flags will act as if the value isfalse
and ICE candidates will never be filtered regardless of theoptions.filterCandidatesType
configuration. -
usePublicSTUN
{Boolean} OptionalDEFAULT:true
The flag if publicly available STUN ICE servers should be used if
options.enableSTUNServer
is enabled. -
TURNServerTransport
{Boolean} OptionalNote that configuring the protocol may not necessarily result in the desired network transports protocol used in the actual TURN network traffic as it depends which protocol the browser selects and connects with. This simply configures the TURN ICE server urls
The option to configure thequery option when constructing the Peer connection. When all protocols are selected, the ICE servers urls are duplicated with all protocols.
?transport=
query parameter in TURN ICE servers when constructing a Peer connections.- When not provided, its value is
ANY
. [Rel: Skylink.TURN_TRANSPORT]
- When not provided, its value is
-
disableVideoFecCodecs
{Boolean} OptionalDEFAULT:false
Note that this is an experimental flag and may cause disruptions in connections or connectivity issues when toggled, and to prevent connectivity issues, these codecs will not be removed for MCU enabled Peer connections.
The flag if video FEC (Forward Error Correction) codecs like ulpfec and red should be removed in sending session descriptions. This can be useful for debugging purposes to prevent redundancy and overheads in RTP encoding. -
disableComfortNoiseCodec
{Boolean} OptionalDEFAULT:false
Note that this is an experimental flag and may cause disruptions in connections or connectivity issues when toggled.
The flag if audio Comfort Noise (CN) codec should be removed in sending session descriptions. This can be useful for debugging purposes to test preferred audio quality and feedback. -
disableREMB
{Boolean} OptionalDEFAULT:false
Note that this is mainly used for debugging purposes and that it is an experimental flag, so it may cause disruptions in connections or connectivity issues when toggled.
The flag if video REMB feedback packets should be disabled in sending session descriptions. -
credentials
{JSON} OptionalThe credentials used for authenticating App Key with credentials to retrieve the Room session token used for connection in
joinRoom()
method. Note that switching of Rooms is not allowed when using credentials based authentication, unlessinit()
is invoked again with a different set of credentials followed by invoking thejoinRoom()
method.-
startDateTime
{String}The credentials User session in Room starting DateTime in ISO 8601 format. -
duration
{Number}The credentials User session in Room duration in hours. -
credentials
{String}The generated credentials used to authenticate the provided App Key with its"secret"
property.To generate the credentials:
- Concatenate a string that consists of the Room name you provide in the
options.defaultRoom
, theoptions.credentials.duration
and theoptions.credentials.startDateTime
. Example:var concatStr = defaultRoom + "_" + duration + "_" + startDateTime;
- Hash the concatenated string with the App Key
"secret"
property using SHA-1. Example:var hash = CryptoJS.HmacSHA1(concatStr, appKeySecret);
See theCryptoJS.HmacSHA1
library. - Encode the hashed string using base64
Example:
var b64Str = hash.toString(CryptoJS.enc.Base64);
See the CryptoJS.enc.Base64 library. - Encode the base64 encoded string to replace special characters using UTF-8 encoding.
Example:
var credentials = encodeURIComponent(base64String);
See encodeURIComponent() API.
- Concatenate a string that consists of the Room name you provide in the
-
-
audioFallback
{Boolean} OptionalDEFAULT:false
The flag if
getUserMedia()
method should fallback to retrieve only audio Stream when retrieving audio and video Stream fails. -
forceSSL
{Boolean} OptionalDEFAULT:false
The flag if HTTPS connections should be enforced during request to Auth server and socket connections to Signaling server when accessing
window.location.protocol
value is"http:"
. By default,"https:"
protocol connections uses HTTPS connections. -
audioCodec
{String} OptionalNote that if the audio codec is not supported, the SDK will not configure the local
The option to configure the preferred audio codec to use to encode sending audio data when available for Peer connection."offer"
or"answer"
session description to prefer the codec.- When not provided, its value is
AUTO
. [Rel: Skylink.AUDIO_CODEC]
- When not provided, its value is
-
videoCodec
{String} OptionalNote that if the video codec is not supported, the SDK will not configure the local
The option to configure the preferred video codec to use to encode sending video data when available for Peer connection."offer"
or"answer"
session description to prefer the codec.- When not provided, its value is
AUTO
. [Rel: Skylink.VIDEO_CODEC]
- When not provided, its value is
-
socketTimeout
{Number} OptionalDEFAULT:20000
The timeout for each attempts for socket connection with the Signaling server to indicate that connection has timed out and has failed to establish. Note that the mininum timeout value is
5000
. If less, this value will be5000
. -
forceTURNSSL
{Boolean} OptionalDEFAULT:false
Note that currently Firefox does not support the TURNS protocol, and that if TURNS is required, TURN ICE servers using port
The flag if TURNS protocol should be used when443
will be used instead.options.enableTURNServer
is enabled. -
filterCandidatesType
{JSON} OptionalNote that this a debugging feature and there might be connectivity issues when toggling these flags.
The configuration options to filter the type of ICE candidates sent and received.-
host
{Boolean} OptionalDEFAULT:false
The flag if local network ICE candidates should be filtered out. -
srflx
{Boolean} OptionalDEFAULT:false
The flag if STUN ICE candidates should be filtered out. -
relay
{Boolean} OptionalDEFAULT:false
The flag if TURN ICE candidates should be filtered out.
-
-
throttleIntervals
{JSON} OptionalThe configuration options to configure the throttling method timeouts.
-
shareScreen
{Number} Optional -
getUserMedia
{Number} Optional -
refreshConnection
{Number} OptionalDEFAULT:5000
Note that this throttling is only done for MCU enabled Peer connections with the
The interval timeout foroptions.mcuUseRenegoRestart
being set tofalse
.refreshConnection()
method throttling in milliseconds. Note that there will be no throttling whenrefreshConnection()
method is called internally.
-
-
throttleShouldThrowError
{Boolean} OptionalDEFAULT:false
The flag if throttled methods should throw errors when method is invoked less than the interval timeout value configured in
options.throttleIntervals
. -
mcuUseRenegoRestart
{Boolean} OptionalDEFAULT:false
Note that this feature is currently is beta and for any enquiries on enabling and its support, please contact our support portal.
The flag ifrefreshConnection()
method should renegotiate like non-MCU enabled Peer connection for MCU enabled Peer connections instead of invokingjoinRoom()
method again.
- When provided as a string, it's configured as
-
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by thereadyStateChange
eventstate
parameter payload value asCOMPLETED
for request success. [Rel: Skylink.READY_STATE_CHANGE]-
error
{JSON | String}The error result in request.
- When defined as string, it's the error when required App Key is not provided.
Defined as
null
when there are no errors in request
-
errorCode
{Number}ThereadyStateChange
eventerror.errorCode
parameter payload value. [Rel: Skylink.READY_STATE_CHANGE_ERROR] -
error
{Object}ThereadyStateChange
eventerror.content
parameter payload value. -
status
{Number}ThereadyStateChange
eventerror.status
parameter payload value.
- When defined as string, it's the error when required App Key is not provided.
Defined as
-
success
{JSON}The success result in request. Defined as
null
when there are errors in request-
serverUrl
{String}The constructed REST URL requested to Auth server. -
readyState
{String}The current ready state. [Rel: Skylink.READY_STATE_CHANGE] -
selectedRoom
{String}The Room based on the current Room session token retrieved for. -
appKey
{String}The configured value of theoptions.appKey
. -
defaultRoom
{String}The configured value of theoptions.defaultRoom
. -
roomServer
{String}The configured value of theoptions.roomServer
. -
enableIceTrickle
{Boolean}The configured value of theoptions.enableIceTrickle
. -
enableDataChannel
{Boolean}The configured value of theoptions.enableDataChannel
. -
enableTURNServer
{Boolean}The configured value of theoptions.enableTURNServer
. -
enableSTUNServer
{Boolean}The configured value of theoptions.enableSTUNServer
. -
TURNTransport
{Boolean}The configured value of theoptions.TURNServerTransport
. -
audioFallback
{Boolean}The configured value of theoptions.audioFallback
. -
forceSSL
{Boolean}The configured value of theoptions.forceSSL
. -
audioCodec
{String}The configured value of theoptions.audioCodec
. -
videoCodec
{String}The configured value of theoptions.videoCodec
. -
socketTimeout
{Number}The configured value of theoptions.socketTimeout
. -
forceTURNSSL
{Boolean}The configured value of theoptions.forceTURNSSL
. -
forceTURN
{Boolean}The configured value of theoptions.forceTURN
. -
usePublicSTUN
{Boolean}The configured value of theoptions.usePublicSTUN
. -
disableVideoFecCodecs
{Boolean}The configured value of theoptions.disableVideoFecCodecs
. -
disableComfortNoiseCodec
{Boolean}The configured value of theoptions.disableComfortNoiseCodec
. -
disableREMB
{Boolean}The configured value of theoptions.disableREMB
. -
filterCandidatesType
{JSON}The configured value of theoptions.filterCandidatesType
. -
throttleIntervals
{Number}The configured value of theoptions.throttleIntervals
. -
throttleShouldThrowError
{Number}The configured value of theoptions.throttleShouldThrowError
. -
mcuUseRenegoRestart
{Number}The configured value of theoptions.mcuUseRenegoRestart
.
-
-
introducePeer
sendingPeerId
,
receivingPeerId
,
)
Note that this feature requiresFunction that selects and introduces a pair of Peers to start connection with each other."isPrivileged"
flag to be enabled and"autoIntroduce"
flag to be disabled for the App Key provided in theinit()
method, as only Users connecting using the App Key with this flag enabled (which we call privileged Users / Peers) can retrieve the list of Peer IDs from Rooms within the same App space. Read more about privileged App Key feature here.
Example:
// Example 1: Introduce a pair of Peers skylinkDemo.on("introduceStateChange", function (state, privilegedPeerId, sendingPeerId, receivingPeerId) { if (state === skylinkDemo.INTRODUCE_STATE.INTRODUCING) { console.log("Peer '" + sendingPeerId + "' has been introduced to '" + receivingPeerId + "'"); } });
skylinkDemo.joinRoom(function (jRError, jRSuccess) { if (jRError) return; skylinkDemo.getPeers(function (gPError, gPSuccess) { if (gPError) return; skylinkDemo.introducePeer(gPSuccess.roomName[0], gPSuccess.roomName[1]); }); });
Events Sequence:
- If App Key provided in the
init()
method is not a Privileged enabled Key:- ABORT and return error.
- Starts sending introduction request for the selected pair of Peers to the Signaling server.
introduceStateChange
event triggers parameter payloadstate
value asINTRODUCING
.- If received errors from Signaling server:
introduceStateChange
event triggers parameter payloadstate
value asERROR
.
Parameters:
-
sendingPeerId
{String}The Peer ID to be connected with
receivingPeerId
. -
receivingPeerId
{String}The Peer ID to be connected with
sendingPeerId
.
joinRoom
[room]
,
[options]
,
[callback]
,
)
Function that starts the Room session.
Example:
// Example 1: Connecting to the default Room without Stream skylinkDemo.joinRoom(function (error, success) { if (error) return; console.log("User connected."); });
// Example 2: Connecting to Room "testxx" with Stream skylinkDemo.joinRoom("testxx", { audio: true, video: true }, function (error, success) { if (error) return; console.log("User connected with getUserMedia() Stream.") });
// Example 3: Connecting to default Room with Stream retrieved earlier skylinkDemo.getUserMedia(function (gUMError, gUMSuccess) { if (gUMError) return; skylinkDemo.joinRoom(function (error, success) { if (error) return; console.log("User connected with getUserMedia() Stream."); }); });
// Example 4: Connecting to "testxx" Room with shareScreen() Stream retrieved manually skylinkDemo.on("mediaAccessRequired", function () { skylinkDemo.shareScreen(function (sSError, sSSuccess) { if (sSError) return; }); });
skylinkDemo.joinRoom("testxx", { manualGetUserMedia: true }, function (error, success) { if (error) return; console.log("User connected with shareScreen() Stream."); });
// Example 5: Connecting to "testxx" Room with User custom data var data = { username: "myusername" }; skylinkDemo.joinRoom("testxx", { userData: data }, function (error, success) { if (error) return; console.log("User connected with correct user data?", success.peerInfo.userData.username === data.username); });
Events Sequence:
- If User is in a Room:
- Invoke
leaveRoom()
method to end current Room connection. InvokedleaveRoom()
methodstopMediaOptions
parameter value will befalse
. Regardless of request errors,joinRoom()
will still proceed.
- Invoke
- Check if Room name provided matches the Room name of the currently retrieved Room session token.
- If Room name does not matches:
- Invoke
init()
method to retrieve new Room session token.- If request has errors:
- ABORT and return error.
- If request has errors:
- Invoke
- If Room name does not matches:
- Open a new socket connection to Signaling server.
- If Socket connection fails:
socketError
event triggers parameter payloaderrorCode
asCONNECTION_FAILED
.- Checks if there are fallback ports and transports to use.
- If there are still fallback ports and transports:
- Attempts to retry socket connection to Signaling server.
channelRetry
event triggers.socketError
event triggers parameter payloaderrorCode
asRECONNECTION_ATTEMPT
.- If attempt to retry socket connection to Signaling server has failed:
socketError
event triggers parameter payloaderrorCode
asRECONNECTION_FAILED
.- Checks if there are still any more fallback ports and transports to use.
- If there are is no more fallback ports and transports to use:
socketError
event triggers parameter payloaderrorCode
asRECONNECTION_ABORTED
.- ABORT and return error.
- Else:
- REPEAT attempt to retry socket connection to Signaling server step.
- If there are is no more fallback ports and transports to use:
- Attempts to retry socket connection to Signaling server.
- Else:
socketError
event triggers parameter payloaderrorCode
asCONNECTION_ABORTED
.- ABORT and return error.
- If there are still fallback ports and transports:
- Checks if there are fallback ports and transports to use.
- If socket connection to Signaling server has opened:
channelOpen
event triggers.
- If Socket connection fails:
- Checks if there is
options.manualGetUserMedia
requested- If it is requested:
mediaAccessRequired
event triggers.- If more than 30 seconds has passed and no
getUserMedia()
Stream orshareScreen()
Stream has been retrieved:- ABORT and return error.
- Else:
- If there is
options.audio
oroptions.video
requested:- Invoke
getUserMedia()
method.- If request has errors:
- ABORT and return error.
- If request has errors:
- Invoke
- If there is
- If it is requested:
- Starts the Room session
- If Room session has started successfully:
peerJoined
event triggers parameter payloadisSelf
value astrue
.- If MCU is enabled for the App Key provided in
init()
method and connected:serverPeerJoined
event triggersserverPeerType
asMCU
. MCU has to be present in the Room in order for Peer connections to commence.- Checks for any available Stream
- If
shareScreen()
Stream is available:incomingStream
event triggers parameter payloadisSelf
value astrue
andstream
asshareScreen()
Stream. User will be sendingshareScreen()
Stream to Peers.
- Else if
getUserMedia()
Stream is available:incomingStream
event triggers parameter payloadisSelf
value astrue
andstream
asgetUserMedia()
Stream. User will be sendinggetUserMedia()
Stream to Peers.
- Else:
- No Stream will be sent.
- If
- Else:
systemAction
event triggers parameter payloadaction
asREJECT
.- ABORT and return error.
- If Room session has started successfully:
Parameters:
-
room
{String} OptionalThe Room name.
- When not provided or is provided as an empty string, its value is the
options.defaultRoom
provided in theinit()
method. Note that if you are using credentials based authentication, you cannot switch the Room that is not the same as theoptions.defaultRoom
defined in theinit()
method.
- When not provided or is provided as an empty string, its value is the
-
options
{JSON} OptionalThe Room session configuration options.
-
userData
{JSON | String} OptionalThe User custom data. This can be set after Room session has started using the
setUserData()
method. -
useExactConstraints
{Boolean} OptionalThe
getUserMedia()
methodoptions.useExactConstraints
parameter settings. See theoptions.useExactConstraints
parameter in thegetUserMedia()
method for more information. -
audio
{Boolean | JSON} OptionalThe
getUserMedia()
methodoptions.audio
parameter settings. When value is defined astrue
or an object,getUserMedia()
method to be invoked to retrieve new Stream. Ifoptions.video
is not defined, it will be defined asfalse
. Object signature matches theoptions.audio
parameter in thegetUserMedia()
method. -
video
{Boolean | JSON} OptionalThe
getUserMedia()
methodoptions.video
parameter settings. When value is defined astrue
or an object,getUserMedia()
method to be invoked to retrieve new Stream. Ifoptions.audio
is not defined, it will be defined asfalse
. Object signature matches theoptions.video
parameter in thegetUserMedia()
method. -
bandwidth
{JSON} OptionalNote that this is currently not supported with Firefox browsers versions 48 and below as noted in an existing bugzilla ticket here.
The configuration to set the maximum streaming bandwidth to send to Peers.-
audio
{Number} OptionalThe maximum audio streaming bandwidth sent to Peers in kbps. Recommended values are50
to200
.50
is sufficient enough for an audio call. The higher you go if you want clearer audio and to be able to hear music streaming. -
video
{Number} OptionalThe maximum video streaming bandwidth sent to Peers. Recommended values are256
-500
for 180p quality,500
-1024
for 360p quality,1024
-2048
for 720p quality and2048
-4096
for 1080p quality. -
data
{Number} OptionalThe maximum data streaming bandwidth sent to Peers. This affects the P2P messaging insendP2PMessage()
method, and data transfers insendBlobData()
method andsendURLData()
method.
-
-
googleXBandwidth
{JSON} OptionalNote that this is an experimental configuration and may cause disruptions in connections or connectivity issues when toggled, or may not work depending on browser supports. Currently, this only toggles the video codec bandwidth configuration.
The configuration to set the experimental google video streaming bandwidth sent to Peers. Note that Peers may override the "receive from" streaming bandwidth depending on the Peers configuration.-
min
{Number} OptionalThe minimum experimental google video streaming bandwidth sent to Peers. This toggles the"x-google-min-bitrate"
flag in the session description. -
max
{Number} OptionalThe maximum experimental google video streaming bandwidth sent to Peers. This toggles the"x-google-max-bitrate"
flag in the session description.
-
-
manualGetUserMedia
{Boolean} OptionalThe flag if
joinRoom()
should triggermediaAccessRequired
event in which thegetUserMedia()
Stream orshareScreen()
Stream must be retrieved as a requirement before Room session may begin. This ignores theoptions.audio
andoptions.video
configuration. After 30 seconds without any Stream retrieved, this results in thecallback(error, ..)
result. -
sdpSettings
{JSON} OptionalNote that this is mainly used for debugging purposes and that it is an experimental flag, so it may cause disruptions in connections or connectivity issues when toggled. Note that it might not work with MCU enabled Peer connections or break MCU enabled Peer connections.
The configuration to set the session description settings.-
connection
{JSON} OptionalThe configuration to set the session description connection settings. Note that this configuration may disable the media streaming and these settings will be enabled for MCU server Peer connection regardless of the flags configured. -
connection.audio
{Boolean} OptionalDEFAULT:true
The configuration to enable audio session description connection. -
connection.video
{Boolean} OptionalDEFAULT:true
The configuration to enable video session description connection. -
connection.data
{Boolean} OptionalDEFAULT:true
The configuration to enable Datachannel session description connection. -
direction
{JSON} OptionalThe configuration to set the session description connection direction to enable or disable uploading and downloading audio or video media streaming. Note that this configuration does not prevent RTCP packets from being sent and received. -
direction.audio
{JSON} OptionalThe configuration to set the session description connection direction for audio streaming. -
direction.audio.send
{Boolean} OptionalDEFAULT:true
The flag if uploading audio streaming should be enabled when available. -
direction.audio.receive
{Boolean} OptionalDEFAULT:true
The flag if downloading audio streaming should be enabled when available. -
direction.video
{JSON} OptionalThe configuration to set the session description connection direction for video streaming. -
direction.video.send
{Boolean} OptionalDEFAULT:true
The flag if uploading video streaming should be enabled when available. -
direction.video.receive
{Boolean} OptionalDEFAULT:true
The flag if downloading video streaming should be enabled when available.
-
-
publishOnly
{JSON | Boolean} OptionalFor MCU enabled Peer connections, defining this flag would make Peer not know other Peers presence in the Room.
The config if Peer would publish only.
For non-MCU enable Peer connections, defining this flag would cause other Peers in the Room to not to send Stream to Peer, and overrides the configoptions.sdpSettings.direction.audio.receive
value tofalse
,options.sdpSettings.direction.video.receive
value tofalse
,options.sdpSettings.direction.video.send
value totrue
andoptions.sdpSettings.direction.audio.send
value totrue
.
Note that this feature is currently is beta, and for any enquiries on enabling and its support for MCU enabled Peer connections, please contact our support portal.-
parentId
{String} OptionalThe parent Peer ID to match to when Peer is connected. This is useful for identification for users connecting the Room twice simultaneously for multi-streaming.
-
-
-
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by thepeerJoined
event triggeringisSelf
parameter payload value astrue
for request success.-
error
{JSON}The error result in request. Defined as
null
when there are no errors in request-
error
{Error | String}The error received when starting Room session has failed. -
errorCode
{Number} OptionalThe currentinit()
method ready state. Defined asnull
when noinit()
method has not been called due to invalid configuration. [Rel: Skylink.READY_STATE_CHANGE] -
room
{String}The Room name.
-
-
success
{JSON}The success result in request. Defined as
null
when there are errors in request-
room
{String}The Room name. -
peerId
{String}The User's Room session Peer ID. -
peerInfo
{JSON}The User's current Room session information. Object signature matches thepeerInfo
parameter payload received in thepeerJoined
event.
-
-
leaveRoom
[stopMediaOptions=true]
,
[callback]
,
)
Note that this method will close any existing socket channel connection despite not being in the Room.Function that stops Room session.
Events Sequence:
- If Socket connection is opened:
channelClose
event triggers.
- Checks if User is in Room.
- If User is not in a Room:
- ABORT and return error.
- Else:
- If parameter
stopMediaOptions.userMedia
value istrue
:- Invoke
stopStream()
method. Regardless of request errors,leaveRoom()
will still proceed.
- Invoke
- If parameter
stopMediaOptions.screenshare
value istrue
:- Invoke
stopScreen()
method. Regardless of request errors,leaveRoom()
will still proceed.
- Invoke
peerLeft
event triggers for User and all connected Peers in Room.- If MCU is enabled for the App Key provided in
init()
method and connected:serverPeerLeft
event triggers parameter payloadserverPeerType
asMCU
.
- If parameter
- If User is not in a Room:
Parameters:
-
stopMediaOptions
{Boolean | JSON} OptionalDEFAULT:true
The flag if
leaveRoom()
should stop bothshareScreen()
Stream andgetUserMedia()
Stream.- When provided as a boolean, this sets both
stopMediaOptions.userMedia
andstopMediaOptions.screenshare
to its boolean value.
-
userMedia
{Boolean} OptionalDEFAULT:true
The flag if
leaveRoom()
should stopgetUserMedia()
Stream. This invokesstopStream()
method. -
screenshare
{Boolean} OptionalDEFAULT:true
The flag if
leaveRoom()
should stopshareScreen()
Stream. This invokesstopScreen()
method.
- When provided as a boolean, this sets both
-
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by thepeerLeft
event triggeringisSelf
parameter payload value astrue
for request success.-
error
{Error | String}The error result in request. Defined as
null
when there are no errors in request Object signature is theleaveRoom()
error when stopping Room session. -
success
{JSON}The success result in request. Defined as
null
when there are errors in request-
peerId
{String}The User's Room session Peer ID. -
previousRoom
{String}The Room name.
-
-
lockRoom
()
Note that broadcasted events fromFunction that locks the current Room when in session to prevent other Peers from joining the Room.muteStream()
method,stopStream()
method,stopScreen()
method,sendMessage()
method,unlockRoom()
method andlockRoom()
method may be queued when sent within less than an interval.
Events Sequence:
- Requests to Signaling server to lock Room
roomLock
event triggers parameter payloadisLocked
value astrue
.
muteStream
options
,
)
Note that broadcasted events fromFunction that mutes bothmuteStream()
method,stopStream()
method,stopScreen()
method,sendMessage()
method,unlockRoom()
method andlockRoom()
method may be queued when sent within less than an interval.
getUserMedia()
Stream and
shareScreen()
Stream audio or video tracks.
Example:
// Example 1: Mute both audio and video tracks in all Streams skylinkDemo.muteStream({ audioMuted: true, videoMuted: true });
// Example 2: Mute only audio tracks in all Streams skylinkDemo.muteStream({ audioMuted: true, videoMuted: false });
// Example 3: Mute only video tracks in all Streams skylinkDemo.muteStream({ audioMuted: false, videoMuted: true });
Events Sequence:
- If provided parameter
options
is invalid:- ABORT and return error.
- Checks if there is any available Streams:
- If there is no available Streams:
- ABORT and return error.
- If User is in Room:
- Checks if there is audio tracks to mute / unmute:
- If there is audio tracks to mute / unmute:
- If
options.audioMuted
value is not the same as the currentpeerInfo.mediaStatus.audioMuted
: This can be retrieved withgetPeerInfo()
method.- For Peer only
peerUpdated
event triggers with parameter payloadisSelf
value asfalse
. - For Peer only
streamMuted
event triggers with parameter payloadisSelf
value asfalse
.
- For Peer only
- If
- If there is audio tracks to mute / unmute:
- Checks if there is video tracks to mute / unmute:
- If there is video tracks to mute / unmute:
- If
options.videoMuted
value is not the same as the currentpeerInfo.mediaStatus.videoMuted
: This can be retrieved withgetPeerInfo()
method.- For Peer only
peerUpdated
event triggers with parameter payloadisSelf
value asfalse
. - For Peer only
streamMuted
event triggers with parameter payloadisSelf
value asfalse
.
- For Peer only
- If
- If there is video tracks to mute / unmute:
- Checks if there is audio tracks to mute / unmute:
- If
options.audioMuted
value is not the same as the currentpeerInfo.mediaStatus.audioMuted
oroptions.videoMuted
value is not the same as the currentpeerInfo.mediaStatus.videoMuted
:localMediaMuted
event triggers.- If User is in Room:
streamMuted
event triggers with parameter payloadisSelf
value astrue
.peerUpdated
event triggers with parameter payloadisSelf
value astrue
.
- If there is no available Streams:
Parameters:
-
options
{JSON}The Streams muting options.
-
audioMuted
{Boolean} OptionalDEFAULT:true
The flag if all Streams audio tracks should be muted or not.
-
videoMuted
{Boolean} OptionalDEFAULT:true
The flag if all Streams video tracks should be muted or not.
-
off
eventName
,
[callback]
,
)
Function that unsubscribes listeners from an event.
Example:
// Example 1: Unsubscribe all "peerJoined" event skylinkDemo.off("peerJoined");
// Example 2: Unsubscribe only one listener from "peerJoined event" var pJListener = function (peerId, peerInfo, isSelf) { console.info("peerJoined event has been triggered with:", peerId, peerInfo, isSelf); };
skylinkDemo.off("peerJoined", pJListener);
Events Sequence:
There is no event sequence for this method.Parameters:
-
eventName
{String}The event.
-
callback
{Function} OptionalThe listener to unsubscribe.
- When not provided, all listeners associated to the event will be unsubscribed.
on
eventName
,
callback
,
)
Function that subscribes a listener to an event.
Example:
// Example 1: Subscribing to "peerJoined" event skylinkDemo.on("peerJoined", function (peerId, peerInfo, isSelf) { console.info("peerJoined event has been triggered with:", peerId, peerInfo, isSelf); });
Events Sequence:
There is no event sequence for this method.Parameters:
-
eventName
{String}The event.
-
callback
{Function}The listener. This will be invoked when event is triggered.
once
eventName
,
callback
,
[condition]
,
[fireAlways=false]
,
)
Function that subscribes a listener to an event once.
Example:
// Example 1: Subscribing to "peerJoined" event that triggers without condition skylinkDemo.once("peerJoined", function (peerId, peerInfo, isSelf) { console.info("peerJoined event has been triggered once with:", peerId, peerInfo, isSelf); });
// Example 2: Subscribing to "incomingStream" event that triggers with condition skylinkDemo.once("incomingStream", function (peerId, stream, isSelf, peerInfo) { console.info("incomingStream event has been triggered with User stream:", stream); }, function (peerId, peerInfo, isSelf) { return isSelf; });
// Example 3: Subscribing to "dataTransferState" event that triggers always only when condition is satisfied skylinkDemo.once("dataTransferState", function (state, transferId, peerId, transferInfo) { console.info("Received data transfer from Peer:", transferInfo.data); }, function (state, transferId, peerId) { if (state === skylinkDemo.DATA_TRANSFER_STATE.UPLOAD_REQUEST) { skylinkDemo.acceptDataTransfer(peerId, transferId); } return state === skylinkDemo.DATA_TRANSFER_STATE.DOWNLOAD_COMPLETED; }, true);
Events Sequence:
There is no event sequence for this method.Parameters:
-
eventName
{String}The event.
-
callback
{Function}The listener. This will be invoked once when event is triggered and conditional function is satisfied.
-
condition
{Function} OptionalThe conditional function that will be invoked when event is triggered. Return
true
when invoked to satisfy condition. When not provided, the conditional function will always returntrue
. -
fireAlways
{Boolean} OptionalDEFAULT:false
The flag that indicates if
once()
should act likeon()
but only invoke listener only when conditional function is satisfied.
refreshConnection
[targetPeerId]
,
[iceRestart=false]
,
[callback]
,
)
For MCU enabled Peer connections withFunction that refreshes Peer connections to update with the current streaming.options.mcuUseRenegoRestart
set tofalse
in theinit()
method, the restart functionality may differ, you may learn more about how to workaround it in this article here. For restarts with Peers connecting from Android, iOS or C++ SDKs, restarts might not work as written in in this article here. Note that this functionality should be used when Peer connection stream freezes during a connection. For a better user experience for only MCU enabled Peer connections, the functionality is throttled when invoked many times in less than the milliseconds interval configured in theinit()
method.
Example:
// Example 1: Refreshing a Peer connection function refreshFrozenVideoStream (peerId) { skylinkDemo.refreshConnection(peerId, function (error, success) { if (error) return; console.log("Refreshing connection for '" + peerId + "'"); }); }
// Example 2: Refreshing a list of Peer connections function refreshFrozenVideoStreamGroup (peerIdA, peerIdB) { skylinkDemo.refreshConnection([peerIdA, peerIdB], function (error, success) { if (error) { if (error.transferErrors[peerIdA]) { console.error("Failed refreshing connection for '" + peerIdA + "'"); } else { console.log("Refreshing connection for '" + peerIdA + "'"); } if (error.transferErrors[peerIdB]) { console.error("Failed refreshing connection for '" + peerIdB + "'"); } else { console.log("Refreshing connection for '" + peerIdB + "'"); } } else { console.log("Refreshing connection for '" + peerIdA + "' and '" + peerIdB + "'"); } }); }
// Example 3: Refreshing all Peer connections function refreshFrozenVideoStreamAll () { skylinkDemo.refreshConnection(function (error, success) { if (error) { for (var i = 0; i < error.listOfPeers.length; i++) { if (error.refreshErrors[error.listOfPeers[i]]) { console.error("Failed refreshing connection for '" + error.listOfPeers[i] + "'"); } else { console.info("Refreshing connection for '" + error.listOfPeers[i] + "'"); } } } else { console.log("Refreshing connection for all Peers", success.listOfPeers); } }); }
// Example 4: Refresh Peer connection when ICE connection has failed or disconnected // and do a ICE connection refresh (only for non-MCU case) skylinkDemo.on("iceConnectionState", function (state, peerId) { if (!usesMCUKey && [skylinkDemo.ICE_CONNECTION_STATE.FAILED, skylinkDemo.ICE_CONNECTION_STATE.DISCONNECTED].indexOf(state) > -1) { skylinkDemo.refreshConnection(peerId, true); } });
Events Sequence:
- Checks if MCU is enabled for App Key provided in
init()
method- If MCU is enabled:
- If there are connected Peers in the Room:
peerRestart
event triggers parameter payloadisSelfInitiateRestart
value astrue
for all connected Peer connections.serverPeerRestart
event triggers for connected MCU server Peer connection.
- If
options.mcuUseRenegoRestart
value isfalse
set in theinit()
method:-
Invokes
joinRoom()
methodrefreshConnection()
will retain the User session information except the Peer ID will be a different assigned ID due to restarting the Room session.- If request has errors
- ABORT and return error.
- If request has errors
-
Invokes
- If there are connected Peers in the Room:
- Else:
- If there are connected Peers in the Room:
- Refresh connections for all targeted Peers.
- If Peer connection exists:
peerRestart
event triggers parameter payloadisSelfInitiateRestart
value astrue
for all targeted Peer connections.
- Else:
- ABORT and return error.
- If Peer connection exists:
- Refresh connections for all targeted Peers.
- If there are connected Peers in the Room:
- If MCU is enabled:
Parameters:
-
targetPeerId
{String | Array} OptionalNote that this is ignored if MCU is enabled for the App Key provided in
The target Peer ID to refresh connection with.init()
method.refreshConnection()
will "refresh" all Peer connections. See the Event Sequence for more information.- When provided as an Array, it will refresh all connections with all the Peer IDs provided.
- When not provided, it will refresh all the currently connected Peers in the Room.
-
iceRestart
{Boolean} OptionalDEFAULT:false
Note that this flag will not be honoured for MCU enabled Peer connections where
The flag if ICE connections should restart when refreshing Peer connections. This is used when ICE connection state isoptions.mcuUseRenegoRestart
flag is set tofalse
as it is not necessary since for MCU "restart" case is to invokejoinRoom()
method again, or that it is not supported by the MCU.FAILED
orDISCONNECTED
, which state can be retrieved with theiceConnectionState
event. -
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by thepeerRestart
event triggeringisSelfInitiateRestart
parameter payload value astrue
for all Peers targeted for request success.-
error
{JSON}The error result in request. Defined as
null
when there are no errors in request-
listOfPeers
{Array}The list of Peer IDs targeted. -
refreshErrors
{JSON}The list of Peer connection refresh errors. -
refreshErrors.#peerId
{Error | String}The Peer connection refresh error associated with the Peer ID defined in#peerId
property. If#peerId
value is"self"
, it means that it is the error when there is no Peer connections to refresh with.
-
-
success
{JSON}The success result in request. Defined as
null
when there are errors in request-
listOfPeers
{Array}The list of Peer IDs targeted.
-
-
sendBlobData
data
,
[timeout=60]
,
[targetPeerId]
,
[sendChunksAsBinary=false]
,
[callback]
,
)
Note that Android, iOS and C++ SDKs do not support simultaneous data transfers.Function that starts an uploading data transfer from User to Peers.
Example:
<body> <input type="radio" name="timeout" onchange="setTransferTimeout(0)"> 1s timeout (Default) <input type="radio" name="timeout" onchange="setTransferTimeout(120)"> 2s timeout <input type="radio" name="timeout" onchange="setTransferTimeout(300)"> 5s timeout <hr> <input type="file" onchange="uploadFile(this.files[0], this.getAttribute('data'))" data="peerId"> <input type="file" onchange="uploadFileGroup(this.files[0], this.getAttribute('data').split(',')))" data="peerIdA,peerIdB"> <input type="file" onchange="uploadFileAll(this.files[0])" data=""> <script> var transferTimeout = 0;
function setTransferTimeout (timeout) { transferTimeout = timeout; }
// Example 1: Upload data to a Peer function uploadFile (file, peerId) { var cb = function (error, success) { if (error) return; console.info("File has been transferred to '" + peerId + "' successfully"); }; if (transferTimeout > 0) { skylinkDemo.sendBlobData(file, peerId, transferTimeout, cb); } else { skylinkDemo.sendBlobData(file, peerId, cb); } }
// Example 2: Upload data to a list of Peers function uploadFileGroup (file, peerIds) { var cb = function (error, success) { var listOfPeers = error ? error.listOfPeers : success.listOfPeers; var listOfPeersErrors = error ? error.transferErrors : {}; for (var i = 0; i < listOfPeers.length; i++) { if (listOfPeersErrors[listOfPeers[i]]) { console.error("Failed file transfer to '" + listOfPeers[i] + "'"); } else { console.info("File has been transferred to '" + listOfPeers[i] + "' successfully"); } } }; if (transferTimeout > 0) { skylinkDemo.sendBlobData(file, peerIds, transferTimeout, cb); } else { skylinkDemo.sendBlobData(file, peerIds, cb); } }
// Example 2: Upload data to a list of Peers function uploadFileAll (file) { var cb = function (error, success) { var listOfPeers = error ? error.listOfPeers : success.listOfPeers; var listOfPeersErrors = error ? error.transferErrors : {}; for (var i = 0; i < listOfPeers.length; i++) { if (listOfPeersErrors[listOfPeers[i]]) { console.error("Failed file transfer to '" + listOfPeers[i] + "'"); } else { console.info("File has been transferred to '" + listOfPeers[i] + "' successfully"); } } }; if (transferTimeout > 0) { skylinkDemo.sendBlobData(file, transferTimeout, cb); } else { skylinkDemo.sendBlobData(file, cb); } } </script> </body>
Events Sequence:
- Checks if Peer connection and Datachannel connection are in correct states.
- If Peer connection or session does not exists:
-
dataTransferState
event triggers parameter payloadstate
asERROR
. - ABORT step and return error.
-
- If Peer connection is not stable: The stable state can be checked with
peerConnectionState
event triggering parameter payloadstate
asSTABLE
for Peer.dataTransferState
event triggers parameter payloadstate
asERROR
.- ABORT step and return error.
- If Peer connection messaging Datachannel has not been opened: This can be checked with
dataChannelState
event triggering parameter payloadstate
asOPEN
andchannelType
asMESSAGING
for Peer.-
dataTransferState
event triggers parameter payloadstate
asERROR
. - ABORT step and return error.
-
- If MCU is enabled for the App Key provided in
init()
method and connected:- If MCU Peer connection is not stable: The stable state can be checked with
peerConnectionState
event triggering parameter payloadstate
asSTABLE
andpeerId
value as"MCU"
for MCU Peer.dataTransferState
event triggers parameter payloadstate
asERROR
.- ABORT step and return error.
- If MCU Peer connection messaging Datachannel has not been opened: This can be checked with
dataChannelState
event triggering parameter payloadstate
asOPEN
,peerId
value as"MCU"
andchannelType
asMESSAGING
for MCU Peer.dataTransferState
event triggers parameter payloadstate
asERROR
.- ABORT step and return error.
- If MCU Peer connection is not stable: The stable state can be checked with
- Checks if should open a new data Datachannel.
- If Peer supports simultaneous data transfer, open new data Datachannel: If MCU is connected,
this opens a new data Datachannel with MCU Peer with all the Peers IDs information that supports
simultaneous data transfers targeted for the data transfer session instead of opening new data Datachannel
with all Peers targeted for the data transfer session.
dataChannelState
event triggers parameter payloadstate
asCONNECTING
andchannelType
asDATA
. Note that there is no timeout to wait for parameter payloadstate
to beOPEN
.- If Datachannel has been created and opened successfully:
dataChannelState
event triggers parameter payloadstate
asOPEN
andchannelType
asDATA
.
- Else:
dataChannelState
event triggers parameter payloadstate
asCREATE_ERROR
andchannelType
asDATA
.dataTransferState
event triggers parameter payloadstate
asERROR
.- ABORT step and return error.
- Else: If MCU is connected,
this uses the messaging Datachannel with MCU Peer with all the Peers IDs information that supports
simultaneous data transfers targeted for the data transfer session instead of using the messaging Datachannels
with all Peers targeted for the data transfer session.
- If messaging Datachannel connection has a
data transfer in-progress:
dataTransferState
event triggers parameter payloadstate
asERROR
.- ABORT step and return error.
- If messaging Datachannel connection has a
data transfer in-progress:
- If Peer supports simultaneous data transfer, open new data Datachannel: If MCU is connected,
this opens a new data Datachannel with MCU Peer with all the Peers IDs information that supports
simultaneous data transfers targeted for the data transfer session instead of opening new data Datachannel
with all Peers targeted for the data transfer session.
- If Peer connection or session does not exists:
incomingDataRequest
event triggers.- For User only
dataTransferState
event triggers parameter payloadstate
asUSER_UPLOAD_REQUEST
. - For Peer only
dataTransferState
event triggers parameter payloadstate
asUPLOAD_REQUEST
. - Peer invokes
acceptDataTransfer()
method.- If parameter
accept
value istrue
:- User starts upload data transfer to Peer.
- For User only
dataTransferState
event triggers parameter payloadstate
asUPLOAD_STARTED
. - For Peer only
dataTransferState
event triggers parameter payloadstate
asDOWNLOAD_STARTED
.
- For User only
- If Peer / User invokes
cancelDataTransfer()
method:dataTransferState
event triggers parameterstate
asCANCEL
.- ABORT step and return error.
- If data transfer has timeout errors:
dataTransferState
event triggers parameterstate
asERROR
.- ABORT step and return error.
- Checks for Peer connection and Datachannel connection during data transfer:
- If MCU is enabled for the App Key provided in
init()
method and connected:- If MCU Datachannel has closed abruptly during data transfer:
-
This can be checked with
dataTransferState
event triggers parameterstate
asERROR
.- ABORT step and return error.
dataChannelState
event triggering parameter payloadstate
asCLOSED
,peerId
value as"MCU"
andchannelType
asDATA
for targeted Peers that supports simultaneous data transfer orMESSAGING
for targeted Peers that do not support it.
- If MCU Datachannel has closed abruptly during data transfer:
- If MCU Peer connection has changed from not being stable:
-
This can be checked with
dataTransferState
event triggers parameterstate
asERROR
.- ABORT step and return error.
peerConnection
event triggering parameter payloadstate
as notSTABLE
,peerId
value as"MCU"
.
- If MCU is enabled for the App Key provided in
- If Peer connection has changed from not being stable:
-
This can be checked with
dataTransferState
event triggers parameterstate
asERROR
.- ABORT step and return error.
peerConnection
event triggering parameter payloadstate
as notSTABLE
.
- User starts upload data transfer to Peer.
- If parameter
- Else:
- If Datachannel has closed abruptly during data transfer:
This can be checked with
dataChannelState
event triggering parameter payloadstate
asCLOSED
andchannelType
asDATA
for Peer that supports simultaneous data transfer orMESSAGING
for Peer that do not support it.dataTransferState
event triggers parameterstate
asERROR
.- ABORT step and return error.
- If Datachannel has closed abruptly during data transfer:
This can be checked with
- For User only
dataTransferState
event triggers parameter payloadstate
asUPLOADING
. - For Peer only
dataTransferState
event triggers parameter payloadstate
asDOWNLOADING
.
incomingData
event triggers.- For User only
dataTransferState
event triggers parameter payloadstate
asUPLOAD_COMPLETED
. - For Peer only
dataTransferState
event triggers parameter payloadstate
asDOWNLOAD_COMPLETED
.
accept
value is false
: - For User only
dataTransferState
event triggers parameter payloadstate
asREJECTED
. - For Peer only
dataTransferState
event triggers parameter payloadstate
asUSER_REJECTED
. - ABORT step and return error.
Parameters:
-
data
{Blob}The Blob object.
-
timeout
{Number} OptionalDEFAULT:60
The timeout to wait for response from Peer.
-
targetPeerId
{String | Array} OptionalThe target Peer ID to start data transfer with.
- When provided as an Array, it will start uploading data transfers with all connections with all the Peer IDs provided.
- When not provided, it will start uploading data transfers with all the currently connected Peers in the Room.
-
sendChunksAsBinary
{Boolean} OptionalDEFAULT:false
Note that this is currently not supported for MCU enabled Peer connections or Peer connections connecting from Android, iOS and Linux SDKs. This would fallback to
The flag if data transfer binary data chunks should not be encoded as Base64 string during data transfers.transferInfo.chunkType
toBINARY_STRING
when MCU is connected. -
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by thedataTransferState
event triggeringstate
parameter payload asUPLOAD_COMPLETED
for all Peers targeted for request success.-
error
{JSON}The error result in request. Defined as
null
when there are no errors in request-
transferId
{String}The data transfer ID. Defined asnull
whensendBlobData()
fails to start data transfer. -
listOfPeers
{Array}The list Peer IDs targeted for the data transfer. -
transferErrors
{JSON}The list of data transfer errors. -
transferErrors.#peerId
{Error | String}The data transfer error associated with the Peer ID defined in#peerId
property. If#peerId
value is"self"
, it means that it is the error when there are no Peer connections to start data transfer with. -
transferInfo
{JSON}The data transfer information. Object signature matches thetransferInfo
parameter payload received in thedataTransferState
event except without thepercentage
anddata
property.
-
-
success
{JSON}The success result in request. Defined as
null
when there are errors in request-
transferId
{String}The data transfer ID. -
listOfPeers
{Array}The list Peer IDs targeted for the data transfer. -
transferInfo
{JSON}The data transfer information. Object signature matches thetransferInfo
parameter payload received in thedataTransferState
event except without thepercentage
property anddata
.
-
-
sendMessage
message
,
[targetPeerId]
,
)
Note that broadcasted events fromFunction that sends a message to Peers via the Signaling socket connection.muteStream()
method,stopStream()
method,stopScreen()
method,sendMessage()
method,unlockRoom()
method andlockRoom()
method may be queued when sent within less than an interval.
Example:
// Example 1: Broadcasting to all Peers skylinkDemo.sendMessage("Hi all!");
// Example 2: Sending to specific Peers var peersInExclusiveParty = [];
skylinkDemo.on("peerJoined", function (peerId, peerInfo, isSelf) { if (isSelf) return; if (peerInfo.userData.exclusive) { peersInExclusiveParty.push(peerId); } });
function updateExclusivePartyStatus (message) { skylinkDemo.sendMessage(message, peersInExclusiveParty); }
Events Sequence:
- Sends socket connection message to all targeted Peers via Signaling server.
incomingMessage
event triggers parameter payloadmessage.isDataChannel
value asfalse
.
Parameters:
-
message
{String | JSON}The message.
-
targetPeerId
{String | Array} OptionalThe target Peer ID to send message to.
- When provided as an Array, it will send the message to only Peers which IDs are in the list.
- When not provided, it will broadcast the message to all connected Peers in the Room.
sendP2PMessage
message
,
[targetPeerId]
,
)
Function that sends a message to Peers via the Datachannel connection.
Consider using sendURLData()
method if you are
sending large strings to Peers.
Example:
// Example 1: Broadcasting to all Peers skylinkDemo.on("dataChannelState", function (state, peerId, error, channelName, channelType) { if (state === skylinkDemo.DATA_CHANNEL_STATE.OPEN && channelType === skylinkDemo.DATA_CHANNEL_TYPE.MESSAGING) { skylinkDemo.sendP2PMessage("Hi all!"); } });
// Example 2: Sending to specific Peers var peersInExclusiveParty = [];
skylinkDemo.on("peerJoined", function (peerId, peerInfo, isSelf) { if (isSelf) return; if (peerInfo.userData.exclusive) { peersInExclusiveParty[peerId] = false; } });
skylinkDemo.on("dataChannelState", function (state, peerId, error, channelName, channelType) { if (state === skylinkDemo.DATA_CHANNEL_STATE.OPEN && channelType === skylinkDemo.DATA_CHANNEL_TYPE.MESSAGING) { peersInExclusiveParty[peerId] = true; } });
function updateExclusivePartyStatus (message) { var readyToSend = []; for (var p in peersInExclusiveParty) { if (peersInExclusiveParty.hasOwnProperty(p)) { readyToSend.push(p); } } skylinkDemo.sendP2PMessage(message, readyToSend); }
Events Sequence:
- Sends P2P message to all targeted Peers.
- If Peer connection Datachannel has not been opened: This can be checked with
dataChannelState
event triggering parameter payloadstate
asOPEN
andchannelType
asMESSAGING
for Peer.dataChannelState
event triggers parameter payloadstate
asSEND_MESSAGE_ERROR
.- ABORT step and return error.
incomingMessage
event triggers parameter payloadmessage.isDataChannel
value astrue
andisSelf
value astrue
.
- If Peer connection Datachannel has not been opened: This can be checked with
Parameters:
-
message
{String | JSON}The message.
-
targetPeerId
{String | Array} OptionalThe target Peer ID to send message to.
- When provided as an Array, it will send the message to only Peers which IDs are in the list.
- When not provided, it will broadcast the message to all connected Peers with Datachannel connection in the Room.
sendStream
options
,
[callback]
,
)
Note that ifFunction that sends a newshareScreen()
Stream is available despite havinggetUserMedia()
Stream available, theshareScreen()
Stream is sent instead of thegetUserMedia()
Stream to Peers.
getUserMedia()
Stream
to all connected Peers in the Room.
Example:
// Example 1: Send MediaStream object function retrieveStreamBySourceForFirefox (sourceId) { navigator.mediaDevices.getUserMedia({ audio: true, video: { sourceId: { exact: sourceId } } }).then(function (stream) { skylinkDemo.sendStream(stream, function (error, success) { if (err) return; if (stream === success) { console.info("Same MediaStream has been sent"); } console.log("Stream is now being sent to Peers"); attachMediaStream(document.getElementById("my-video"), success); }); }); }
// Example 2: Send video later var inRoom = false;
function sendVideo () { if (!inRoom) return; skylinkDemo.sendStream({ audio: true, video: true }, function (error, success) { if (error) return; console.log("getUserMedia() Stream with video is now being sent to Peers"); attachMediaStream(document.getElementById("my-video"), success); }); }
skylinkDemo.joinRoom({ audio: true }, function (jRError, jRSuccess) { if (jRError) return; inRoom = true; });
Events Sequence:
- If User is not in Room:
- ABORT and return error.
- Checks
options
provided.- If provided parameter
options
is not valid:- ABORT and return error.
- Else if provided parameter
options
is a Stream object:- Checks if there is any audio or video tracks.
- If there is no tracks:
- ABORT and return error.
- Else:
- Set
options.audio
value astrue
if Stream has audio tracks. - Set
options.video
value asfalse
if Stream has video tracks. - Mutes / Unmutes audio and video tracks based on current muted settings in
peerInfo.mediaStatus
. This can be retrieved withgetPeerInfo()
method. - If there is any previous
getUserMedia()
Stream:- Invokes
stopStream()
method to stop previous Stream.
- Invokes
mediaAccessSuccess
event triggers parameter payloadisScreensharing
value asfalse
andisAudioFallback
value asfalse
.
- Set
- If there is no tracks:
- Checks if there is any audio or video tracks.
- Else:
- Invoke
getUserMedia()
method withoptions
provided insendStream()
.- If request has errors:
- ABORT and return error.
- If request has errors:
- Invoke
- If provided parameter
- If there is currently no
shareScreen()
Stream:incomingStream
event triggers parameter payloadisSelf
value astrue
andstream
asgetUserMedia()
Stream.peerUpdated
event triggers parameter payloadisSelf
value astrue
.- Checks if MCU is enabled for App Key provided in
init()
method.- If MCU is enabled:
- Invoke
refreshConnection()
method.- If request has errors:
- ABORT and return error.
- If request has errors:
- Invoke
- Else:
- If there are connected Peers in the Room:
- Invoke
refreshConnection()
method.- If request has errors:
- ABORT and return error.
- If request has errors:
- Invoke
- If there are connected Peers in the Room:
- If MCU is enabled:
Parameters:
-
options
{JSON | MediaStream}The
getUserMedia()
methodoptions
parameter settings.- When provided as a
MediaStream
object, this configures theoptions.audio
andoptions.video
based on the tracks available in theMediaStream
object, and configures theoptions.audio.mute
andoptions.video.mute
based on the tracks.enabled
flags in the tracks provided in theMediaStream
object without invokinggetUserMedia()
method. Object signature matches theoptions
parameter in thegetUserMedia()
method.
- When provided as a
-
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by themediaAccessSuccess
event triggeringisScreensharing
parameter payload value asfalse
for request success when User is in Room without Peers, or by thepeerRestart
event triggeringisSelfInitiateRestart
parameter payload value astrue
for all connected Peers for request success when User is in Room with Peers.-
error
{Error | String}The error result in request. Defined as
null
when there are no errors in request Object signature is thegetUserMedia()
method error or when invalidoptions
is provided. -
success
{MediaStream}The success result in request. Defined as
null
when there are errors in request Object signature is thegetUserMedia()
method Stream object.
-
sendURLData
data
,
[timeout=60]
,
[targetPeerId]
,
[callback]
,
)
Currently, the Android, iOS and C++ SDKs do not support this type of data transfer session.Function that starts an uploading string data transfer from User to Peers.
Example:
<body> <input type="radio" name="timeout" onchange="setTransferTimeout(0)"> 1s timeout (Default) <input type="radio" name="timeout" onchange="setTransferTimeout(120)"> 2s timeout <input type="radio" name="timeout" onchange="setTransferTimeout(300)"> 5s timeout <hr> <input type="file" onchange="showImage(this.files[0], this.getAttribute('data'))" data="peerId"> <input type="file" onchange="showImageGroup(this.files[0], this.getAttribute('data').split(',')))" data="peerIdA,peerIdB"> <input type="file" onchange="showImageAll(this.files[0])" data=""> <image id="target-1" src=""> <image id="target-2" src=""> <image id="target-3" src=""> <script> var transferTimeout = 0;
function setTransferTimeout (timeout) { transferTimeout = timeout; }
function retrieveImageDataURL(file, cb) { var fr = new FileReader(); fr.onload = function () { cb(fr.result); }; fr.readAsDataURL(files[0]); }
// Example 1: Send image data URL to a Peer function showImage (file, peerId) { var cb = function (error, success) { if (error) return; console.info("Image has been transferred to '" + peerId + "' successfully"); }; retrieveImageDataURL(file, function (str) { if (transferTimeout > 0) { skylinkDemo.sendURLData(str, peerId, transferTimeout, cb); } else { skylinkDemo.sendURLData(str, peerId, cb); } document.getElementById("target-1").src = str; }); }
// Example 2: Send image data URL to a list of Peers function showImageGroup (file, peerIds) { var cb = function (error, success) { var listOfPeers = error ? error.listOfPeers : success.listOfPeers; var listOfPeersErrors = error ? error.transferErrors : {}; for (var i = 0; i < listOfPeers.length; i++) { if (listOfPeersErrors[listOfPeers[i]]) { console.error("Failed image transfer to '" + listOfPeers[i] + "'"); } else { console.info("Image has been transferred to '" + listOfPeers[i] + "' successfully"); } } }; retrieveImageDataURL(file, function (str) { if (transferTimeout > 0) { skylinkDemo.sendURLData(str, peerIds, transferTimeout, cb); } else { skylinkDemo.sendURLData(str, peerIds, cb); } document.getElementById("target-2").src = str; }); }
// Example 2: Send image data URL to a list of Peers function uploadFileAll (file) { var cb = function (error, success) { var listOfPeers = error ? error.listOfPeers : success.listOfPeers; var listOfPeersErrors = error ? error.transferErrors : {}; for (var i = 0; i < listOfPeers.length; i++) { if (listOfPeersErrors[listOfPeers[i]]) { console.error("Failed image transfer to '" + listOfPeers[i] + "'"); } else { console.info("Image has been transferred to '" + listOfPeers[i] + "' successfully"); } } }; retrieveImageDataURL(file, function (str) { if (transferTimeout > 0) { skylinkDemo.sendURLData(str, transferTimeout, cb); } else { skylinkDemo.sendURLData(str, cb); } document.getElementById("target-3").src = str; }); } </script> </body>
Events Sequence:
Event sequence followssendBlobData()
method.
Parameters:
-
data
{String}The data string to transfer to Peer.
-
timeout
{Number} OptionalDEFAULT:60
The timeout to wait for response from Peer.
-
targetPeerId
{String | Array} OptionalThe target Peer ID to start data transfer with.
- When provided as an Array, it will start uploading data transfers with all connections with all the Peer IDs provided.
- When not provided, it will start uploading data transfers with all the currently connected Peers in the Room.
-
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by thedataTransferState
event triggeringstate
parameter payload asUPLOAD_COMPLETED
for all Peers targeted for request success.-
error
{JSON}The error result in request. Defined as
null
when there are no errors in request-
transferId
{String}The data transfer ID. Defined asnull
whensendURLData()
fails to start data transfer. -
listOfPeers
{Array}The list Peer IDs targeted for the data transfer. -
transferErrors
{JSON}The list of data transfer errors. -
transferErrors.#peerId
{Error | String}The data transfer error associated with the Peer ID defined in#peerId
property. If#peerId
value is"self"
, it means that it is the error when there are no Peer connections to start data transfer with. -
transferInfo
{JSON}The data transfer information. Object signature matches thetransferInfo
parameter payload received in thedataTransferState
event except without thepercentage
property anddata
.
-
-
success
{JSON}The success result in request. Defined as
null
when there are errors in request-
transferId
{String}The data transfer ID. -
listOfPeers
{Array}The list Peer IDs targeted for the data transfer. -
transferInfo
{JSON}The data transfer information. Object signature matches thetransferInfo
parameter payload received in thedataTransferState
event except without thepercentage
property anddata
.
-
-
setDebugMode
[options=false]
,
)
Function that configures the debugging mode of the SDK.
Example:
// Example 1: Enable both options.storeLogs and options.trace skylinkDemo.setDebugMode(true);
// Example 2: Enable only options.storeLogs skylinkDemo.setDebugMode({ storeLogs: true });
// Example 3: Disable debugging mode skylinkDemo.setDebugMode();
Events Sequence:
There is no event sequence for this method.Parameters:
-
options
{Boolean | JSON} OptionalDEFAULT:false
The debugging options.
- When provided as a boolean, this sets both
options.trace
andoptions.storeLogs
to its boolean value.
-
trace
{Boolean} OptionalDEFAULT:false
The flag if SDK
console
logs should output asconsole.trace()
logs for tracing theFunction
call stack. Note that theconsole.trace()
output logs is determined by the log level setsetLogLevel()
method. Ifconsole.trace()
API is not supported,setDebugMode()
will fallback to useconsole.log()
API. -
storeLogs
{Boolean} OptionalDEFAULT:false
The flag if SDK should store the
console
logs. This is required to be enabled forSkylinkLogs
API.
- When provided as a boolean, this sets both
setLogLevel
[logLevel]
,
)
Function that configures the level of console
API logs to be printed in the
Javascript Web Console.
Example:
// Example 1: Print all of the console.debug, console.log, console.info, console.warn and console.error logs. skylinkDemo.setLogLevel(skylinkDemo.LOG_LEVEL.DEBUG);
// Example 2: Print only the console.log, console.info, console.warn and console.error logs. skylinkDemo.setLogLevel(skylinkDemo.LOG_LEVEL.LOG);
// Example 3: Print only the console.info, console.warn and console.error logs. skylinkDemo.setLogLevel(skylinkDemo.LOG_LEVEL.INFO);
// Example 4: Print only the console.warn and console.error logs. skylinkDemo.setLogLevel(skylinkDemo.LOG_LEVEL.WARN);
// Example 5: Print only the console.error logs. This is done by default. skylinkDemo.setLogLevel(skylinkDemo.LOG_LEVEL.ERROR);
Events Sequence:
There is no event sequence for this method.Parameters:
-
logLevel
{Number} OptionalThe specific log level of logs to return.
- When not provided or that the level does not exists, it will not overwrite the current log level.
By default, the initial log level is
ERROR
. [Rel: Skylink.LOG_LEVEL]
- When not provided or that the level does not exists, it will not overwrite the current log level.
By default, the initial log level is
setUserData
userData
,
)
Function that overwrites the User current custom data.
Example:
// Example 1: Set/Update User custom data before joinRoom() var userData = "beforejoin";
skylinkDemo.setUserData(userData);
skylinkDemo.joinRoom(function (error, success) { if (error) return; if (success.peerInfo.userData === userData) { console.log("User data is sent"); } });
// Example 2: Update User custom data after joinRoom() var userData = "afterjoin";
skylinkDemo.joinRoom(function (error, success) { if (error) return; skylinkDemo.setUserData(userData); if (skylinkDemo.getPeerInfo().userData === userData) { console.log("User data is updated and sent"); } });
Events Sequence:
- Updates User custom data.
- If User is in Room:
peerUpdated
event triggers with parameter payloadisSelf
value astrue
.
- If User is in Room:
Parameters:
-
userData
{JSON | String}The updated custom data.
startRecording
[callback]
,
)
Note that this feature requires MCU and recording to be enabled for the App Key provided in the
init()
method. If recording feature is not available to
be enabled in the Developer Console, please
contact us on our support portal.
Starts a recording session.
Example:
// Example 1: Start recording session skylinkDemo.startRecording(function (error, success) { if (error) return; console.info("Recording session has started. ID ->", success); });
Events Sequence:
- If MCU is not connected:
- ABORT and return error.
- If there is an existing recording session currently going on:
- ABORT and return error.
- Sends to MCU via Signaling server to start recording session.
- If recording session has been started successfully:
recordingState
event triggers parameter payloadstate
asSTART
.
- If recording session has been started successfully:
Parameters:
-
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by therecordingState
event triggeringstate
parameter payload asSTART
.-
error
{Error | String}The error result in request. Defined as
null
when there are no errors in request Object signature is thestartRecording()
error when starting a new recording session. -
success
{String | JSON}The success result in request. Defined as
null
when there are errors in request Object signature is therecordingState
event triggeredrecordingId
parameter payload.
-
stopRecording
[callback]
,
[callbackSuccessWhenLink=false]
,
)
Note that this feature requires MCU and recording to be enabled for the App Key provided in the
init()
method. If recording feature is not available to
be enabled in the Developer Console, please
contact us on our support portal.
Stops a recording session.
Example:
// Example 1: Stop recording session skylinkDemo.stopRecording(function (error, success) { if (error) return; console.info("Recording session has stopped. ID ->", success); });
// Example 2: Stop recording session with mixin videos link skylinkDemo.stopRecording(function (error, success) { if (error) return; console.info("Recording session has compiled with links ->", success.link); }, true);
Events Sequence:
- If MCU is not connected:
- ABORT and return error.
- If there is no existing recording session currently going on:
- ABORT and return error.
- If existing recording session recording time has not elapsed more than 4 seconds:
4 seconds is mandatory for recording session to ensure better recording
experience and stability.
- ABORT and return error.
- Sends to MCU via Signaling server to stop recording session:
- If recording session has been stopped successfully:
recordingState
event triggers parameter payloadstate
asSTART
.- MCU starts mixin recorded session videos:
- If recording session has been mixin successfully with links:
recordingState
event triggers parameter payloadstate
asLINK
.- Else:
recordingState
event triggers parameter payloadstate
asERROR
.- ABORT and return error.
- If recording session has been mixin successfully with links:
- Else:
recordingState
event triggers parameter payloadstate
asERROR
.- ABORT and return error.
- If recording session has been stopped successfully:
Parameters:
-
callback
{Function} OptionalThe callback function fired when request has completed. Function parameters signature is
function (error, success)
Function request completion is determined by therecordingState
event triggeringstate
parameter payload asSTOP
or asLINK
when the value ofcallbackSuccessWhenLink
istrue
.-
error
{Error | String}The error result in request. Defined as
null
when there are no errors in request Object signature is thestopRecording()
error when stopping current recording session. -
success
{String | JSON}The success result in request.
- When
callbackSuccessWhenLink
value isfalse
, it is defined as string as the recording session ID. - when
callbackSuccessWhenLink
value istrue
, it is defined as an object as the recording session information. Defined asnull
when there are errors in request
-
recordingId
{JSON}The recording session ID. -
link
{JSON}The recording session mixin videos link in MP4 format. Object signature matches thelink
parameter payload received in therecordingState
event.
- When
-
-
callbackSuccessWhenLink
{Boolean} OptionalDEFAULT:false
The flag if
callback
function provided should result in success only whenrecordingState
event triggeringstate
parameter payload asLINK
.
stopScreen
()
Note that broadcasted events fromFunction that stopsmuteStream()
method,stopStream()
method,stopScreen()
method,sendMessage()
method,unlockRoom()
method andlockRoom()
method may be queued when sent within less than an interval.
shareScreen()
Stream.
Example:
function stopScreen () { skylinkDemo.stopScreen(); }
skylinkDemo.shareScreen();
Events Sequence:
- Checks if there is
shareScreen()
Stream.- If there is
shareScreen()
Stream:- Stop
shareScreen()
Stream Stream.mediaAccessStopped
event triggers parameter payloadisScreensharing
value astrue
andisAudioFallback
value asfalse
.- If User is in Room:
streamEnded
event triggers parameter payloadisSelf
value astrue
andisScreensharing
value astrue
.peerUpdated
event triggers parameter payloadisSelf
value astrue
.
- If User is in Room: SKIP this step if
stopScreen()
was invoked fromshareScreen()
method.- If there is
getUserMedia()
Stream Stream:incomingStream
event triggers parameter payloadisSelf
value astrue
andstream
asgetUserMedia()
Stream.peerUpdated
event triggers parameter payloadisSelf
value astrue
.
- Invoke
refreshConnection()
method.
- If there is
- Stop
- If there is
stopStream
()
Note that broadcasted events fromFunction that stopsmuteStream()
method,stopStream()
method,stopScreen()
method,sendMessage()
method,unlockRoom()
method andlockRoom()
method may be queued when sent within less than an interval.
getUserMedia()
Stream.
Example:
function stopStream () { skylinkDemo.stopStream(); }
skylinkDemo.getUserMedia();
Events Sequence:
- Checks if there is
getUserMedia()
Stream.- If there is
getUserMedia()
Stream:- Stop
getUserMedia()
Stream Stream.mediaAccessStopped
event triggers parameter payloadisScreensharing
value asfalse
.- If User is in Room:
streamEnded
event triggers parameter payloadisSelf
value astrue
andisScreensharing
value asfalse
.peerUpdated
event triggers parameter payloadisSelf
value astrue
.
- Stop
- If there is
unlockRoom
()
Note that broadcasted events fromFunction that unlocks the current Room when in session to allow other Peers to join the Room.muteStream()
method,stopStream()
method,stopScreen()
method,sendMessage()
method,unlockRoom()
method andlockRoom()
method may be queued when sent within less than an interval.
Events Sequence:
- Requests to Signaling server to unlock Room
roomLock
event triggers parameter payloadisLocked
value asfalse
.
SkylinkLogs
()
To utilise and enable theThe object interface to manage the SDK Javascript Web Console logs.SkylinkLogs
API functionalities, thesetDebugMode()
methodoptions.storeLogs
parameter has to be enabled.
SkylinkLogs.clearAllLogs
()
Function that clears all the current stored SDK console
logs.
Example:
// Example 1: Clear all the logs SkylinkLogs.clearAllLogs();
SkylinkLogs.getLogs
()
Function that gets the current stored SDK console
logs.
Parameters:
-
logLevel
{Number} OptionalThe specific log level of logs to return.
- When not provided or that the level does not exists, it will return all logs of all levels. [Rel: Skylink.LOG_LEVEL]
Returns:
The array of stored logs.
<#index>
{Array}The stored log item.
0
{Date}The DateTime of when the log was stored.
1
{String}The log level. [Rel: Skylink.LOG_LEVEL]
2
{String}The log message.
3
{Any}OptionalThe log message object.
Example:
// Example 1: Get logs of specific level var debugLogs = SkylinkLogs.getLogs(skylinkDemo.LOG_LEVEL.DEBUG);
// Example 2: Get all the logs var allLogs = SkylinkLogs.getLogs();
SkylinkLogs.printAllLogs
()
Function that prints all the current stored SDK console
logs into the
Javascript Web Console.
Example:
// Example 1: Print all the logs SkylinkLogs.printAllLogs();
_audioFallback
Attribute Type: {Boolean}
Stores the flag that indicates if getUserMedia()
should fallback to retrieve
audio only Stream after retrieval of audio and video Stream had failed.
Default value:
false
_autoIntroduce
Attribute Type: {Boolean}
Stores the flag that indicates if "autoIntroduce" is enabled. If enabled, the Peers connecting the same Room will receive each others "enter" message ping.
Default value:
true
_channelOpen
Attribute Type: {Boolean}
Stores the flag that indicates if socket connection to the Signaling has opened.
_CHUNK_DATAURL_SIZE
Attribute Type: {Number}
Stores the data chunk size for data URI string transfers.
_currentRecordingId
Attribute Type: {JSON}
Stores the current active recording session ID. There can only be 1 recording session at a time in a Room
_dataChannels
Attribute Type: {JSON}
Stores the list of Peer Datachannel connections.
Keys:
-
#peerId
{JSON}The list of Datachannels associated with Peer ID.
-
#channelLabel
{RTCDataChannel}The Datachannel connection. The property name
"main"
is reserved for messaging Datachannel type.
-
_dataTransfers
Attribute Type: {JSON}
Stores the list of data transfers from / to Peers.
Keys:
-
#transferId
{JSON}The data transfer session.
_DC_PROTOCOL_TYPE
Attribute Type: {JSON}
Stores the list of data transfer protocols.
Keys:
-
WRQ
{String}The protocol to initiate data transfer.
-
ACK
{String}The protocol to request for data transfer chunk. Give
-1
to reject the request at the beginning and0
to accept the data transfer request. -
CANCEL
{String}The protocol to terminate data transfer.
-
ERROR
{String}The protocol when data transfer has errors and has to be terminated.
-
MESSAGE
{String}The protocol that is used to send P2P messages.
_defaultRoom
Attribute Type: {String}
Stores the default Room name to connect to when joinRoom()
does not provide a Room name.
_disableComfortNoiseCodec
Attribute Type: {Boolean}
Stores the flag if CN (Comfort Noise) codec should be removed.
Default value:
false
_disableREMB
Attribute Type: {Boolean}
Stores the flag if REMB feedback packets should be removed.
Default value:
false
_disableVideoFecCodecs
Attribute Type: {Boolean}
Stores the flag if ulpfec and red codecs should be removed.
Default value:
false
_enableDataChannel
Attribute Type: {Boolean}
Stores the flag if Peers should have any Datachannel connections.
Default value:
true
_enableDebugMode
Attribute Type: {Boolean}
Stores the flag if debugging mode is enabled. This manipulates the SkylinkLogs interface.
Default value:
false
_enableDebugStack
Attribute Type: {Boolean}
Stores the flag if logs should be stored in SkylinkLogs interface.
Default value:
false
_enableDebugTrace
Attribute Type: {Boolean}
Stores the flag if logs should trace if available.
This uses the console.trace
API.
Default value:
false
_enableIceTrickle
Attribute Type: {Boolean}
Stores the flag that indicates if Peer connections should trickle ICE.
Default value:
true
_enableSTUN
Attribute Type: {Boolean}
Stores the flag that indicates if STUN ICE servers should be used when constructing Peer connection.
Default value:
true
_enableTURN
Attribute Type: {Boolean}
Stores the flag that indicates if TURN ICE servers should be used when constructing Peer connection.
Default value:
true
_EVENTS
Attribute Type: {JSON}
Stores the list of on()
event handlers.
Keys:
-
<#event>
{Array}The list of event handlers associated with the event.
-
<#index>
{Function}The event handler function.
-
_forceSSL
Attribute Type: {Boolean}
Stores the flag if HTTPS connections should be enforced when connecting to the API or Signaling server if App is accessing from HTTP domain. HTTPS connections are enforced if App is accessing from HTTPS domains.
Default value:
false
_forceTURN
Attribute Type: {Boolean}
Stores the flag if TURN connections should be enforced when connecting to Peers. This filters all non "relay" ICE candidates to enforce connections via the TURN server.
Default value:
false
_forceTURNSSL
Attribute Type: {Boolean}
Stores the flag if TURNS connections should be enforced when connecting to the TURN server if App is accessing from HTTP domain. TURNS connections are enforced if App is accessing from HTTPS domains.
Default value:
false
_gatheredCandidates
Attribute Type: {JSON}
Stores the list of Peer connection ICE candidates.
Keys:
-
<#peerId>
{JSON}The list of the Peer connection ICE candidates.
-
sending
{JSON}The list of the Peer connection ICE candidates sent.
-
receiving
{JSON}The list of the Peer connection ICE candidates received.
-
_groupMessageList
Attribute Type: {Array}
Stores the list of socket messaging protocol types to queue when sent less than a second interval.
_logLevel
Attribute Type: {String}
Stores the current SDK log level.
Default is ERROR (0
).
Default value:
0
_MOZ_BINARY_FILE_SIZE
Attribute Type: {Number}
Stores the data chunk size for binary Blob transfers.
_MOZ_CHUNK_FILE_SIZE
Attribute Type: {Number}
Stores the data chunk size for Blob transfers transferring from/to Firefox browsers due to limitation tested in the past in some PCs (linx predominatly).
_onceEvents
Attribute Type: {JSON}
Stores the list of once()
event handlers.
These events are only triggered once.
Keys:
-
<#event>
{Array}The list of event handlers associated with the event.
-
<#index>
{Array}The array of event handler function and its condition function.
-
_peerCandidatesQueue
Attribute Type: {JSON}
Stores the list of buffered ICE candidates that is received before remote session description is received and set.
Keys:
-
<#peerId>
{Array}The list of the Peer connection buffered ICE candidates received.
-
<#index>
{Object}The Peer connection buffered ICE candidate received.
-
_peerConnections
Attribute Type: {JSON}
Stores the list of the Peer connections.
Keys:
-
<#peerId>
{Object}The Peer connection.
_peerEndOfCandidatesCounter
Attribute Type: {JSON}
Stores the list of ICE candidates received before signaling end.
_peerInformations
Attribute Type: {JSON}
Stores the list of Peers session information.
Keys:
-
<#peerId>
{JSON}The Peer session information.
-
userData
{JSON | String}The Peer custom data.
-
settings
{JSON}The Peer streaming information.
-
mediaStatus
{JSON}The Peer streaming muted status.
-
agent
{JSON}The Peer agent information.
-
_peerList
Attribute Type: {JSON}
Stores the list of Peers retrieved from the Signaling from getPeers()
method.
_peerPriorityWeight
Attribute Type: {Number}
Stores the User connection priority weight. If Peer has a higher connection weight, it will do the offer from its Peer connection first.
_peerStats
Attribute Type: {JSON}
Stores the list of the Peer connections stats.
Keys:
-
<#peerId>
{Object}The Peer connection stats.
_recordingStartInterval
Attribute Type: {JSON}
Stores the recording session timeout to ensure 4 seconds has been recorded.
_retryCounters
Attribute Type: {JSON}
Stores the global number of Peer connection retries that would increase the wait-for-response timeout for the Peer connection health timer.
_room
Attribute Type: {JSON}
Stores the Room credentials information for joinRoom()
.
Keys:
-
id
{String}The "rid" for
joinRoom()
. -
token
{String}The "roomCred" for
joinRoom()
. -
startDateTime
{String}The "start" for
joinRoom()
. -
duration
{String}The "len" for
joinRoom()
. -
connection
{String}The RTCPeerConnection constraints and configuration. This is not used in the SDK except for the "mediaConstraints" property that sets the default
getUserMedia()
settings.
_roomStart
Attribute Type: {String}
Stores the init()
credentials starting DateTime stamp in ISO 8601.
_selectedAudioCodec
Attribute Type: {String}
Stores the preferred sending Peer connection streaming audio codec.
Default value:
"auto"
_selectedVideoCodec
Attribute Type: {String}
Stores the preferred sending Peer connection streaming video codec.
Default value:
"auto"
_SIG_MESSAGE_TYPE
Attribute Type: {JSON}
Stores the list of socket messaging protocol types.
See confluence docs for the list based on the current SM_PROTOCOL_VERSION
.
_socketMessageQueue
Attribute Type: {Array}
Stores the queued socket messages. This is to prevent too many sent over less than a second interval that might cause dropped messages or jams to the Signaling connection.
_socketMessageTimeout
Attribute Type: {Object}
Stores the setTimeout
to sent queued socket messages.
_socketPorts
Attribute Type: {JSON}
Stores the list of socket ports to use to connect to the Signaling. These ports are defined by default which is commonly used currently by the Signaling. Should re-evaluate this sometime.
Keys:
-
http:
{Array}The list of HTTP socket ports.
-
https:
{Array}The list of HTTPS socket ports.
_socketTimeout
Attribute Type: {Number}
Stores the socket connection timeout when establishing connection to the Signaling.
_socketUseXDR
Attribute Type: {Boolean}
Stores the flag that indicates if XDomainRequest is used for IE 8/9.
_streamsBandwidthSettings
Attribute Type: {JSON}
Stores all the Stream sending maximum bandwidth settings.
_streamsSession
Attribute Type: {JSON}
Stores all the Stream sessions.
Defined as false
when Stream has already ended.
_SUPPORTED_WEB_AGENTS
Attribute Type: {Array}
Stores the list of agent names supported by the Web for Web only functionalities.
_throttlingShouldThrowError
Attribute Type: {JSON}
Stores the flag if throttling should throw when called less than the interval timeout.
_TURNTransport
Attribute Type: {String}
Stores the option for the TURN protocols to use.
This should configure the TURN ICE servers urls ?transport=protocol
flag.
Default value:
"any"
_usePublicSTUN
Attribute Type: {Boolean}
Stores the flag that indicates if public STUN ICE servers should be used when constructing Peer connection.
Default value:
true
_user
Attribute Type: {JSON}
Stores the Signaling user credentials from the API response required for connecting to the Signaling server.
Keys:
-
uid
{String}The API result "username".
-
token
{String}The API result "userCred".
-
timeStamp
{String}The API result "timeStamp".
-
sid
{String}The Signaling server receive user Peer ID.
_userData
Attribute Type: {JSON | String}
Stores the User custom data.
By default, if no custom user data is set, it is an empty string ""
.
Default value:
""
AUDIO_CODEC
Attribute Type: {JSON}
Note that if the audio codec is not supported, the SDK will not configure the localThe list of available audio codecs to set as the preferred audio codec to use to encode sending audio data when available encoded audio codec for Peer connections configured in the"offer"
or"answer"
session description to prefer the codec.
init()
method.
Keys:
-
AUTO
{String}Value
"auto"
The value of the option to not prefer any audio codec but rather use the created local"offer"
/"answer"
session description audio codec preference. -
OPUS
{String}Value
"opus"
The value of the option to prefer the OPUS audio codec. -
ISAC
{String}Value
"ISAC"
The value of the option to prefer the ISAC audio codec. -
G722
{String}Value
"G722"
The value of the option to prefer the G722 audio codec.
CANDIDATE_GENERATION_STATE
Attribute Type: {JSON}
Learn more about how ICE works in this article here.The list of Peer connection ICE gathering states.
Keys:
-
GATHERING
{String}Value
"gathering"
The value of the state when Peer connection is gathering ICE candidates. These ICE candidates are sent to Peer for its connection to check for a suitable matching pair of ICE candidates to establish an ICE connection for stream audio, video and data. SeeiceConnectionState
event for ICE connection status. This state cannot happen until Peer connection remote"offer"
/"answer"
session description is set. SeepeerConnectionState
event for session description exchanging status. -
COMPLETED
{String}Value
"completed"
The value of the state when Peer connection gathering of ICE candidates has completed.
CANDIDATE_PROCESSING_STATE
Attribute Type: {JSON}
Learn more about how ICE works in this article here.The list of Peer connection remote ICE candidate processing states for trickle ICE connections.
Keys:
-
RECEIVED
{String}Value
"received"
The value of the state when the remote ICE candidate was received. -
DROPPED
{String}Value
"received"
The value of the state when the remote ICE candidate is dropped. -
BUFFERED
{String}Value
"buffered"
The value of the state when the remote ICE candidate is buffered. -
PROCESSING
{String}Value
"processing"
The value of the state when the remote ICE candidate is being processed. -
PROCESS_SUCCESS
{String}Value
"processSuccess"
The value of the state when the remote ICE candidate has been processed successfully. The ICE candidate that is processed will be used to check against the list of locally generated ICE candidate to start matching for the suitable pair for the best ICE connection. -
PROCESS_ERROR
{String}Value
"processError"
The value of the state when the remote ICE candidate has failed to be processed.
DATA_CHANNEL_MESSAGE_ERROR
Attribute Type: {JSON}
The list of Datachannel sending message error types.
Keys:
-
MESSAGE
{String}Value
"message"
The value of the Datachannel sending message error type when encountered during sending P2P message fromsendP2PMessage()
method. -
TRANSFER
{String}Value
"transfer"
The value of the Datachannel sending message error type when encountered during data transfers fromsendURLData()
method orsendBlobData()
method.
DATA_CHANNEL_STATE
Attribute Type: {JSON}
The list of Datachannel connection states.
Keys:
-
CONNECTING
{String}Value
"connecting"
The value of the state when Datachannel is attempting to establish a connection. -
OPEN
{String}Value
"open"
The value of the state when Datachannel has established a connection. -
CLOSING
{String}Value
"closing"
The value of the state when Datachannel connection is closing. -
CLOSED
{String}Value
"closed"
The value of the state when Datachannel connection has closed. -
ERROR
{String}Value
"error"
The value of the state when Datachannel has encountered an exception during connection. -
CREATE_ERROR
{String}Value
"createError"
The value of the state when Datachannel has failed to establish a connection. -
BUFFERED_AMOUNT_LOW
{String}Value
"bufferedAmountLow"
The value of the state when Datachannel when the amount of data buffered to be sent falls below the Datachannel threshold. This state should occur only during aftersendBlobData()
method orsendURLData()
method orsendP2PMessage()
method. -
SEND_MESSAGE_ERROR
{String}Value
"sendMessageError"
The value of the state when Datachannel when data transfer packets or P2P message fails to send. This state should occur only during aftersendBlobData()
method orsendURLData()
method orsendP2PMessage()
method.
DATA_CHANNEL_TYPE
Attribute Type: {JSON}
The list of Datachannel types.
Keys:
-
MESSAGING
{String}Value
"messaging"
The value of the Datachannel type that is used only for messaging insendP2PMessage()
method. However for Peers that do not support simultaneous data transfers, this Datachannel type will be used to do data transfers (1 at a time). Each Peer connections will only have one of this Datachannel type and the connection will only close when the Peer connection is closed (happens whenpeerConnectionState
event triggers parameter payloadstate
asCLOSED
for Peer). -
DATA
{String}Value
"data"
The value of the Datachannel type that is used only for a data transfer insendURLData()
method andsendBlobData()
method. The connection will close after the data transfer has been completed or terminated (happens whendataTransferState
event triggers parameter payloadstate
asDOWNLOAD_COMPLETED
,UPLOAD_COMPLETED
,REJECTED
,CANCEL
orERROR
for Peer).
DATA_TRANSFER_DATA_TYPE
Attribute Type: {JSON}
The list of supported data transfer data types.
Keys:
-
BINARY_STRING
{String}Value
"binaryString"
The value of data transfer data type when Blob binary data chunks encoded to Base64 encoded string are sent or received over the Datachannel connection for the data transfer session. Used only insendBlobData()
method when parametersendChunksAsBinary
value isfalse
. -
ARRAY_BUFFER
{String}Value
"arrayBuffer"
The value of data transfer data type when ArrayBuffer binary data chunks are sent or received over the Datachannel connection for the data transfer session. Used only insendBlobData()
method when parametersendChunksAsBinary
value istrue
. -
BLOB
{String}Value
"blob"
The value of data transfer data type when Blob binary data chunks are sent or received over the Datachannel connection for the data transfer session. Used only insendBlobData()
method when parametersendChunksAsBinary
value istrue
. -
STRING
{String}Value
"string"
The value of data transfer data type when only string data chunks are sent or received over the Datachannel connection for the data transfer session. Used only insendURLData()
method.
DATA_TRANSFER_SESSION_TYPE
Attribute Type: {JSON}
The list of data transfers session types.
Keys:
-
BLOB
{String}Value
"blob"
The value of the session type forsendURLData()
method data transfer. -
DATA_URL
{String}Value
"dataURL"
The value of the session type formethod_sendBlobData()
method data transfer.
DATA_TRANSFER_STATE
Attribute Type: {JSON}
The list of data transfer states.
Keys:
-
UPLOAD_REQUEST
{String}Value
"request"
The value of the state when receiving an upload data transfer request from Peer to User. At this stage, the upload data transfer request from Peer may be accepted or rejected with theacceptDataTransfer()
method invoked by User. -
USER_UPLOAD_REQUEST
{String}Value
"userRequest"
The value of the state when User sent an upload data transfer request to Peer. At this stage, the upload data transfer request to Peer may be accepted or rejected with theacceptDataTransfer()
method invoked by Peer. -
UPLOAD_STARTED
{String}Value
"uploadStarted"
The value of the state when the data transfer request has been accepted and data transfer will start uploading data to Peer. At this stage, the data transfer may be terminated with thecancelDataTransfer()
method. -
DOWNLOAD_STARTED
{String}Value
"downloadStarted"
The value of the state when the data transfer request has been accepted and data transfer will start downloading data from Peer. At this stage, the data transfer may be terminated with thecancelDataTransfer()
method. -
REJECTED
{String}Value
"rejected"
The value of the state when upload data transfer request to Peer has been rejected and terminated. -
USER_REJECTED
{String}Value
"userRejected"
The value of the state when User rejected and terminated upload data transfer request from Peer. -
UPLOADING
{String}Value
"uploading"
The value of the state when data transfer is uploading data to Peer. -
DOWNLOADING
{String}Value
"downloading"
The value of the state when data transfer is downloading data from Peer. -
UPLOAD_COMPLETED
{String}Value
"uploadCompleted"
The value of the state when data transfer has uploaded successfully to Peer. -
DOWNLOAD_COMPLETED
{String}Value
"downloadCompleted"
The value of the state when data transfer has downloaded successfully from Peer. -
CANCEL
{String}Value
"cancel"
The value of the state when data transfer has been terminated from / to Peer. -
ERROR
{String}Value
"error"
The value of the state when data transfer has errors and has been terminated from / to Peer.
DATA_TRANSFER_TYPE
Attribute Type: {JSON}
The list of data transfers directions.
Keys:
-
UPLOAD
{String}Value
"upload"
The value of the data transfer direction when User is uploading data to Peer. -
DOWNLOAD
{String}Value
"download"
The value of the data transfer direction when User is downloading data from Peer.
DT_PROTOCOL_VERSION
Attribute Type: {String}
Note that this is used only for SDK developer purposes.The value of the current version of the data transfer protocol.
Current version:0.1.0
GET_CONNECTION_STATUS_STATE
Attribute Type: {JSON}
The list of getConnectionStatus()
method retrieval states.
Keys:
-
RETRIEVING
{Number}Value
0
The value of the state whengetConnectionStatus()
is retrieving the Peer connection stats. -
RETRIEVE_SUCCESS
{Number}Value
1
The value of the state whengetConnectionStatus()
has retrieved the Peer connection stats successfully. -
RETRIEVE_ERROR
{Number}Value
-1
The value of the state whengetConnectionStatus()
has failed retrieving the Peer connection stats.
GET_PEERS_STATE
Attribute Type: {JSON}
Note that this feature requiresThe list of"isPrivileged"
flag to be enabled for the App Key provided in theinit()
method, as only Users connecting using the App Key with this flag enabled (which we call privileged Users / Peers) can retrieve the list of Peer IDs from Rooms within the same App space. Read more about privileged App Key feature here.
getPeers()
method retrieval states.
Keys:
-
ENQUIRED
{String}Value
"enquired"
The value of the state whengetPeers()
is retrieving the list of Peer IDs from Rooms within the same App space from the Signaling server. -
RECEIVED
{String}Value
"received"
The value of the state whengetPeers()
has retrieved the list of Peer IDs from Rooms within the same App space from the Signaling server successfully.
HANDSHAKE_PROGRESS
Attribute Type: {JSON}
The list of Peer connection states.
Keys:
-
ENTER
{String}Value
"enter"
The value of the connection state when Peer has just entered the Room. At this stage,peerJoined
event is triggered. -
WELCOME
{String}Value
"welcome"
The value of the connection state when Peer is aware that User has entered the Room. At this stage,peerJoined
event is triggered and Peer connection may commence. -
OFFER
{String}Value
"offer"
The value of the connection state when Peer connection has set the local / remote"offer"
session description to start streaming connection. -
ANSWER
{String}Value
"answer"
The value of the connection state when Peer connection has set the local / remote"answer"
session description to establish streaming connection. -
ERROR
{String}Value
"error"
The value of the connection state when Peer connection has failed to establish streaming connection. This happens when there are errors that occurs in creating local"offer"
/"answer"
, or when setting remote / local"offer"
/"answer"
.
ICE_CONNECTION_STATE
Attribute Type: {JSON}
Learn more about how ICE works in this article here.The list of Peer connection ICE connection states.
Keys:
-
CHECKING
{String}Value
"checking"
The value of the state when Peer connection is checking for a suitable matching pair of ICE candidates to establish ICE connection. Exchanging of ICE candidates happens duringcandidateGenerationState
event. -
CONNECTED
{String}Value
"connected"
The value of the state when Peer connection has found a suitable matching pair of ICE candidates to establish ICE connection but is still checking for a better suitable matching pair of ICE candidates for the best ICE connectivity. At this state, ICE connection is already established and audio, video and data streaming has already started. -
COMPLETED
{String}Value
"completed"
The value of the state when Peer connection has found the best suitable matching pair of ICE candidates to establish ICE connection and checking has stopped. At this state, ICE connection is already established and audio, video and data streaming has already started. This may happpen afterCONNECTED
. -
FAILED
{String}Value
"failed"
The value of the state when Peer connection ICE connection has failed. -
DISCONNECTED
{String}Value
"disconnected"
The value of the state when Peer connection ICE connection is disconnected. At this state, the Peer connection may attempt to revive the ICE connection. This may happen due to flaky network conditions. -
CLOSED
{String}Value
"closed"
The value of the state when Peer connection ICE connection has closed. This happens when Peer connection is closed and no streaming can occur at this stage. -
TRICKLE_FAILED
{String}Value
"trickeFailed"
The value of the state when Peer connection ICE connection has failed during trickle ICE. Trickle ICE is enabled ininit()
methodenableIceTrickle
option.
INTRODUCE_STATE
Attribute Type: {}
Note that this feature requiresThe list of"isPrivileged"
flag to be enabled and"autoIntroduce"
flag to be disabled for the App Key provided in theinit()
method, as only Users connecting using the App Key with this flag enabled (which we call privileged Users / Peers) can retrieve the list of Peer IDs from Rooms within the same App space. Read more about privileged App Key feature here.
introducePeer
method Peer introduction request states.
Keys:
-
INTRODUCING
{String}Value
"enquired"
The value of the state when introduction request for the selected pair of Peers has been made to the Signaling server. -
ERROR
{String}Value
"error"
The value of the state when introduction request made to the Signaling server for the selected pair of Peers has failed.
isPrivileged
Attribute Type: {Boolean}
Stores the flag that indicates if "isPrivileged" is enabled.
If enabled, the User has Privileged features which has the ability to retrieve the list of
Peers in the same App space with getPeers()
method
and introduce Peers to each other with introducePeer
method.
Default value:
false
log
Attribute Type: {JSON}
Stores the logging functions.
Keys:
-
debug
{Function}The function that handles the DEBUG level logs.
-
log
{Function}The function that handles the LOG level logs.
-
info
{Function}The function that handles the INFO level logs.
-
warn
{Function}The function that handles the WARN level logs.
-
error
{Function}The function that handles the ERROR level logs.
LOG_LEVEL
Attribute Type: {JSON}
The list of the SDK console
API log levels.
Keys:
-
DEBUG
{Number}Value
4
The value of the log level that displaysconsole
debug
,log
,info
,warn
anderror
logs. -
LOG
{Number}Value
3
The value of the log level that displays onlyconsole
log
,info
,warn
anderror
logs. -
INFO
{Number}Value
2
The value of the log level that displays onlyconsole
info
,warn
anderror
logs. -
WARN
{Number}Value
1
The value of the log level that displays onlyconsole
warn
anderror
logs. -
ERROR
{Number}Value
0
The value of the log level that displays onlyconsole
error
logs. -
NONE
{Number}Value
-1
The value of the log level that displays no logs.
MEDIA_ACCESS_FALLBACK_STATE
Attribute Type: {}
The list of getUserMedia()
method or
shareScreen()
method Stream fallback states.
Keys:
-
FALLBACKING
{JSON}Value
0
The value of the state whengetUserMedia()
will retrieve audio track only when retrieving audio and video tracks failed. This can be configured byinit()
methodaudioFallback
option. -
FALLBACKED
{JSON}Value
1
The value of the state whengetUserMedia()
orshareScreen()
retrieves camera / screensharing Stream successfully but with missing originally required audio or video tracks. -
ERROR
{JSON}Value
-1
The value of the state whengetUserMedia()
failed to retrieve audio track only after retrieving audio and video tracks failed.
PEER_CONNECTION_STATE
Attribute Type: {JSON}
Learn more about how ICE works in this article here.The list of Peer connection session description exchanging states.
Keys:
-
STABLE
{String}Value
"stable"
The value of the state when there is no session description being exchanged between Peer connection. -
HAVE_LOCAL_OFFER
{String}Value
"have-local-offer"
The value of the state when local"offer"
session description is set. This should transition toSTABLE
state after remote"answer"
session description is set. SeehandshakeProgress
event for a more detailed exchanging of session description states. -
HAVE_REMOTE_OFFER
{String}Value
"have-remote-offer"
The value of the state when remote"offer"
session description is set. This should transition toSTABLE
state after local"answer"
session description is set. SeehandshakeProgress
event for a more detailed exchanging of session description states. -
CLOSED
{String}Value
"closed"
The value of the state when Peer connection is closed and no session description can be exchanged and set.
READY_STATE_CHANGE
Attribute Type: {JSON}
The list of init()
method ready states.
Keys:
-
INIT
{Number}Value
0
The value of the state wheninit()
has just started. -
LOADING
{Number}Value
1
The value of the state wheninit()
is authenticating App Key provided (and with credentials if provided as well) with the Auth server. -
COMPLETED
{Number}Value
2
The value of the state wheninit()
has successfully authenticated with the Auth server. Room session token is generated for joining thedefaultRoom
provided ininit()
. Room session token has to be generated each time User switches to a different Room injoinRoom()
method. -
ERROR
{Number}Value
-1
The value of the state wheninit()
has failed authenticating with the Auth server. [Rel: Skylink.READY_STATE_CHANGE_ERROR]
READY_STATE_CHANGE_ERROR
Attribute Type: {JSON}
The list of init()
method ready state failure codes.
Keys:
-
API_INVALID
{Number}Value
4001
The value of the failure code when provided App Key ininit()
does not exists. To resolve this, check that the provided App Key exists in the Temasys Console. -
API_DOMAIN_NOT_MATCH
{Number}Value
4002
The value of the failure code when"domainName"
property in the App Key does not match the accessing server IP address. To resolve this, contact our support portal. -
API_CORS_DOMAIN_NOT_MATCH
{Number}Value
4003
The value of the failure code when"corsurl"
property in the App Key does not match accessing CORS. To resolve this, configure the App Key CORS in the Temasys Console. -
API_CREDENTIALS_INVALID
{Number}Value
4004
The value of the failure code when there is no CORS present in the HTTP headers during the request to the Auth server present noroptions.credentials.credentials
configuration provided in theinit()
. To resolve this, ensure that CORS are present in the HTTP headers during the request to the Auth server. -
API_CREDENTIALS_NOT_MATCH
{Number}Value
4005
The value of the failure code when theoptions.credentials.credentials
configuration provided in theinit()
does not match up with theoptions.credentials.startDateTime
,options.credentials.duration
or that the"secret"
used to generateoptions.credentials.credentials
does not match the App Key's"secret
property provided. To resolve this, check that theoptions.credentials.credentials
is generated correctly and that the"secret"
used to generate it is from the App Key provided in theinit()
. -
API_INVALID_PARENT_KEY
{Number}Value
4006
The value of the failure code when the App Key provided does not belong to any existing App. To resolve this, check that the provided App Key exists in the Developer Console. -
API_NO_MEETING_RECORD_FOUND
{Number}Value
4010
The value of the failure code when providedoptions.credentials
does not match any scheduled meetings available for the "Persistent Room" enabled App Key provided. See the Persistent Room article to learn more. -
API_OVER_SEAT_LIMIT
{Number}Value
4020
The value of the failure code when App Key has reached its current concurrent users limit. To resolve this, use another App Key. To create App Keys dynamically, see the Application REST API docs for more information. -
API_RETRIEVAL_FAILED
{Number}Value
4021
The value of the failure code when App Key retrieval of authentication token fails. If this happens frequently, contact our support portal. -
API_WRONG_ACCESS_DOMAIN
{Number}Value
5005
The value of the failure code when App Key makes request to the incorrect Auth server. To resolve this, ensure that theroomServer
is not configured. If this persists even withoutroomServer
configuration, contact our support portal. -
XML_HTTP_REQUEST_ERROR
{Number}Value
-1
The value of the failure code when requesting to Auth server has timed out. -
NO_SOCKET_IO
{Number}Value
1
The value of the failure code when dependency Socket.IO client is not loaded. To resolve this, ensure that the Socket.IO client dependency is loaded before the Skylink SDK. You may use the provided Socket.IO client CDN here. -
NO_XMLHTTPREQUEST_SUPPORT
{Number}Value
2
The value of the failure code when XMLHttpRequest API required to make request to Auth server is not supported. To resolve this, display in the Web UI to ask clients to switch to the list of supported browser as listed in here. -
NO_WEBRTC_SUPPORT
{Number}Value
3
The value of the failure code when RTCPeerConnection API required for Peer connections is not supported. To resolve this, display in the Web UI to ask clients to switch to the list of supported browser as listed in here. For plugin supported browsers, if the clients does not have the plugin installed, there will be an installation toolbar that will prompt for installation to support the RTCPeerConnection API. -
NO_PATH
{Number}Value
4
The value of the failure code when providedinit()
configuration has errors. -
ADAPTER_NO_LOADED
{Number}
RECORDING_STATE
Attribute Type: {JSON}
The list of recording states.
Keys:
-
START
{Number}Value
0
The value of the state when recording session has started. -
STOP
{Number}Value
1
The value of the state when recording session has stopped.
At this stage, the recorded videos will go through the mixin server to compile the videos. -
LINK
{Number}Value
2
The value of the state when recording session mixin request has been completed. -
ERROR
{Number}Value
-1
The value of the state state when recording session has errors. This can happen during recording session or during mixin of recording videos, and at this stage, any current recording session or mixin is aborted.
REGIONAL_SERVER
Attribute Type: {JSON}
Spoofs the REGIONAL_SERVER to prevent errors on deployed apps except the fact this no longer works. Automatic regional selection has already been implemented hence REGIONAL_SERVER is no longer useful.
SERVER_PEER_TYPE
Attribute Type: {JSON}
As there are more features getting implemented, there will be eventually more different types of server Peers.The list of available types of server Peer connections.
Keys:
-
MCU
{String}Value
"mcu"
The value of the server Peer type that is used for MCU connection.
SM_PROTOCOL_VERSION
Attribute Type: {String}
Note that this is used only for SDK developer purposes.The value of the current version of the Signaling socket message protocol.
Current version:0.1.1
SOCKET_ERROR
Attribute Type: {JSON}
The list of joinRoom()
method socket connection failure states.
Keys:
-
CONNECTION_FAILED
{Number}Value
0
The value of the failure state whenjoinRoom()
socket connection failed to establish with the Signaling server at the first attempt. -
RECONNECTION_FAILED
{Number}Value
-1
The value of the failure state whenjoinRoom()
socket connection failed to establish the Signaling server after the first attempt. -
CONNECTION_ABORTED
{Number}Value
-2
The value of the failure state whenjoinRoom()
socket connection will not attempt to reconnect after the failure of the first attempt inCONNECTION_FAILED
as there are no more ports or transports to attempt for reconnection. -
RECONNECTION_ABORTED
{Number}Value
-3
The value of the failure state whenjoinRoom()
socket connection will not attempt to reconnect after the failure of several attempts inRECONNECTION_FAILED
as there are no more ports or transports to attempt for reconnection. -
RECONNECTION_ATTEMPT
{Number}Value
-4
The value of the failure state whenjoinRoom()
socket connection is attempting to reconnect with a new port or transport after the failure of attempts inCONNECTION_FAILED
orRECONNECTED_FAILED
.
SOCKET_FALLBACK
Attribute Type: {JSON}
The list of joinRoom()
method socket connection reconnection states.
Keys:
-
NON_FALLBACK
{String}Value
"nonfallback"
The value of the reconnection state whenjoinRoom()
socket connection is at its initial state without transitioning to any new socket port or transports yet. -
FALLBACK_PORT
{String}Value
"fallbackPortNonSSL"
The value of the reconnection state whenjoinRoom()
socket connection is reconnecting with another new HTTP port using WebSocket transports to attempt to establish connection with Signaling server. -
FALLBACK_PORT_SSL
{String}Value
"fallbackPortSSL"
The value of the reconnection state whenjoinRoom()
socket connection is reconnecting with another new HTTPS port using WebSocket transports to attempt to establish connection with Signaling server. -
LONG_POLLING
{String}Value
"fallbackLongPollingNonSSL"
The value of the reconnection state whenjoinRoom()
socket connection is reconnecting with another new HTTP port using Polling transports to attempt to establish connection with Signaling server. -
LONG_POLLING
{String}Value
"fallbackLongPollingSSL"
The value of the reconnection state whenjoinRoom()
socket connection is reconnecting with another new HTTPS port using Polling transports to attempt to establish connection with Signaling server.
SYSTEM_ACTION
Attribute Type: {JSON}
The list of Signaling server reaction states during joinRoom()
method.
Keys:
-
WARNING
{String}Value
"warning"
The value of the state when Room session is about to end. -
REJECT
{String}Value
"reject"
The value of the state when Room session has failed to start or has ended.
SYSTEM_ACTION_REASON
Attribute Type: {JSON}
The list of Signaling server reaction states reason of action code during
joinRoom()
method.
Keys:
-
CREDENTIALS_EXPIRED
{String}Value
"oldTimeStamp"
The value of the reason code when Room session token has expired. Happens duringjoinRoom()
method request. Results with:REJECT
-
CREDENTIALS_ERROR
{String}Value
"credentialError"
The value of the reason code when Room session token provided is invalid. Happens duringjoinRoom()
method request. -
DUPLICATED_LOGIN
{String}Value
"duplicatedLogin"
The value of the reason code when Room session token has been used already. Happens duringjoinRoom()
method request. Results with:REJECT
-
ROOM_NOT_STARTED
{String}Value
"notStart"
The value of the reason code when Room session has not started. Happens duringjoinRoom()
method request. Results with:REJECT
-
EXPIRED
{String}Value
"expired"
The value of the reason code when Room session has ended already. Happens duringjoinRoom()
method request. Results with:REJECT
-
ROOM_LOCKED
{String}Value
"locked"
The value of the reason code when Room is locked. Happens duringjoinRoom()
method request. Results with:REJECT
-
FAST_MESSAGE
{String}Value
"fastmsg"
The value of the reason code when User is flooding socket messages to the Signaling server that is sent too quickly within less than a second interval. Happens after Room session has started. This can be caused by various methods likesendMessage()
method,setUserData()
method,muteStream()
method,enableAudio()
method,enableVideo()
method,disableAudio()
method anddisableVideo()
method Results with:WARNING
-
ROOM_CLOSING
{String}Value
"toClose"
The value of the reason code when Room session is ending. Happens after Room session has started. This serves as a prerequisite warning beforeROOM_CLOSED
occurs. Results with:WARNING
-
ROOM_CLOSED
{String}Value
"roomclose"
The value of the reason code when Room session has just ended. Happens after Room session has started. Results with:REJECT
-
SERVER_ERROR
{String}Value
"serverError"
The value of the reason code when Room session fails to start due to some technical errors. Happens duringjoinRoom()
method request. Results with:REJECT
-
KEY_ERROR
{String}Value
"keyFailed"
The value of the reason code when Room session fails to start due to some technical error pertaining to App Key initialization. Happens duringjoinRoom()
method request. Results with:REJECT
TURN_TRANSPORT
Attribute Type: {JSON}
Note that configuring the protocol may not necessarily result in the desired network transports protocol
used in the actual TURN network traffic as it depends which protocol the browser selects and connects with.
This simply configures the TURN ICE server urls query option when constructing
the Peer connection. When all protocols are selected, the ICE servers urls are duplicated with all protocols.
The list of TURN network transport protocols options when constructing Peer connections
configured in the init()
method.
Example .urls
inital input: ["turn:server.com?transport=tcp"
,
"turn:server1.com:3478"
, "turn:server.com?transport=udp"
]
Keys:
-
TCP
{String}Value
"tcp"
The value of the option to configure using only TCP network transport protocol. Example.urls
output: ["turn:server.com?transport=tcp"
,"turn:server1.com:3478?transport=tcp"
] -
UDP
{String}Value
"udp"
The value of the option to configure using only UDP network transport protocol. Example.urls
output: ["turn:server.com?transport=udp"
,"turn:server1.com:3478?transport=udp"
] -
ANY
{String}Value
"any"
The value of the option to configure using any network transport protocols configured from the Signaling server. Example.urls
output: ["turn:server.com?transport=tcp"
,"turn:server1.com:3478"
,"turn:server.com?transport=udp"
] -
NONE
{String}Value
"none"
The value of the option to not configure using any network transport protocols. Example.urls
output: ["turn:server.com"
,"turn:server1.com:3478"
] Configuring this does not mean that no protocols will be used, but rather removing?transport=(protocol)
query option in the TURN ICE server.urls
when constructing the Peer connection. -
ALL
{String}Value
"all"
The value of the option to configure using both TCP and UDP network transport protocols. Example.urls
output: ["turn:server.com?transport=tcp"
,"turn:server.com?transport=udp"
,"turn:server1.com:3478?transport=tcp"
,"turn:server1.com:3478?transport=udp"
]
VIDEO_CODEC
Attribute Type: {JSON}
Note that if the video codec is not supported, the SDK will not configure the localThe list of available video codecs to set as the preferred video codec to use to encode sending video data when available encoded video codec for Peer connections configured in the"offer"
or"answer"
session description to prefer the codec.
init()
method.
Keys:
-
AUTO
{String}Value
"auto"
The value of the option to not prefer any video codec but rather use the created local"offer"
/"answer"
session description video codec preference. -
VP8
{String}Value
"VP8"
The value of the option to prefer the VP8 video codec. -
VP9
{String}Value
"VP9"
The value of the option to prefer the VP9 video codec. -
H264
{String}Value
"H264"
The value of the option to prefer the H264 video codec.
VIDEO_RESOLUTION
Attribute Type: {JSON}
Note that currently getUserMedia()
method only configures
the maximum resolution of the Stream due to browser interopability and support.
The list of
video resolutions sets configured in the getUserMedia()
method.
Keys:
-
QQVGA
{JSON}Value
{ width: 160, height: 120 }
The value of the option to configure QQVGA resolution. Aspect ratio:4:3
Note that configurating this resolution may not be supported depending on browser and device supports. -
HQVGA
{JSON}Value
{ width: 240, height: 160 }
The value of the option to configure HQVGA resolution. Aspect ratio:3:2
Note that configurating this resolution may not be supported depending on browser and device supports. -
QVGA
{JSON}Value
{ width: 320, height: 240 }
The value of the option to configure QVGA resolution. Aspect ratio:4:3
-
WQVGA
{JSON}Value
{ width: 384, height: 240 }
The value of the option to configure WQVGA resolution. Aspect ratio:16:10
Note that configurating this resolution may not be supported depending on browser and device supports. -
HVGA
{JSON}Value
{ width: 480, height: 320 }
The value of the option to configure HVGA resolution. Aspect ratio:3:2
Note that configurating this resolution may not be supported depending on browser and device supports. -
VGA
{JSON}Value
{ width: 640, height: 480 }
The value of the option to configure VGA resolution. Aspect ratio:4:3
-
WVGA
{JSON}Value
{ width: 768, height: 480 }
The value of the option to configure WVGA resolution. Aspect ratio:16:10
Note that configurating this resolution may not be supported depending on browser and device supports. -
FWVGA
{JSON}Value
{ width: 854, height: 480 }
The value of the option to configure FWVGA resolution. Aspect ratio:16:9
Note that configurating this resolution may not be supported depending on browser and device supports. -
SVGA
{JSON}Value
{ width: 800, height: 600 }
The value of the option to configure SVGA resolution. Aspect ratio:4:3
Note that configurating this resolution may not be supported depending on browser and device supports. -
DVGA
{JSON}Value
{ width: 960, height: 640 }
The value of the option to configure DVGA resolution. Aspect ratio:3:2
Note that configurating this resolution may not be supported depending on browser and device supports. -
WSVGA
{JSON}Value
{ width: 1024, height: 576 }
The value of the option to configure WSVGA resolution. Aspect ratio:16:9
-
HD
{JSON}Value
{ width: 1280, height: 720 }
The value of the option to configure HD resolution. Aspect ratio:16:9
Note that configurating this resolution may not be supported depending on device supports. -
HDPLUS
{JSON}Value
{ width: 1600, height: 900 }
The value of the option to configure HDPLUS resolution. Aspect ratio:16:9
Note that configurating this resolution may not be supported depending on browser and device supports. -
FHD
{JSON}Value
{ width: 1920, height: 1080 }
The value of the option to configure FHD resolution. Aspect ratio:16:9
Note that configurating this resolution may not be supported depending on device supports. -
QHD
{JSON}Value
{ width: 2560, height: 1440 }
The value of the option to configure QHD resolution. Aspect ratio:16:9
Note that configurating this resolution may not be supported depending on browser and device supports. -
WQXGAPLUS
{JSON}Value
{ width: 3200, height: 1800 }
The value of the option to configure WQXGAPLUS resolution. Aspect ratio:16:9
Note that configurating this resolution may not be supported depending on browser and device supports. -
UHD
{JSON}Value
{ width: 3840, height: 2160 }
The value of the option to configure UHD resolution. Aspect ratio:16:9
Note that configurating this resolution may not be supported depending on browser and device supports. -
UHDPLUS
{JSON}Value
{ width: 5120, height: 2880 }
The value of the option to configure UHDPLUS resolution. Aspect ratio:16:9
Note that configurating this resolution may not be supported depending on browser and device supports. -
FUHD
{JSON}Value
{ width: 7680, height: 4320 }
The value of the option to configure FUHD resolution. Aspect ratio:16:9
Note that configurating this resolution may not be supported depending on browser and device supports. -
QUHD
{JSON}Value
{ width: 15360, height: 8640 }
The value of the option to configure QUHD resolution. Aspect ratio:16:9
Note that configurating this resolution may not be supported depending on browser and device supports.
candidateGenerationState
Learn more about how ICE works in this article here.Event triggered when a Peer connection ICE gathering state has changed.
Event Payload:
-
state
{String}The current Peer connection ICE gathering state. [Rel: Skylink.CANDIDATE_GENERATION_STATE]
-
peerId
{String}The Peer ID.
candidateProcessingState
Learn more about how ICE works in this article here.Event triggered when remote ICE candidate processing state has changed when Peer is using trickle ICE.
Note that this event may not be triggered for MCU enabled Peer connections as ICE candidates may be received in the session description instead.
Event Payload:
-
state
{String}The ICE candidate processing state. [Rel: Skylink.CANDIDATE_PROCESSING_STATE]
-
peerId
{String}The Peer ID.
-
candidateId
{String}The remote ICE candidate session ID. Note that this value is not related to WebRTC API but for identification of remote ICE candidate received.
-
candidateType
{String}The remote ICE candidate type. Expected values are
"host"
(local network),"srflx"
(STUN) and"relay"
(TURN). -
candidate
{JSON}The remote ICE candidate.
-
candidate
{String}The remote ICE candidate connection description.
-
sdpMid
{String}The remote ICE candidate identifier based on the remote session description.
-
sdpMLineIndex
{Number}The remote ICE candidate media description index (starting from
0
) based on the remote session description.
-
-
error
{Error} OptionalThe error object. Defined only when
state
isDROPPED
orPROCESS_ERROR
.
channelClose
Event triggered when socket connection to Signaling server has closed.
channelError
This may be caused by Javascript errors in the event listener when subscribing to events.Event triggered when socket connection encountered exception.
It may be resolved by checking for code errors in your Web App in the event subscribing listener.
skylinkDemo.on("eventName", function () { // Errors here });
Event Payload:
-
error
{Error | String}The error object.
channelMessage
Note that this is used only for SDK developer purposes.Event triggered when receiving socket message from the Signaling server.
Event Payload:
-
message
{JSON}The socket message object.
channelOpen
Event triggered when socket connection to Signaling server has opened.
channelRetry
Event triggered when attempting to establish socket connection to Signaling server when failed.
Event Payload:
-
fallbackType
{String}The current fallback state. [Rel: Skylink.SOCKET_FALLBACK]
-
currentAttempt
{Number}The current reconnection attempt.
dataChannelState
Event triggered when a Datachannel connection state has changed.
Event Payload:
-
state
{String}The current Datachannel connection state. [Rel: Skylink.DATA_CHANNEL_STATE]
-
peerId
{String}The Peer ID.
-
error
{Error} OptionalThe error object. Defined only when
state
payload isERROR
orSEND_MESSAGE_ERROR
. -
channelName
{String}The Datachannel ID.
-
channelType
{String}The Datachannel type. [Rel: Skylink.DATA_CHANNEL_TYPE]
-
messageType
{String}The Datachannel sending Datachannel message error type. Defined only when
state payload is [Rel: Skylink.DATA_CHANNEL_MESSAGE_ERROR]SEND_MESSAGE_ERROR
.
dataTransferState
Event triggered when a data transfer state has changed.
Event Payload:
-
state
{String}The current data transfer state. [Rel: Skylink.DATA_TRANSFER_STATE]
-
transferId
{String}The data transfer ID.
-
peerId
{String}The Peer ID.
-
transferInfo
{JSON}The data transfer information.
-
data
{Blob | String} OptionalThe data object. Defined only when
state
payload isUPLOAD_STARTED
orDOWNLOAD_COMPLETED
. -
name
{String}The data transfer name.
-
size
{Number}The data transfer data object size.
-
dataType
{String}The data transfer session type. [Rel: Skylink.DATA_TRANSFER_SESSION_TYPE]
-
chunkType
{String}The data transfer type of data chunk being used to send to Peer for transfers. For
sendBlobData()
method data transfers, the initial data chunks value may change depending on the currently received data chunk type or the agent supported sending type of data chunks. ForsendURLData()
method data transfers, it isSTRING
always. [Rel: Skylink.DATA_TRANSFER_DATA_TYPE] -
mimeType
{String} OptionalThe data transfer data object MIME type. Defined only when
sendBlobData()
method data object sent MIME type information is defined. -
chunkSize
{Number}The data transfer data chunk size.
-
percentage
{Number}The data transfer percentage of completion progress.
-
timeout
{Number}The flag if message is targeted or not, basing off the
targetPeerId
parameter being defined insendURLData()
method orsendBlobData()
method. -
isPrivate
{Boolean}The flag if message is targeted or not, basing off the
targetPeerId
parameter being defined insendBlobData()
method orsendURLData()
method. -
direction
{String}The data transfer direction. [Rel: Skylink.DATA_TRANSFER_TYPE]
-
-
error
{JSON} OptionalThe error result. Defined only when
state
payload isERROR
,CANCEL
,REJECTED
orUSER_REJECTED
.-
message
{Error | String}The error object.
-
transferType
{String}The data transfer direction from where the error occurred. [Rel: Skylink.DATA_TRANSFER_TYPE]
-
getConnectionStatusStateChange
Event triggered when getConnectionStatus()
method
retrieval state changes.
Event Payload:
-
state
{Number}The current
getConnectionStatus()
retrieval state. [Rel: Skylink.GET_CONNECTION_STATUS_STATE] -
peerId
{String}The Peer ID.
-
stats
{JSON} OptionalThe Peer connection current stats. Defined only when
state
payload isRETRIEVE_SUCCESS
.-
raw
{JSON}The Peer connection raw stats before parsing.
-
audio
{JSON}The Peer connection audio streaming stats.
-
sending
{JSON}The Peer connection sending audio streaming stats. -
sending.bytes
{Number}The Peer connection current sending audio streaming bytes. Note that value is in bytes so you have to convert that to bits for displaying for an example kbps. -
sending.totalBytes
{Number}The Peer connection total sending audio streaming bytes. Note that value is in bytes so you have to convert that to bits for displaying for an example kbps. -
sending.packets
{Number}The Peer connection current sending audio streaming packets. -
sending.totalPackets
{Number}The Peer connection total sending audio streaming packets. -
sending.packetsLost
{Number}The Peer connection current sending audio streaming packets lost. -
sending.totalPacketsLost
{Number}The Peer connection total sending audio streaming packets lost. -
sending.ssrc
{Number}The Peer connection sending audio streaming RTP packets SSRC. -
sending.rtt
{Number}The Peer connection sending audio streaming RTT (Round-trip delay time). Defined as0
if it's not present in original raw stats before parsing. -
sending.jitter
{Number}The Peer connection sending audio streaming RTP packets jitter in seconds. Defined as0
if it's not present in original raw stats before parsing. -
sending.jitterBufferMs
{Number} OptionalThe Peer connection sending audio streaming RTP packets jitter buffer in miliseconds. Defined asnull
if it's not available in original raw stats before parsing. -
sending.codec
{JSON} OptionalThe Peer connection sending audio streaming selected codec information. Defined asnull
if local session description is not available before parsing. -
sending.codec.name
{String}The Peer connection sending audio streaming selected codec name. -
sending.codec.payloadType
{Number}The Peer connection sending audio streaming selected codec payload type. -
sending.codec.implementation
{String} OptionalThe Peer connection sending audio streaming selected codec implementation. Defined asnull
if it's not available in original raw stats before parsing. -
sending.codec.channels
{Number} OptionalThe Peer connection sending audio streaming selected codec channels (2 for stereo). Defined asnull
if it's not available in original raw stats before parsing, and this is usually present instats.audio
property. -
sending.codec.clockRate
{Number} OptionalThe Peer connection sending audio streaming selected codec media sampling rate. Defined asnull
if it's not available in original raw stats before parsing. -
sending.codec.params
{String} OptionalThe Peer connection sending audio streaming selected codec parameters. Defined asnull
if it's not available in original raw stats before parsing. -
sending.inputLevel
{Number} OptionalThe Peer connection sending audio streaming input level. Defined asnull
if it's not available in original raw stats before parsing. -
sending.echoReturnLoss
{Number} OptionalThe Peer connection sending audio streaming echo return loss in db (decibels). Defined asnull
if it's not available in original raw stats before parsing. -
sending.echoReturnLossEnhancement
{Number} OptionalThe Peer connection sending audio streaming echo return loss enhancement db (decibels). Defined asnull
if it's not available in original raw stats before parsing. -
receiving
{JSON}The Peer connection receiving audio streaming stats. -
receiving.bytes
{Number}The Peer connection current sending audio streaming bytes. Note that value is in bytes so you have to convert that to bits for displaying for an example kbps. -
receiving.totalBytes
{Number}The Peer connection total sending audio streaming bytes. Note that value is in bytes so you have to convert that to bits for displaying for an example kbps. -
receiving.packets
{Number}The Peer connection current receiving audio streaming packets. -
receiving.totalPackets
{Number}The Peer connection total receiving audio streaming packets. -
receiving.packetsLost
{Number}The Peer connection current receiving audio streaming packets lost. -
receiving.totalPacketsLost
{Number}The Peer connection total receiving audio streaming packets lost. -
receiving.ssrc
{Number}The Peer connection receiving audio streaming RTP packets SSRC. -
receiving.jitter
{Number}The Peer connection receiving audio streaming RTP packets jitter in seconds. Defined as0
if it's not present in original raw stats before parsing. -
receiving.jitterBufferMs
{Number} OptionalThe Peer connection receiving audio streaming RTP packets jitter buffer in miliseconds. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.codec
{JSON} OptionalThe Peer connection receiving audio streaming selected codec information. Defined asnull
if remote session description is not available before parsing. -
receiving.codec.name
{String}The Peer connection receiving audio streaming selected codec name. -
receiving.codec.payloadType
{Number}The Peer connection receiving audio streaming selected codec payload type. -
receiving.codec.implementation
{String} OptionalThe Peer connection receiving audio streaming selected codec implementation. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.codec.channels
{Number} OptionalThe Peer connection receiving audio streaming selected codec channels (2 for stereo). Defined asnull
if it's not available in original raw stats before parsing, and this is usually present instats.audio
property. -
receiving.codec.clockRate
{Number} OptionalThe Peer connection receiving audio streaming selected codec media sampling rate. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.codec.params
{String} OptionalThe Peer connection receiving audio streaming selected codec parameters. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.outputLevel
{Number} OptionalThe Peer connection receiving audio streaming output level. Defined asnull
if it's not available in original raw stats before parsing.
-
-
video
{JSON}The Peer connection video streaming stats.
-
sending
{JSON}The Peer connection sending video streaming stats. -
sending.bytes
{Number}The Peer connection current sending video streaming bytes. Note that value is in bytes so you have to convert that to bits for displaying for an example kbps. -
sending.totalBytes
{Number}The Peer connection total sending video streaming bytes. Note that value is in bytes so you have to convert that to bits for displaying for an example kbps. -
sending.packets
{Number}The Peer connection current sending video streaming packets. -
sending.totalPackets
{Number}The Peer connection total sending video streaming packets. -
sending.packetsLost
{Number}The Peer connection current sending video streaming packets lost. -
sending.totalPacketsLost
{Number}The Peer connection total sending video streaming packets lost. -
sending.ssrc
{Number}The Peer connection sending video streaming RTP packets SSRC. -
sending.rtt
{Number}The Peer connection sending video streaming RTT (Round-trip delay time). Defined as0
if it's not present in original raw stats before parsing. -
sending.jitter
{Number}The Peer connection sending video streaming RTP packets jitter in seconds. Defined as0
if it's not present in original raw stats before parsing. -
sending.jitterBufferMs
{Number} OptionalThe Peer connection sending video streaming RTP packets jitter buffer in miliseconds. Defined asnull
if it's not available in original raw stats before parsing. -
sending.codec
{JSON} OptionalThe Peer connection sending video streaming selected codec information. Defined asnull
if local session description is not available before parsing. -
sending.codec.name
{String}The Peer connection sending video streaming selected codec name. -
sending.codec.payloadType
{Number}The Peer connection sending video streaming selected codec payload type. -
sending.codec.implementation
{String} OptionalThe Peer connection sending video streaming selected codec implementation. Defined asnull
if it's not available in original raw stats before parsing. -
sending.codec.channels
{Number} OptionalThe Peer connection sending video streaming selected codec channels (2 for stereo). Defined asnull
if it's not available in original raw stats before parsing, and this is usually present instats.audio
property. -
sending.codec.clockRate
{Number} OptionalThe Peer connection sending video streaming selected codec media sampling rate. Defined asnull
if it's not available in original raw stats before parsing. -
sending.codec.params
{String} OptionalThe Peer connection sending video streaming selected codec parameters. Defined asnull
if it's not available in original raw stats before parsing. -
sending.frames
{Number} OptionalThe Peer connection sending video streaming frames. Defined asnull
if it's not available in original raw stats before parsing. -
sending.framesInput
{Number} OptionalThe Peer connection sending video streaming frames input. Defined asnull
if it's not available in original raw stats before parsing. -
sending.framesDropped
{Number} OptionalThe Peer connection sending video streaming frames dropped. Defined asnull
if it's not available in original raw stats before parsing. -
sending.frameRateMean
{Number} OptionalThe Peer connection sending video streaming fps mean. Defined asnull
if it's not available in original raw stats before parsing. -
sending.frameRateStdDev
{Number} OptionalThe Peer connection sending video streaming fps standard deviation. Defined asnull
if it's not available in original raw stats before parsing. -
sending.nacks
{Number} OptionalThe Peer connection current sending video streaming nacks. Defined asnull
if it's not available in original raw stats before parsing. -
sending.totalNacks
{Number} OptionalThe Peer connection total sending video streaming nacks. Defined asnull
if it's not available in original raw stats before parsing. -
sending.plis
{Number} OptionalThe Peer connection current sending video streaming plis. Defined asnull
if it's not available in original raw stats before parsing. -
sending.totalPlis
{Number} OptionalThe Peer connection total sending video streaming plis. Defined asnull
if it's not available in original raw stats before parsing. -
sending.firs
{Number} OptionalThe Peer connection current sending video streaming firs. Defined asnull
if it's not available in original raw stats before parsing. -
sending.totalFirs
{Number} OptionalThe Peer connection total sending video streaming firs. Defined asnull
if it's not available in original raw stats before parsing. -
receiving
{JSON}The Peer connection receiving video streaming stats. -
receiving.bytes
{Number}The Peer connection current receiving video streaming bytes. Note that value is in bytes so you have to convert that to bits for displaying for an example kbps. -
receiving.totalBytes
{Number}The Peer connection total receiving video streaming bytes. Note that value is in bytes so you have to convert that to bits for displaying for an example kbps. -
receiving.packets
{Number}The Peer connection current receiving video streaming packets. -
receiving.totalPackets
{Number}The Peer connection total receiving video streaming packets. -
receiving.packetsLost
{Number}The Peer connection current receiving video streaming packets lost. -
receiving.totalPacketsLost
{Number}The Peer connection total receiving video streaming packets lost. -
receiving.ssrc
{Number}The Peer connection receiving video streaming RTP packets SSRC. -
receiving.e2eDelay
{Number}The Peer connection receiving video streaming e2e delay. Defined asnull
if it's not present in original raw stats before parsing, and that it finds any existing audio, video or object (plugin) DOM elements that has set with the Peer remote stream object to parse current time. Note thatdocument.getElementsByTagName
function and DOM.currentTime
has to be supported inorder for data to be parsed correctly. -
receiving.jitter
{Number}The Peer connection receiving video streaming RTP packets jitter in seconds. Defined as0
if it's not present in original raw stats before parsing. -
receiving.jitterBufferMs
{Number} OptionalThe Peer connection receiving video streaming RTP packets jitter buffer in miliseconds. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.codec
{JSON} OptionalThe Peer connection receiving video streaming selected codec information. Defined asnull
if remote session description is not available before parsing. -
receiving.codec.name
{String}The Peer connection receiving video streaming selected codec name. -
receiving.codec.payloadType
{Number}The Peer connection receiving video streaming selected codec payload type. -
receiving.codec.implementation
{String} OptionalThe Peer connection receiving video streaming selected codec implementation. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.codec.channels
{Number} OptionalThe Peer connection receiving video streaming selected codec channels (2 for stereo). Defined asnull
if it's not available in original raw stats before parsing, and this is usually present instats.audio
property. -
receiving.codec.clockRate
{Number} OptionalThe Peer connection receiving video streaming selected codec media sampling rate. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.codec.params
{String} OptionalThe Peer connection receiving video streaming selected codec parameters. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.frames
{Number} OptionalThe Peer connection receiving video streaming frames. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.framesOutput
{Number} OptionalThe Peer connection receiving video streaming frames output. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.framesDecoded
{Number} OptionalThe Peer connection receiving video streaming frames decoded. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.frameRateMean
{Number} OptionalThe Peer connection receiving video streaming fps mean. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.frameRateStdDev
{Number} OptionalThe Peer connection receiving video streaming fps standard deviation. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.nacks
{Number} OptionalThe Peer connection current receiving video streaming nacks. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.totalNacks
{Number} OptionalThe Peer connection total receiving video streaming nacks. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.plis
{Number} OptionalThe Peer connection current receiving video streaming plis. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.totalPlis
{Number} OptionalThe Peer connection totally receiving video streaming plis. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.firs
{Number} OptionalThe Peer connection current receiving video streaming firs. Defined asnull
if it's not available in original raw stats before parsing. -
receiving.totalFirs
{Number} OptionalThe Peer connection total receiving video streaming firs. Defined asnull
if it's not available in original raw stats before parsing.
-
-
selectedCandidate
{JSON}The Peer connection selected ICE candidate pair stats.
-
local
{JSON}The Peer connection selected local ICE candidate. -
local.ipAddress
{String}The Peer connection selected local ICE candidate IP address. -
local.portNumber
{Number}The Peer connection selected local ICE candidate port number. -
local.transport
{String}The Peer connection selected local ICE candidate IP transport type. -
local.candidateType
{String}The Peer connection selected local ICE candidate type. -
remote
{JSON}The Peer connection selected remote ICE candidate. -
remote.ipAddress
{String}The Peer connection selected remote ICE candidate IP address. -
remote.portNumber
{Number}The Peer connection selected remote ICE candidate port number. -
remote.transport
{String}The Peer connection selected remote ICE candidate IP transport type. -
remote.candidateType
{String}The Peer connection selected remote ICE candidate type.
-
-
connection
{JSON}The Peer connection object stats.
-
iceConnectionState
{String}The Peer connection ICE connection state. -
iceGatheringState
{String}The Peer connection ICE gathering state. -
signalingState
{String}The Peer connection signaling state. -
localDescription
{JSON}The Peer connection local session description. -
localDescription.type
{String}The Peer connection local session description type. Defined asnull
when local session description is not available. -
localDescription.sdp
{String}The Peer connection local session description SDP. Defined asnull
when local session description is not available. -
remoteDescription
{JSON}The Peer connection remote session description. -
remoteDescription.type
{String}The Peer connection remote session description type. Defined asnull
when remote session description is not available. -
remoteDescription.sdp
{String}The Peer connection remote session description sdp. Defined asnull
when remote session description is not available. -
candidates
{JSON}The Peer connection list of ICE candidates sent or received. -
candidates.sending
{JSON}The Peer connection list of local ICE candidates sent. -
candidates.sending.host
{Array}The Peer connection list of local"host"
(local network) ICE candidates sent. -
candidates.sending.host.#index
{JSON}The Peer connection local"host"
(local network) ICE candidate. -
candidates.sending.host.#index.candidate
{String}The Peer connection local"host"
(local network) ICE candidate connection description. -
candidates.sending.host.#index.sdpMid
{String}The Peer connection local"host"
(local network) ICE candidate identifier based on the local session description. -
candidates.sending.host.#index.sdpMLineIndex
{Number}The Peer connection local"host"
(local network) ICE candidate media description index (starting from0
) based on the local session description. -
candidates.sending.srflx
{Array}The Peer connection list of local"srflx"
(STUN) ICE candidates sent. -
candidates.sending.srflx.#index
{JSON}The Peer connection local"srflx"
(STUN) ICE candidate. -
candidates.sending.srflx.#index.candidate
{String}The Peer connection local"srflx"
(STUN) ICE candidate connection description. -
candidates.sending.srflx.#index.sdpMid
{String}The Peer connection local"srflx"
(STUN) ICE candidate identifier based on the local session description. -
candidates.sending.srflx.#index.sdpMLineIndex
{Number}The Peer connection local"srflx"
(STUN) ICE candidate media description index (starting from0
) based on the local session description. -
candidates.sending.relay
{Array}The Peer connection list of local"relay"
(TURN) candidates sent. -
candidates.sending.relay.#index
{JSON}The Peer connection local"relay"
(TURN) ICE candidate. -
candidates.sending.relay.#index.candidate
{String}The Peer connection local"relay"
(TURN) ICE candidate connection description. -
candidates.sending.relay.#index.sdpMid
{String}The Peer connection local"relay"
(TURN) ICE candidate identifier based on the local session description. -
candidates.sending.relay.#index.sdpMLineIndex
{Number}The Peer connection local"relay"
(TURN) ICE candidate media description index (starting from0
) based on the local session description. -
candidates.receiving
{JSON}The Peer connection list of remote ICE candidates received. -
candidates.receiving.host
{Array}The Peer connection list of remote"host"
(local network) ICE candidates received. -
candidates.receiving.host.#index
{JSON}The Peer connection remote"host"
(local network) ICE candidate. -
candidates.receiving.host.#index.candidate
{String}The Peer connection remote"host"
(local network) ICE candidate connection description. -
candidates.receiving.host.#index.sdpMid
{String}The Peer connection remote"host"
(local network) ICE candidate identifier based on the remote session description. -
candidates.receiving.host.#index.sdpMLineIndex
{Number}The Peer connection remote"host"
(local network) ICE candidate media description index (starting from0
) based on the remote session description. -
candidates.receiving.srflx
{Array}The Peer connection list of remote"srflx"
(STUN) ICE candidates received. -
candidates.receiving.srflx.#index
{JSON}The Peer connection remote"srflx"
(STUN) ICE candidate. -
candidates.receiving.srflx.#index.candidate
{String}The Peer connection remote"srflx"
(STUN) ICE candidate connection description. -
candidates.receiving.srflx.#index.sdpMid
{String}The Peer connection remote"srflx"
(STUN) ICE candidate identifier based on the remote session description. -
candidates.receiving.srflx.#index.sdpMLineIndex
{Number}The Peer connection remote"srflx"
(STUN) ICE candidate media description index (starting from0
) based on the remote session description. -
candidates.receiving.relay
{Array}The Peer connection list of remote"relay"
(TURN) ICE candidates received. -
candidates.receiving.relay.#index
{JSON}The Peer connection remote"relay"
(TURN) ICE candidate. -
candidates.receiving.relay.#index.candidate
{String}The Peer connection remote"relay"
(TURN) ICE candidate connection description. -
candidates.receiving.relay.#index.sdpMid
{String}The Peer connection remote"relay"
(TURN) ICE candidate identifier based on the remote session description. -
candidates.receiving.relay.#index.sdpMLineIndex
{Number}The Peer connection remote"relay"
(TURN) ICE candidate media description index (starting from0
) based on the remote session description. -
dataChannels
{JSON}The Peer connection list of Datachannel connections. -
dataChannels.#channelName
{JSON}The Peer connection Datachannel connection stats. -
dataChannels.#channelName.label
{String}The Peer connection Datachannel connection ID. -
dataChannels.#channelName.readyState
{String}The Peer connection Datachannel connection readyState. [Rel: Skylink.DATA_CHANNEL_STATE] -
dataChannels.#channelName.type
{String}The Peer connection Datachannel connection type. [Rel: Skylink.DATA_CHANNEL_TYPE] -
dataChannels.#channelName.currentTransferId
{String}The Peer connection Datachannel connection current progressing transfer session ID. Defined asnull
when there is currently no transfer session progressing on the Datachannel connection.
-
-
-
error
{Error}The error object received. Defined only when
state
payload isRETRIEVE_ERROR
.
getPeersStateChange
Event triggered when getPeers()
method retrieval state changes.
Event Payload:
-
state
{String}The current
getPeers()
retrieval state. [Rel: Skylink.GET_PEERS_STATE] -
privilegedPeerId
{String}The User's privileged Peer ID.
-
peerList
{JSON}The list of Peer IDs Rooms within the same App space.
-
#room
{Array}The list of Peer IDs associated with the Room defined in
#room
property.
-
handshakeProgress
Event triggered when a Peer connection establishment state has changed.
Event Payload:
-
state
{String}The current Peer connection establishment state. [Rel: Skylink.HANDSHAKE_PROGRESS]
-
peerId
{String}The Peer ID.
-
error
{Error | String} OptionalThe error object. Defined only when
state
isERROR
.
iceConnectionState
Learn more about how ICE works in this article here.Event triggered when a Peer connection ICE connection state has changed.
Event Payload:
-
state
{String}The current Peer connection ICE connection state. [Rel: Skylink.ICE_CONNECTION_STATE]
-
peerId
{String}The Peer ID.
incomingData
Event triggered when receiving completed data transfer from Peer.
Event Payload:
-
data
{Blob | String}The data.
-
transferId
{String}The data transfer ID.
-
peerId
{String}The Peer ID.
-
transferInfo
{JSON}The data transfer information. Object signature matches the
transferInfo
parameter payload received in thedataTransferState
event. -
isSelf
{Boolean}The flag if Peer is User.
incomingDataRequest
Event triggered when receiving upload data transfer from Peer.
Event Payload:
-
transferId
{String}The transfer ID.
-
peerId
{String}The Peer ID.
-
transferInfo
{String}The data transfer information. Object signature matches the
transferInfo
parameter payload received in thedataTransferState
event. -
isSelf
{Boolean}The flag if Peer is User.
incomingMessage
Event triggered when receiving message from Peer.
Event Payload:
-
message
{JSON}The message result.
-
content
{JSON | String}The message object.
-
senderPeerId
{String}The sender Peer ID.
-
targetPeerId
{String | Array} OptionalThe value of the
targetPeerId
defined insendP2PMessage()
method orsendMessage()
method. Defined as User's Peer ID whenisSelf
payload value isfalse
. Defined asnull
when providedtargetPeerId
insendP2PMessage()
method orsendMessage()
method is not defined. -
listOfPeers
{Array} OptionalThe list of Peers that the message has been sent to. Defined only when
isSelf
payload value istrue
. -
isPrivate
{Boolean}The flag if message is targeted or not, basing off the
targetPeerId
parameter being defined insendP2PMessage()
method orsendMessage()
method. -
isDataChannel
{Boolean}The flag if message is sent from
sendP2PMessage()
method.
-
-
peerId
{String}The Peer ID.
-
peerInfo
{JSON}The Peer session information. Object signature matches the
peerInfo
parameter payload received in thepeerJoined
event. -
isSelf
{Boolean}The flag if Peer is User.
incomingStream
Event triggered when receiving Peer Stream.
Event Payload:
-
peerId
{String}The Peer ID.
-
stream
{MediaStream}The Stream object. To attach it to an element:
attachMediaStream(videoElement, stream);
. -
isSelf
{Boolean}The flag if Peer is User.
-
peerInfo
{JSON}The Peer session information. Object signature matches the
peerInfo
parameter payload received in thepeerJoined
event. -
isScreensharing
{Boolean}The flag if Peer Stream is a screensharing Stream.
-
streamId
{String}The Stream ID.
introduceStateChange
Event triggered when introducePeer()
method
introduction request state changes.
Event Payload:
-
state
{String}The current
introducePeer()
introduction request state. [Rel: Skylink.INTRODUCE_STATE] -
privilegedPeerId
{String}The User's privileged Peer ID.
-
sendingPeerId
{String}The Peer ID to be connected with
receivingPeerId
. -
receivingPeerId
{String}The Peer ID to be connected with
sendingPeerId
. -
reason
{String} OptionalThe error object. Defined only when
state
payload isERROR
.
localMediaMuted
Event triggered when muteStream()
method changes
User Streams audio and video tracks muted status.
Event Payload:
-
mediaStatus
{JSON}The Streams muted settings. This indicates the muted settings for both
getUserMedia()
Stream andshareScreen()
Stream.-
audioMuted
{Boolean}The flag if all Streams audio tracks is muted or not. If User's
peerInfo.settings.audio
is false, this will be defined astrue
. -
videoMuted
{Boolean}The flag if all Streams video tracks is muted or not. If User's
peerInfo.settings.video
is false, this will be defined astrue
.
-
mediaAccessError
Event triggered when retrieval of Stream failed.
Event Payload:
-
error
{Error | String}The error object.
-
isScreensharing
{Boolean}The flag if event occurred during
shareScreen()
method and notgetUserMedia()
method. -
isAudioFallbackError
{Boolean}The flag if event occurred during retrieval of audio tracks only when
getUserMedia()
method had failed to retrieve both audio and video tracks.
mediaAccessFallback
Event triggered when Stream retrieval fallback state has changed.
Event Payload:
-
error
{JSON}The error result.
-
error
{Error | String}The error object.
-
diff
{JSON} OptionalThe list of excepted but received audio and video tracks in Stream. Defined only when
state
payload isFALLBACKED
.-
video
{JSON}The expected and received video tracks. -
video.expected
{Number}The expected video tracks. -
video.received
{Number}The received video tracks. -
audio
{JSON}The expected and received audio tracks. -
audio.expected
{Number}The expected audio tracks. -
audio.received
{Number}The received audio tracks.
-
-
-
state
{Number}The fallback state. [Rel: Skylink.MEDIA_ACCESS_FALLBACK_STATE]
-
isScreensharing
{Boolean}The flag if event occurred during
shareScreen()
method and notgetUserMedia()
method. -
isAudioFallback
{Boolean}The flag if event occurred during retrieval of audio tracks only when
getUserMedia()
method had failed to retrieve both audio and video tracks. -
streamId
{String}The Stream ID. Defined only when
state
payload isFALLBACKED
.
mediaAccessRequired
Event triggered when retrieval of Stream is required to complete
joinRoom()
method request.
mediaAccessStopped
Event triggered when Stream has stopped streaming.
Event Payload:
-
isScreensharing
{Boolean}The flag if event occurred during
shareScreen()
method and notgetUserMedia()
method. -
isAudioFallback
{Boolean}The flag if event occurred during retrieval of audio tracks only when
getUserMedia()
method had failed to retrieve both audio and video tracks. -
streamId
{String}The Stream ID.
mediaAccessSuccess
Event triggered when retrieval of Stream is successful.
Event Payload:
-
stream
{MediaStream}The Stream object. To attach it to an element:
attachMediaStream(videoElement, stream);
. -
isScreensharing
{Boolean}The flag if event occurred during
shareScreen()
method and notgetUserMedia()
method. -
isAudioFallback
{Boolean}The flag if event occurred during retrieval of audio tracks only when
getUserMedia()
method had failed to retrieve both audio and video tracks. -
streamId
{String}The Stream ID.
peerConnectionState
Learn more about how ICE works in this article here.Event triggered when a Peer connection session description exchanging state has changed.
Event Payload:
-
state
{String}The current Peer connection session description exchanging state. [Rel: Skylink.PEER_CONNECTION_STATE]
-
peerId
{String}The Peer ID.
peerJoined
Event triggered when a Peer joins the room.
Event Payload:
-
peerId
{String}The Peer ID.
-
peerInfo
{JSON}The Peer session information.
-
userData
{JSON | String}The Peer current custom data.
-
settings
{JSON}The Peer sending Stream settings.
-
audio
{Boolean | JSON}The Peer Stream audio settings. When defined asfalse
, it means there is no audio being sent from Peer. When defined astrue
, thepeerInfo.settings.audio.stereo
value is considered asfalse
and thepeerInfo.settings.audio.exactConstraints
value is considered asfalse
. -
audio.stereo
{Boolean}The flag if stereo band is configured when encoding audio codec isOPUS
for receiving audio data. -
audio.usedtx
{Boolean} OptionalNote that this feature might not work depending on the browser support and implementation.
The flag if DTX (Discontinuous Transmission) is configured when encoding audio codec isOPUS
for sending audio data. This might help to reduce bandwidth it reduces the bitrate during silence or background noise. When not defined, the default browser configuration is used. -
audio.useinbandfec
{Boolean} OptionalNote that this feature might not work depending on the browser support and implementation.
The flag if capability to take advantage of in-band FEC (Forward Error Correction) is configured when encoding audio codec isOPUS
for sending audio data. This might help to reduce the harm of packet loss by encoding information about the previous packet. When not defined, the default browser configuration is used. -
audio.maxplaybackrate
{Number} OptionalNote that this feature might not work depending on the browser support and implementation.
The maximum output sampling rate rendered in Hertz (Hz) when encoding audio codec isOPUS
for sending audio data. This value must be between8000
to48000
. When not defined, the default browser configuration is used. -
audio.echoCancellation
{Boolean}The flag if echo cancellation is enabled for audio tracks. -
audio.optional
{Array} OptionalThe Peer Streamnavigator.getUserMedia()
APIaudio: { optional [..] }
property. -
audio.deviceId
{String} OptionalThe Peer Stream audio track source ID of the device used. -
audio.exactConstraints
{Boolean}The flag if Peer Stream audio track is sending exact requested values ofpeerInfo.settings.audio.deviceId
when provided. -
video
{Boolean | JSON}The Peer Stream video settings. When defined asfalse
, it means there is no video being sent from Peer. When defined astrue
, thepeerInfo.settings.video.screenshare
value is considered asfalse
and thepeerInfo.settings.video.exactConstraints
value is considered asfalse
. -
video.resolution
{JSON} OptionalThe Peer Stream video resolution. [Rel: Skylink.VIDEO_RESOLUTION] -
video.resolution.width
{Number | JSON}The Peer Stream video resolution width or video resolution width settings. When defined as a JSON object, it is the user set resolution width settings with ("min"
or"max"
or"ideal"
or"exact"
etc configurations). -
video.resolution.height
{Number | JSON}The Peer Stream video resolution height or video resolution height settings. When defined as a JSON object, it is the user set resolution height settings with ("min"
or"max"
or"ideal"
or"exact"
etc configurations). -
video.frameRate
{Number | JSON} OptionalThe Peer Stream video frameRate per second (fps) or video frameRate settings. When defined as a JSON object, it is the user set frameRate settings with ("min"
or"max"
or"ideal"
or"exact"
etc configurations). -
video.screenshare
{Boolean}The flag if Peer Stream is a screensharing Stream. -
video.optional
{Array} OptionalThe Peer Streamnavigator.getUserMedia()
APIvideo: { optional [..] }
property. -
video.deviceId
{String} OptionalThe Peer Stream video track source ID of the device used. -
video.exactConstraints
{Boolean}The flag if Peer Stream video track is sending exact requested values ofpeerInfo.settings.video.resolution
,peerInfo.settings.video.frameRate
andpeerInfo.settings.video.deviceId
when provided. -
bandwidth
{JSON}The maximum streaming bandwidth sent from Peer. -
bandwidth.audio
{Number} OptionalThe maximum audio streaming bandwidth sent from Peer. -
bandwidth.video
{Number} OptionalThe maximum video streaming bandwidth sent from Peer. -
bandwidth.data
{Number} OptionalThe maximum data streaming bandwidth sent from Peer. -
googleXBandwidth
{JSON}Note that this feature might not work depending on the browser support and implementation, and its properties and values are only defined for User's end and cannot be viewed from Peer's end (when
The experimental google video streaming bandwidth sent to Peers.isSelf
value isfalse
). -
googleXBandwidth.min
{Number} OptionalThe minimum experimental google video streaming bandwidth sent to Peers. -
googleXBandwidth.max
{Number} OptionalThe maximum experimental google video streaming bandwidth sent to Peers.
-
-
mediaStatus
{JSON}The Peer Stream muted settings.
-
audioMuted
{Boolean}The flag if Peer Stream audio tracks is muted or not. If PeerpeerInfo.settings.audio
is false, this will be defined astrue
. -
videoMuted
{Boolean}The flag if Peer Stream video tracks is muted or not. If PeerpeerInfo.settings.video
is false, this will be defined astrue
.
-
-
agent
{JSON}The Peer agent information.
-
name
{String}The Peer agent name. Data may be accessing browser or non-Web SDK name. -
version
{Number}The Peer agent version. Data may be accessing browser or non-Web SDK version. If the original value is"0.9.6.1"
, it will be interpreted as0.90601
where0
helps to seperate the minor dots. -
os
{String} OptionalThe Peer platform name. Data may be accessing OS platform version from Web SDK. -
pluginVersion
{String} OptionalThe Peer Temasys Plugin version. Defined only when Peer is using the Temasys Plugin (IE / Safari).
-
-
room
{String}The Room Peer is from.
-
config
{JSON}The Peer connection configuration.
-
enableIceTrickle
{Boolean}The flag if Peer connection has trickle ICE enabled or faster connectivity. -
enableDataChannel
{Boolean}The flag if Datachannel connections would be enabled for Peer. -
enableIceRestart
{Boolean}The flag if Peer connection has ICE connection restart support. Note that ICE connection restart support is not honoured for MCU enabled Peer connection. -
priorityWeight
{Number}The flag if Peer or User should be the offerer. If User'spriorityWeight
is higher than Peer's, User is the offerer, else Peer is. However for the case where the MCU is connected, User will always be the offerer. -
publishOnly
{Boolean}The flag if Peer is publishing only stream but not receiving streams. -
receiveOnly
{Boolean}The flag if Peer is receiving only streams but not publishing stream.
-
-
parentId
{String} OptionalThe parent Peer ID that it is matched to for multi-streaming connections.
-
-
isSelf
{Boolean}The flag if Peer is User.
peerLeft
Event triggered when a Peer leaves the room.
Event Payload:
-
peerId
{String}The Peer ID.
-
peerInfo
{JSON}The Peer session information. Object signature matches the
peerInfo
parameter payload received in thepeerJoined
event. -
isSelf
{Boolean}The flag if Peer is User.
peerRestart
Event triggered when a Peer connection has been refreshed.
Event Payload:
-
peerId
{String}The Peer ID.
-
peerInfo
{JSON}The Peer session information. Object signature matches the
peerInfo
parameter payload received in thepeerJoined
event. -
isSelfInitiateRestart
{Boolean}The flag if User is initiating the Peer connection refresh.
-
isIceRestart
{Boolean}The flag if Peer connection ICE connection will restart.
peerUpdated
Event triggered when a Peer session information has been updated.
Event Payload:
-
peerId
{String}The Peer ID.
-
peerInfo
{JSON}The Peer session information. Object signature matches the
peerInfo
parameter payload received in thepeerJoined
event. -
isSelf
{Boolean}The flag if Peer is User.
readyStateChange
Event triggered when init()
method ready state changes.
Event Payload:
-
readyState
{Number}The current
init()
ready state. [Rel: Skylink.READY_STATE_CHANGE] -
error
{JSON} OptionalThe error result. Defined only when
state
isERROR
.-
status
{Number}The HTTP status code when failed.
-
errorCode
{Number}The ready state change failure code. [Rel: Skylink.READY_STATE_CHANGE_ERROR]
-
content
{Error}The error object.
-
-
room
{String}The Room to The Room to retrieve session token for.
recordingState
Event triggered when recording session state has changed.
Event Payload:
-
state
{Number}The current recording session state. [Rel: Skylink.RECORDING_STATE]
-
recordingId
{String}The recording session ID.
-
link
{JSON}The recording session mixin videos link in MP4 format. Defined only when
state
payload isLINK
.-
#peerId
{String}The recording session recorded Peer only video associated with the Peer ID defined in
#peerId
property. If#peerId
value is"mixin"
, it means that is the mixin video of all Peers in the Room.
-
-
error
{Error | String}The error object. Defined only when
state
payload isERROR
.
roomLock
Event triggered when Room locked status has changed.
Event Payload:
-
isLocked
{Boolean}The flag if Room is locked.
-
peerId
{String}The Peer ID.
-
peerInfo
{JSON}The Peer session information. Object signature matches the
peerInfo
parameter payload received in thepeerJoined
event. -
isSelf
{Boolean}The flag if User changed the Room locked status.
serverPeerJoined
Event triggered when a server Peer joins the room.
Event Payload:
-
peerId
{String}The Peer ID.
-
serverPeerType
{String}The server Peer type [Rel: Skylink.SERVER_PEER_TYPE]
serverPeerLeft
Event triggered when a server Peer leaves the room.
Event Payload:
-
peerId
{String}The Peer ID.
-
serverPeerType
{String}The server Peer type [Rel: Skylink.SERVER_PEER_TYPE]
serverPeerRestart
Event triggered when a server Peer connection has been refreshed.
Event Payload:
-
peerId
{String}The Peer ID.
-
serverPeerType
{String}The server Peer type [Rel: Skylink.SERVER_PEER_TYPE]
sessionDisconnect
Event triggered when Room session has ended abruptly due to network disconnections.
Event Payload:
-
peerId
{String}The User's Room session Peer ID.
-
peerInfo
{JSON}The User's Room session information. Object signature matches the
peerInfo
parameter payload received in thepeerJoined
event.
socketError
Event triggered when attempt to establish socket connection to Signaling server has failed.
Event Payload:
-
errorCode
{Number}The socket connection error code. [Rel: Skylink.SOCKET_ERROR]
-
error
{Error | String | Number}The error object.
-
type
{String}The fallback state of the socket connection attempt. [Rel: Skylink.SOCKET_FALLBACK]
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.
Event Payload:
-
peerId
{String}The Peer ID.
-
peerInfo
{JSON}The Peer session information. Object signature matches the
peerInfo
parameter payload received in thepeerJoined
event. -
isSelf
{Boolean}The flag if Peer is User.
-
isScreensharing
{Boolean}The flag if Peer Stream is a screensharing Stream.
-
streamId
{String}The Stream ID.
streamMuted
Event triggered when Peer Stream audio or video tracks has been muted / unmuted.
Event Payload:
-
peerId
{String}The Peer ID.
-
peerInfo
{JSON}The Peer session information. Object signature matches the
peerInfo
parameter payload received in thepeerJoined
event. -
isSelf
{Boolean}The flag if Peer is User.
-
isScreensharing
{Boolean}The flag if Peer Stream is a screensharing Stream.
systemAction
Event triggered when Signaling server reaction state has changed.
Event Payload:
-
action
{String}The current Signaling server reaction state. [Rel: Skylink.SYSTEM_ACTION]
-
message
{String}The message.
-
reason
{String}The Signaling server reaction state reason of action code. [Rel: Skylink.SYSTEM_ACTION_REASON]