/**
* The list of Datachannel connection states.
* @attribute DATA_CHANNEL_STATE
* @param {String} CONNECTING <small>Value <code>"connecting"</code></small>
* The value of the state when Datachannel is attempting to establish a connection.
* @param {String} OPEN <small>Value <code>"open"</code></small>
* The value of the state when Datachannel has established a connection.
* @param {String} CLOSING <small>Value <code>"closing"</code></small>
* The value of the state when Datachannel connection is closing.
* @param {String} CLOSED <small>Value <code>"closed"</code></small>
* The value of the state when Datachannel connection has closed.
* @param {String} ERROR <small>Value <code>"error"</code></small>
* The value of the state when Datachannel has encountered an exception during connection.
* @param {String} CREATE_ERROR <small>Value <code>"createError"</code></small>
* The value of the state when Datachannel has failed to establish a connection.
* @param {String} BUFFERED_AMOUNT_LOW <small>Value <code>"bufferedAmountLow"</code></small>
* The value of the state when Datachannel when the amount of data buffered to be sent
* falls below the Datachannel threshold.
* <small>This state should occur only during after <a href="#method_sendBlobData">
* <code>sendBlobData()</code> method</a> or <a href="#method_sendURLData"><code>sendURLData()</code> method</a> or
* <a href="#method_sendP2PMessage"><code>sendP2PMessage()</code> method</a>.</small>
* @param {String} SEND_MESSAGE_ERROR <small>Value <code>"sendMessageError"</code></small>
* The value of the state when Datachannel when data transfer packets or P2P message fails to send.
* <small>This state should occur only during after <a href="#method_sendBlobData">
* <code>sendBlobData()</code> method</a> or <a href="#method_sendURLData"><code>sendURLData()</code> method</a> or
* <a href="#method_sendP2PMessage"><code>sendP2PMessage()</code> method</a>.</small>
* @type JSON
* @readOnly
* @for Skylink
* @since 0.1.0
*/
Skylink.prototype.DATA_CHANNEL_STATE = {
CONNECTING: 'connecting',
OPEN: 'open',
CLOSING: 'closing',
CLOSED: 'closed',
ERROR: 'error',
CREATE_ERROR: 'createError',
BUFFERED_AMOUNT_LOW: 'bufferedAmountLow',
SEND_MESSAGE_ERROR: 'sendMessageError'
};
/**
* The list of Datachannel types.
* @attribute DATA_CHANNEL_TYPE
* @param {String} MESSAGING <small>Value <code>"messaging"</code></small>
* The value of the Datachannel type that is used only for messaging in
* <a href="#method_sendP2PMessage"><code>sendP2PMessage()</code> method</a>.
* <small>However for Peers that do not support simultaneous data transfers, this Datachannel
* type will be used to do data transfers (1 at a time).</small>
* <small>Each Peer connections will only have one of this Datachannel type and the
* connection will only close when the Peer connection is closed (happens when <a href="#event_peerConnectionState">
* <code>peerConnectionState</code> event</a> triggers parameter payload <code>state</code> as
* <code>CLOSED</code> for Peer).</small>
* @param {String} DATA <small>Value <code>"data"</code></small>
* The value of the Datachannel type that is used only for a data transfer in
* <a href="#method_sendURLData"><code>sendURLData()</code> method</a> and
* <a href="#method_sendBlobData"><code>sendBlobData()</code> method</a>.
* <small>The connection will close after the data transfer has been completed or terminated (happens when
* <a href="#event_dataTransferState"><code>dataTransferState</code> event</a> triggers parameter payload
* <code>state</code> as <code>DOWNLOAD_COMPLETED</code>, <code>UPLOAD_COMPLETED</code>,
* <code>REJECTED</code>, <code>CANCEL</code> or <code>ERROR</code> for Peer).</small>
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.1
*/
Skylink.prototype.DATA_CHANNEL_TYPE = {
MESSAGING: 'messaging',
DATA: 'data'
};
/**
* The list of Datachannel sending message error types.
* @attribute DATA_CHANNEL_MESSAGE_ERROR
* @param {String} MESSAGE <small>Value <code>"message"</code></small>
* The value of the Datachannel sending message error type when encountered during
* sending P2P message from <a href="#method_sendP2PMessage"><code>sendP2PMessage()</code> method</a>.
* @param {String} TRANSFER <small>Value <code>"transfer"</code></small>
* The value of the Datachannel sending message error type when encountered during
* data transfers from <a href="#method_sendURLData"><code>sendURLData()</code> method</a> or
* <a href="#method_sendBlobData"><code>sendBlobData()</code> method</a>.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.16
*/
Skylink.prototype.DATA_CHANNEL_MESSAGE_ERROR = {
MESSAGE: 'message',
TRANSFER: 'transfer'
};
/**
* The list of supported data transfer data types.
* @attribute DATA_TRANSFER_DATA_TYPE
* @param {String} BINARY_STRING <small>Value <code>"binaryString"</code></small>
* 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.
* <small>Used only in <a href="#method_sendBlobData"><code>sendBlobData()</code> method</a> when
* parameter <code>sendChunksAsBinary</code> value is <code>false</code>.</small>
* @param {String} ARRAY_BUFFER <small>Value <code>"arrayBuffer"</code></small>
* 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.
* <small>Used only in <a href="#method_sendBlobData"><code>sendBlobData()</code> method</a> when
* parameter <code>sendChunksAsBinary</code> value is <code>true</code>.</small>
* @param {String} BLOB <small>Value <code>"blob"</code></small>
* 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.
* <small>Used only in <a href="#method_sendBlobData"><code>sendBlobData()</code> method</a> when
* parameter <code>sendChunksAsBinary</code> value is <code>true</code>.</small>
* @param {String} STRING <small>Value <code>"string"</code></small>
* 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.
* <small>Used only in <a href="#method_sendURLData"><code>sendURLData()</code> method</a>.</small>
* @type JSON
* @readOnly
* @for Skylink
* @since 0.1.0
*/
Skylink.prototype.DATA_TRANSFER_DATA_TYPE = {
BINARY_STRING: 'binaryString',
ARRAY_BUFFER: 'arrayBuffer',
BLOB: 'blob',
STRING: 'string'
};
/**
* <blockquote class="info">
* Note that this is used only for SDK developer purposes.<br>
* Current version: <code>0.1.0</code>
* </blockquote>
* The value of the current version of the data transfer protocol.
* @attribute DT_PROTOCOL_VERSION
* @type String
* @readOnly
* @for Skylink
* @since 0.5.10
*/
Skylink.prototype.DT_PROTOCOL_VERSION = '0.1.3';
/**
* The list of data transfers directions.
* @attribute DATA_TRANSFER_TYPE
* @param {String} UPLOAD <small>Value <code>"upload"</code></small>
* The value of the data transfer direction when User is uploading data to Peer.
* @param {String} DOWNLOAD <small>Value <code>"download"</code></small>
* The value of the data transfer direction when User is downloading data from Peer.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.1.0
*/
Skylink.prototype.DATA_TRANSFER_TYPE = {
UPLOAD: 'upload',
DOWNLOAD: 'download'
};
/**
* The list of data transfers session types.
* @attribute DATA_TRANSFER_SESSION_TYPE
* @param {String} BLOB <small>Value <code>"blob"</code></small>
* The value of the session type for
* <a href="#method_sendURLData"><code>sendURLData()</code> method</a> data transfer.
* @param {String} DATA_URL <small>Value <code>"dataURL"</code></small>
* The value of the session type for
* <a href="#method_sendBlobData"><code>method_sendBlobData()</code> method</a> data transfer.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.1.0
*/
Skylink.prototype.DATA_TRANSFER_SESSION_TYPE = {
BLOB: 'blob',
DATA_URL: 'dataURL'
};
/**
* The list of data transfer states.
* @attribute DATA_TRANSFER_STATE
* @param {String} UPLOAD_REQUEST <small>Value <code>"request"</code></small>
* The value of the state when receiving an upload data transfer request from Peer to User.
* <small>At this stage, the upload data transfer request from Peer may be accepted or rejected with the
* <a href="#method_acceptDataTransfer"><code>acceptDataTransfer()</code> method</a> invoked by User.</small>
* @parma {String} USER_UPLOAD_REQUEST <small>Value <code>"userRequest"</code></small>
* The value of the state when User sent an upload data transfer request to Peer.
* <small>At this stage, the upload data transfer request to Peer may be accepted or rejected with the
* <a href="#method_acceptDataTransfer"><code>acceptDataTransfer()</code> method</a> invoked by Peer.</small>
* @param {String} UPLOAD_STARTED <small>Value <code>"uploadStarted"</code></small>
* The value of the state when the data transfer request has been accepted
* and data transfer will start uploading data to Peer.
* <small>At this stage, the data transfer may be terminated with the
* <a href="#method_cancelDataTransfer"><code>cancelDataTransfer()</code> method</a>.</small>
* @param {String} DOWNLOAD_STARTED <small>Value <code>"downloadStarted"</code></small>
* The value of the state when the data transfer request has been accepted
* and data transfer will start downloading data from Peer.
* <small>At this stage, the data transfer may be terminated with the
* <a href="#method_cancelDataTransfer"><code>cancelDataTransfer()</code> method</a>.</small>
* @param {String} REJECTED <small>Value <code>"rejected"</code></small>
* The value of the state when upload data transfer request to Peer has been rejected and terminated.
* @param {String} USER_REJECTED <small>Value <code>"userRejected"</code></small>
* The value of the state when User rejected and terminated upload data transfer request from Peer.
* @param {String} UPLOADING <small>Value <code>"uploading"</code></small>
* The value of the state when data transfer is uploading data to Peer.
* @param {String} DOWNLOADING <small>Value <code>"downloading"</code></small>
* The value of the state when data transfer is downloading data from Peer.
* @param {String} UPLOAD_COMPLETED <small>Value <code>"uploadCompleted"</code></small>
* The value of the state when data transfer has uploaded successfully to Peer.
* @param {String} DOWNLOAD_COMPLETED <small>Value <code>"downloadCompleted"</code></small>
* The value of the state when data transfer has downloaded successfully from Peer.
* @param {String} CANCEL <small>Value <code>"cancel"</code></small>
* The value of the state when data transfer has been terminated from / to Peer.
* @param {String} ERROR <small>Value <code>"error"</code></small>
* The value of the state when data transfer has errors and has been terminated from / to Peer.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.4.0
*/
Skylink.prototype.DATA_TRANSFER_STATE = {
UPLOAD_REQUEST: 'request',
UPLOAD_STARTED: 'uploadStarted',
DOWNLOAD_STARTED: 'downloadStarted',
REJECTED: 'rejected',
CANCEL: 'cancel',
ERROR: 'error',
UPLOADING: 'uploading',
DOWNLOADING: 'downloading',
UPLOAD_COMPLETED: 'uploadCompleted',
DOWNLOAD_COMPLETED: 'downloadCompleted',
USER_REJECTED: 'userRejected',
USER_UPLOAD_REQUEST: 'userRequest',
START_ERROR: 'startError'
};
/**
* The list of data streaming states.
* @attribute DATA_STREAM_STATE
* @param {String} SENDING_STARTED <small>Value <code>"sendStart"</code></small>
* The value of the state when data streaming session has started from User to Peer.
* @param {String} RECEIVING_STARTED <small>Value <code>"receiveStart"</code></small>
* The value of the state when data streaming session has started from Peer to Peer.
* @param {String} RECEIVED <small>Value <code>"received"</code></small>
* The value of the state when data streaming session data chunk has been received from Peer to User.
* @param {String} SENT <small>Value <code>"sent"</code></small>
* The value of the state when data streaming session data chunk has been sent from User to Peer.
* @param {String} SENDING_STOPPED <small>Value <code>"sendStop"</code></small>
* The value of the state when data streaming session has stopped from User to Peer.
* @param {String} RECEIVING_STOPPED <small>Value <code>"receivingStop"</code></small>
* The value of the state when data streaming session has stopped from Peer to User.
* @param {String} ERROR <small>Value <code>"error"</code></small>
* The value of the state when data streaming session has errors.
* <small>At this stage, the data streaming state is considered <code>SENDING_STOPPED</code> or
* <code>RECEIVING_STOPPED</code>.</small>
* @param {String} START_ERROR <small>Value <code>"startError"</code></small>
* The value of the state when data streaming session failed to start from User to Peer.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.18
*/
Skylink.prototype.DATA_STREAM_STATE = {
SENDING_STARTED: 'sendStart',
SENDING_STOPPED: 'sendStop',
RECEIVING_STARTED: 'receiveStart',
RECEIVING_STOPPED: 'receiveStop',
RECEIVED: 'received',
SENT: 'sent',
ERROR: 'error',
START_ERROR: 'startError'
};
/**
* <blockquote class="info">
* Learn more about how ICE works in this
* <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
* </blockquote>
* The list of Peer connection ICE gathering states.
* @attribute CANDIDATE_GENERATION_STATE
* @param {String} GATHERING <small>Value <code>"gathering"</code></small>
* The value of the state when Peer connection is gathering ICE candidates.
* <small>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.
* See <a href="#event_iceConnectionState"><code>iceConnectionState</code> event</a> for ICE connection status.</small>
* <small>This state cannot happen until Peer connection remote <code>"offer"</code> / <code>"answer"</code>
* session description is set. See <a href="#event_peerConnectionState">
* <code>peerConnectionState</code> event</a> for session description exchanging status.</small>
* @param {String} COMPLETED <small>Value <code>"completed"</code></small>
* The value of the state when Peer connection gathering of ICE candidates has completed.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.4.1
*/
Skylink.prototype.CANDIDATE_GENERATION_STATE = {
NEW: 'new',
GATHERING: 'gathering',
COMPLETED: 'completed'
};
/**
* <blockquote class="info">
* Learn more about how ICE works in this
* <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
* </blockquote>
* The list of Peer connection remote ICE candidate processing states for trickle ICE connections.
* @attribute CANDIDATE_PROCESSING_STATE
* @param {String} RECEIVED <small>Value <code>"received"</code></small>
* The value of the state when the remote ICE candidate was received.
* @param {String} DROPPED <small>Value <code>"received"</code></small>
* The value of the state when the remote ICE candidate is dropped.
* @param {String} BUFFERED <small>Value <code>"buffered"</code></small>
* The value of the state when the remote ICE candidate is buffered.
* @param {String} PROCESSING <small>Value <code>"processing"</code></small>
* The value of the state when the remote ICE candidate is being processed.
* @param {String} PROCESS_SUCCESS <small>Value <code>"processSuccess"</code></small>
* The value of the state when the remote ICE candidate has been processed successfully.
* <small>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.</small>
* @param {String} PROCESS_ERROR <small>Value <code>"processError"</code></small>
* The value of the state when the remote ICE candidate has failed to be processed.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.16
*/
Skylink.prototype.CANDIDATE_PROCESSING_STATE = {
RECEIVED: 'received',
DROPPED: 'dropped',
BUFFERED: 'buffered',
PROCESSING: 'processing',
PROCESS_SUCCESS: 'processSuccess',
PROCESS_ERROR: 'processError'
};
/**
* <blockquote class="info">
* Learn more about how ICE works in this
* <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
* </blockquote>
* The list of Peer connection ICE connection states.
* @attribute ICE_CONNECTION_STATE
* @param {String} CHECKING <small>Value <code>"checking"</code></small>
* The value of the state when Peer connection is checking for a suitable matching pair of
* ICE candidates to establish ICE connection.
* <small>Exchanging of ICE candidates happens during <a href="#event_candidateGenerationState">
* <code>candidateGenerationState</code> event</a>.</small>
* @param {String} CONNECTED <small>Value <code>"connected"</code></small>
* 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.
* <small>At this state, ICE connection is already established and audio, video and
* data streaming has already started.</small>
* @param {String} COMPLETED <small>Value <code>"completed"</code></small>
* 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.
* <small>At this state, ICE connection is already established and audio, video and
* data streaming has already started. This may happpen after <code>CONNECTED</code>.</small>
* @param {String} FAILED <small>Value <code>"failed"</code></small>
* The value of the state when Peer connection ICE connection has failed.
* @param {String} DISCONNECTED <small>Value <code>"disconnected"</code></small>
* The value of the state when Peer connection ICE connection is disconnected.
* <small>At this state, the Peer connection may attempt to revive the ICE connection.
* This may happen due to flaky network conditions.</small>
* @param {String} CLOSED <small>Value <code>"closed"</code></small>
* The value of the state when Peer connection ICE connection has closed.
* <small>This happens when Peer connection is closed and no streaming can occur at this stage.</small>
* @param {String} TRICKLE_FAILED <small>Value <code>"trickeFailed"</code></small>
* The value of the state when Peer connection ICE connection has failed during trickle ICE.
* <small>Trickle ICE is enabled in <a href="#method_init"><code>init()</code> method</a>
* <code>enableIceTrickle</code> option.</small>
* @type JSON
* @readOnly
* @for Skylink
* @since 0.1.0
*/
Skylink.prototype.ICE_CONNECTION_STATE = {
STARTING: 'starting',
CHECKING: 'checking',
CONNECTED: 'connected',
COMPLETED: 'completed',
CLOSED: 'closed',
FAILED: 'failed',
TRICKLE_FAILED: 'trickleFailed',
DISCONNECTED: 'disconnected'
};
/**
* <blockquote class="info">
* 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 <code?transport=(protocol)</code> query option when constructing
* the Peer connection. When all protocols are selected, the ICE servers urls are duplicated with all protocols.
* </blockquote>
* The list of TURN network transport protocols options when constructing Peer connections
* configured in the <a href="#method_init"><code>init()</code> method</a>.
* <small>Example <code>.urls</code> inital input: [<code>"turn:server.com?transport=tcp"</code>,
* <code>"turn:server1.com:3478"</code>, <code>"turn:server.com?transport=udp"</code>]</small>
* @attribute TURN_TRANSPORT
* @param {String} TCP <small>Value <code>"tcp"</code></small>
* The value of the option to configure using only TCP network transport protocol.
* <small>Example <code>.urls</code> output: [<code>"turn:server.com?transport=tcp"</code>,
* <code>"turn:server1.com:3478?transport=tcp"</code>]</small>
* @param {String} UDP <small>Value <code>"udp"</code></small>
* The value of the option to configure using only UDP network transport protocol.
* <small>Example <code>.urls</code> output: [<code>"turn:server.com?transport=udp"</code>,
* <code>"turn:server1.com:3478?transport=udp"</code>]</small>
* @param {String} ANY <small>Value <code>"any"</code></small>
* The value of the option to configure using any network transport protocols configured from the Signaling server.
* <small>Example <code>.urls</code> output: [<code>"turn:server.com?transport=tcp"</code>,
* <code>"turn:server1.com:3478"</code>, <code>"turn:server.com?transport=udp"</code>]</small>
* @param {String} NONE <small>Value <code>"none"</code></small>
* The value of the option to not configure using any network transport protocols.
* <small>Example <code>.urls</code> output: [<code>"turn:server.com"</code>, <code>"turn:server1.com:3478"</code>]</small>
* <small>Configuring this does not mean that no protocols will be used, but
* rather removing <code>?transport=(protocol)</code> query option in
* the TURN ICE server <code>.urls</code> when constructing the Peer connection.</small>
* @param {String} ALL <small>Value <code>"all"</code></small>
* The value of the option to configure using both TCP and UDP network transport protocols.
* <small>Example <code>.urls</code> output: [<code>"turn:server.com?transport=tcp"</code>,
* <code>"turn:server.com?transport=udp"</code>, <code>"turn:server1.com:3478?transport=tcp"</code>,
* <code>"turn:server1.com:3478?transport=udp"</code>]</small>
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.4
*/
Skylink.prototype.TURN_TRANSPORT = {
UDP: 'udp',
TCP: 'tcp',
ANY: 'any',
NONE: 'none',
ALL: 'all'
};
/**
* <blockquote class="info">
* Learn more about how ICE works in this
* <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
* </blockquote>
* The list of Peer connection session description exchanging states.
* @attribute PEER_CONNECTION_STATE
* @param {String} STABLE <small>Value <code>"stable"</code></small>
* The value of the state when there is no session description being exchanged between Peer connection.
* @param {String} HAVE_LOCAL_OFFER <small>Value <code>"have-local-offer"</code></small>
* The value of the state when local <code>"offer"</code> session description is set.
* <small>This should transition to <code>STABLE</code> state after remote <code>"answer"</code>
* session description is set.</small>
* <small>See <a href="#event_handshakeProgress"><code>handshakeProgress</code> event</a> for a more
* detailed exchanging of session description states.</small>
* @param {String} HAVE_REMOTE_OFFER <small>Value <code>"have-remote-offer"</code></small>
* The value of the state when remote <code>"offer"</code> session description is set.
* <small>This should transition to <code>STABLE</code> state after local <code>"answer"</code>
* session description is set.</small>
* <small>See <a href="#event_handshakeProgress"><code>handshakeProgress</code> event</a> for a more
* detailed exchanging of session description states.</small>
* @param {String} CLOSED <small>Value <code>"closed"</code></small>
* The value of the state when Peer connection is closed and no session description can be exchanged and set.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.0
*/
Skylink.prototype.PEER_CONNECTION_STATE = {
STABLE: 'stable',
HAVE_LOCAL_OFFER: 'have-local-offer',
HAVE_REMOTE_OFFER: 'have-remote-offer',
CLOSED: 'closed'
};
/**
* The list of <a href="#method_getConnectionStatus"><code>getConnectionStatus()</code>
* method</a> retrieval states.
* @attribute GET_CONNECTION_STATUS_STATE
* @param {Number} RETRIEVING <small>Value <code>0</code></small>
* The value of the state when <code>getConnectionStatus()</code> is retrieving the Peer connection stats.
* @param {Number} RETRIEVE_SUCCESS <small>Value <code>1</code></small>
* The value of the state when <code>getConnectionStatus()</code> has retrieved the Peer connection stats successfully.
* @param {Number} RETRIEVE_ERROR <small>Value <code>-1</code></small>
* The value of the state when <code>getConnectionStatus()</code> has failed retrieving the Peer connection stats.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.1.0
*/
Skylink.prototype.GET_CONNECTION_STATUS_STATE = {
RETRIEVING: 0,
RETRIEVE_SUCCESS: 1,
RETRIEVE_ERROR: -1
};
/**
* <blockquote class="info">
* As there are more features getting implemented, there will be eventually more different types of
* server Peers.
* </blockquote>
* The list of available types of server Peer connections.
* @attribute SERVER_PEER_TYPE
* @param {String} MCU <small>Value <code>"mcu"</code></small>
* The value of the server Peer type that is used for MCU connection.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.1
*/
Skylink.prototype.SERVER_PEER_TYPE = {
MCU: 'mcu'
//SIP: 'sip'
};
/**
* <blockquote class="info">
* Learn more about how ICE works in this
* <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
* </blockquote>
* The list of available Peer connection bundle policies.
* @attribute BUNDLE_POLICY
* @param {String} MAX_COMPAT <small>Value <code>"max-compat"</code></small>
* The value of the bundle policy to generate ICE candidates for each media type
* so each media type flows through different transports.
* @param {String} MAX_BUNDLE <small>Value <code>"max-bundle"</code></small>
* The value of the bundle policy to generate ICE candidates for one media type
* so all media type flows through a single transport.
* @param {String} BALANCED <small>Value <code>"balanced"</code></small>
* The value of the bundle policy to use <code>MAX_BUNDLE</code> if Peer supports it,
* else fallback to <code>MAX_COMPAT</code>.
* @param {String} NONE <small>Value <code>"none"</code></small>
* The value of the bundle policy to not use any media bundle.
* <small>This removes the <code>a=group:BUNDLE</code> line from session descriptions.</small>
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.18
*/
Skylink.prototype.BUNDLE_POLICY = {
MAX_COMPAT: 'max-compat',
BALANCED: 'balanced',
MAX_BUNDLE: 'max-bundle',
NONE: 'none'
};
/**
* <blockquote class="info">
* Learn more about how ICE works in this
* <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
* </blockquote>
* The list of available Peer connection RTCP mux policies.
* @attribute RTCP_MUX_POLICY
* @param {String} REQUIRE <small>Value <code>"require"</code></small>
* The value of the RTCP mux policy to generate ICE candidates for RTP only and RTCP shares the same ICE candidates.
* @param {String} NEGOTIATE <small>Value <code>"negotiate"</code></small>
* The value of the RTCP mux policy to generate ICE candidates for both RTP and RTCP each.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.18
*/
Skylink.prototype.RTCP_MUX_POLICY = {
REQUIRE: 'require',
NEGOTIATE: 'negotiate'
};
/**
* <blockquote class="info">
* Learn more about how ICE works in this
* <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
* </blockquote>
* The list of available Peer connection certificates cryptographic algorithm to use.
* @attribute PEER_CERTIFICATE
* @param {String} RSA <small>Value <code>"RSA"</code></small>
* The value of the Peer connection certificate algorithm to use RSA-1024.
* @param {String} ECDSA <small>Value <code>"ECDSA"</code></small>
* The value of the Peer connection certificate algorithm to use ECDSA.
* @param {String} AUTO <small>Value <code>"AUTO"</code></small>
* The value of the Peer connection to use the default certificate generated.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.18
*/
Skylink.prototype.PEER_CERTIFICATE = {
RSA: 'RSA',
ECDSA: 'ECDSA',
AUTO: 'AUTO'
};
/**
* The list of Peer connection states.
* @attribute HANDSHAKE_PROGRESS
* @param {String} ENTER <small>Value <code>"enter"</code></small>
* The value of the connection state when Peer has just entered the Room.
* <small>At this stage, <a href="#event_peerJoined"><code>peerJoined</code> event</a>
* is triggered.</small>
* @param {String} WELCOME <small>Value <code>"welcome"</code></small>
* The value of the connection state when Peer is aware that User has entered the Room.
* <small>At this stage, <a href="#event_peerJoined"><code>peerJoined</code> event</a>
* is triggered and Peer connection may commence.</small>
* @param {String} OFFER <small>Value <code>"offer"</code></small>
* The value of the connection state when Peer connection has set the local / remote <code>"offer"</code>
* session description to start streaming connection.
* @param {String} ANSWER <small>Value <code>"answer"</code></small>
* The value of the connection state when Peer connection has set the local / remote <code>"answer"</code>
* session description to establish streaming connection.
* @param {String} ERROR <small>Value <code>"error"</code></small>
* The value of the connection state when Peer connection has failed to establish streaming connection.
* <small>This happens when there are errors that occurs in creating local <code>"offer"</code> /
* <code>"answer"</code>, or when setting remote / local <code>"offer"</code> / <code>"answer"</code>.</small>
* @type JSON
* @readOnly
* @for Skylink
* @since 0.1.0
*/
Skylink.prototype.HANDSHAKE_PROGRESS = {
ENTER: 'enter',
WELCOME: 'welcome',
OFFER: 'offer',
ANSWER: 'answer',
ERROR: 'error'
};
/**
* <blockquote class="info">
* Note that this feature requires <code>"isPrivileged"</code> flag to be enabled for the App Key
* provided in the <a href="#method_init"><code>init()</code> method</a>, 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.
* <a href="http://support.temasys.io/support/solutions/articles/12000012342-what-is-a-privileged-key-">
* Read more about privileged App Key feature here</a>.
* </blockquote>
* The list of <a href="#method_getPeers"><code>getPeers()</code> method</a> retrieval states.
* @attribute GET_PEERS_STATE
* @param {String} ENQUIRED <small>Value <code>"enquired"</code></small>
* The value of the state when <code>getPeers()</code> is retrieving the list of Peer IDs
* from Rooms within the same App space from the Signaling server.
* @param {String} RECEIVED <small>Value <code>"received"</code></small>
* The value of the state when <code>getPeers()</code> has retrieved the list of Peer IDs
* from Rooms within the same App space from the Signaling server successfully.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.1
*/
Skylink.prototype.GET_PEERS_STATE = {
ENQUIRED: 'enquired',
RECEIVED: 'received'
};
/**
* <blockquote class="info">
* Note that this feature requires <code>"isPrivileged"</code> flag to be enabled and
* <code>"autoIntroduce"</code> flag to be disabled for the App Key provided in the
* <a href="#method_init"><code>init()</code> method</a>, 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.
* <a href="http://support.temasys.io/support/solutions/articles/12000012342-what-is-a-privileged-key-">
* Read more about privileged App Key feature here</a>.
* </blockquote>
* The list of <a href="#method_introducePeer"><code>introducePeer</code> method</a> Peer introduction request states.
* @attribute INTRODUCE_STATE
* @param {String} INTRODUCING <small>Value <code>"enquired"</code></small>
* The value of the state when introduction request for the selected pair of Peers has been made to the Signaling server.
* @param {String} ERROR <small>Value <code>"error"</code></small>
* The value of the state when introduction request made to the Signaling server
* for the selected pair of Peers has failed.
* @readOnly
* @for Skylink
* @since 0.6.1
*/
Skylink.prototype.INTRODUCE_STATE = {
INTRODUCING: 'introducing',
ERROR: 'error'
};
/**
* The list of Signaling server reaction states during <a href="#method_joinRoom"><code>joinRoom()</code> method</a>.
* @attribute SYSTEM_ACTION
* @param {String} WARNING <small>Value <code>"warning"</code></small>
* The value of the state when Room session is about to end.
* @param {String} REJECT <small>Value <code>"reject"</code></small>
* The value of the state when Room session has failed to start or has ended.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.1
*/
Skylink.prototype.SYSTEM_ACTION = {
WARNING: 'warning',
REJECT: 'reject'
};
/**
* The list of Signaling server reaction states reason of action code during
* <a href="#method_joinRoom"><code>joinRoom()</code> method</a>.
* @attribute SYSTEM_ACTION_REASON
* @param {String} CREDENTIALS_EXPIRED <small>Value <code>"oldTimeStamp"</code></small>
* The value of the reason code when Room session token has expired.
* <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
* <small>Results with: <code>REJECT</code></small>
* @param {String} CREDENTIALS_ERROR <small>Value <code>"credentialError"</code></small>
* The value of the reason code when Room session token provided is invalid.
* <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
* @param {String} DUPLICATED_LOGIN <small>Value <code>"duplicatedLogin"</code></small>
* The value of the reason code when Room session token has been used already.
* <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
* <small>Results with: <code>REJECT</code></small>
* @param {String} ROOM_NOT_STARTED <small>Value <code>"notStart"</code></small>
* The value of the reason code when Room session has not started.
* <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
* <small>Results with: <code>REJECT</code></small>
* @param {String} EXPIRED <small>Value <code>"expired"</code></small>
* The value of the reason code when Room session has ended already.
* <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
* <small>Results with: <code>REJECT</code></small>
* @param {String} ROOM_LOCKED <small>Value <code>"locked"</code></small>
* The value of the reason code when Room is locked.
* <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
* <small>Results with: <code>REJECT</code></small>
* @param {String} FAST_MESSAGE <small>Value <code>"fastmsg"</code></small>
* 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.
* <small>Happens after Room session has started. This can be caused by various methods like
* <a href="#method_sendMessage"><code>sendMessage()</code> method</a>,
* <a href="#method_setUserData"><code>setUserData()</code> method</a>,
* <a href="#method_muteStream"><code>muteStream()</code> method</a>,
* <a href="#method_enableAudio"><code>enableAudio()</code> method</a>,
* <a href="#method_enableVideo"><code>enableVideo()</code> method</a>,
* <a href="#method_disableAudio"><code>disableAudio()</code> method</a> and
* <a href="#method_disableVideo"><code>disableVideo()</code> method</a></small>
* <small>Results with: <code>WARNING</code></small>
* @param {String} ROOM_CLOSING <small>Value <code>"toClose"</code></small>
* The value of the reason code when Room session is ending.
* <small>Happens after Room session has started. This serves as a prerequisite warning before
* <code>ROOM_CLOSED</code> occurs.</small>
* <small>Results with: <code>WARNING</code></small>
* @param {String} ROOM_CLOSED <small>Value <code>"roomclose"</code></small>
* The value of the reason code when Room session has just ended.
* <small>Happens after Room session has started.</small>
* <small>Results with: <code>REJECT</code></small>
* @param {String} SERVER_ERROR <small>Value <code>"serverError"</code></small>
* The value of the reason code when Room session fails to start due to some technical errors.
* <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
* <small>Results with: <code>REJECT</code></small>
* @param {String} KEY_ERROR <small>Value <code>"keyFailed"</code></small>
* The value of the reason code when Room session fails to start due to some technical error pertaining to
* App Key initialization.
* <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
* <small>Results with: <code>REJECT</code></small>
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.2
*/
Skylink.prototype.SYSTEM_ACTION_REASON = {
CREDENTIALS_EXPIRED: 'oldTimeStamp',
CREDENTIALS_ERROR: 'credentialError',
DUPLICATED_LOGIN: 'duplicatedLogin',
ROOM_NOT_STARTED: 'notStart',
EXPIRED: 'expired',
ROOM_LOCKED: 'locked',
FAST_MESSAGE: 'fastmsg',
ROOM_CLOSING: 'toclose',
ROOM_CLOSED: 'roomclose',
SERVER_ERROR: 'serverError',
KEY_ERROR: 'keyFailed'
};
/**
* Contains the current version of Skylink Web SDK.
* @attribute VERSION
* @type String
* @readOnly
* @for Skylink
* @since 0.1.0
*/
Skylink.prototype.VERSION = '@@version';
/**
* The list of <a href="#method_init"><code>init()</code> method</a> ready states.
* @attribute READY_STATE_CHANGE
* @param {Number} INIT <small>Value <code>0</code></small>
* The value of the state when <code>init()</code> has just started.
* @param {Number} LOADING <small>Value <code>1</code></small>
* The value of the state when <code>init()</code> is authenticating App Key provided
* (and with credentials if provided as well) with the Auth server.
* @param {Number} COMPLETED <small>Value <code>2</code></small>
* The value of the state when <code>init()</code> has successfully authenticated with the Auth server.
* Room session token is generated for joining the <code>defaultRoom</code> provided in <code>init()</code>.
* <small>Room session token has to be generated each time User switches to a different Room
* in <a href="#method_joinRoom"><code>joinRoom()</code> method</a>.</small>
* @param {Number} ERROR <small>Value <code>-1</code></small>
* The value of the state when <code>init()</code> has failed authenticating with the Auth server.
* [Rel: Skylink.READY_STATE_CHANGE_ERROR]
* @type JSON
* @readOnly
* @for Skylink
* @since 0.1.0
*/
Skylink.prototype.READY_STATE_CHANGE = {
INIT: 0,
LOADING: 1,
COMPLETED: 2,
ERROR: -1
};
/**
* The list of <a href="#method_init"><code>init()</code> method</a> ready state failure codes.
* @attribute READY_STATE_CHANGE_ERROR
* @param {Number} API_INVALID <small>Value <code>4001</code></small>
* The value of the failure code when provided App Key in <code>init()</code> does not exists.
* <small>To resolve this, check that the provided App Key exists in
* <a href="https://console.temasys.io">the Temasys Console</a>.</small>
* @param {Number} API_DOMAIN_NOT_MATCH <small>Value <code>4002</code></small>
* The value of the failure code when <code>"domainName"</code> property in the App Key does not
* match the accessing server IP address.
* <small>To resolve this, contact our <a href="http://support.temasys.io">support portal</a>.</small>
* @param {Number} API_CORS_DOMAIN_NOT_MATCH <small>Value <code>4003</code></small>
* The value of the failure code when <code>"corsurl"</code> property in the App Key does not match accessing CORS.
* <small>To resolve this, configure the App Key CORS in
* <a href="https://console.temasys.io">the Temasys Console</a>.</small>
* @param {Number} API_CREDENTIALS_INVALID <small>Value <code>4004</code></small>
* The value of the failure code when there is no [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)
* present in the HTTP headers during the request to the Auth server present nor
* <code>options.credentials.credentials</code> configuration provided in the <code>init()</code>.
* <small>To resolve this, ensure that CORS are present in the HTTP headers during the request to the Auth server.</small>
* @param {Number} API_CREDENTIALS_NOT_MATCH <small>Value <code>4005</code></small>
* The value of the failure code when the <code>options.credentials.credentials</code> configuration provided in the
* <code>init()</code> does not match up with the <code>options.credentials.startDateTime</code>,
* <code>options.credentials.duration</code> or that the <code>"secret"</code> used to generate
* <code>options.credentials.credentials</code> does not match the App Key's <code>"secret</code> property provided.
* <small>To resolve this, check that the <code>options.credentials.credentials</code> is generated correctly and
* that the <code>"secret"</code> used to generate it is from the App Key provided in the <code>init()</code>.</small>
* @param {Number} API_INVALID_PARENT_KEY <small>Value <code>4006</code></small>
* The value of the failure code when the App Key provided does not belong to any existing App.
* <small>To resolve this, check that the provided App Key exists in
* <a href="https://console.temasys.io">the Developer Console</a>.</small>
* @param {Number} API_NO_MEETING_RECORD_FOUND <small>Value <code>4010</code></small>
* The value of the failure code when provided <code>options.credentials</code>
* does not match any scheduled meetings available for the "Persistent Room" enabled App Key provided.
* <small>See the <a href="http://support.temasys.io/support/solutions/articles/
* 12000002811-using-the-persistent-room-feature-to-configure-meetings">Persistent Room article</a> to learn more.</small>
* @param {Number} API_OVER_SEAT_LIMIT <small>Value <code>4020</code></small>
* The value of the failure code when App Key has reached its current concurrent users limit.
* <small>To resolve this, use another App Key. To create App Keys dynamically, see the
* <a href="https://temasys.atlassian.net/wiki/display/TPD/SkylinkAPI+-+Application+Resources">Application REST API
* docs</a> for more information.</small>
* @param {Number} API_RETRIEVAL_FAILED <small>Value <code>4021</code></small>
* The value of the failure code when App Key retrieval of authentication token fails.
* <small>If this happens frequently, contact our <a href="http://support.temasys.io">support portal</a>.</small>
* @param {Number} API_WRONG_ACCESS_DOMAIN <small>Value <code>5005</code></small>
* The value of the failure code when App Key makes request to the incorrect Auth server.
* <small>To resolve this, ensure that the <code>roomServer</code> is not configured. If this persists even without
* <code>roomServer</code> configuration, contact our <a href="http://support.temasys.io">support portal</a>.</small>
* @param {Number} XML_HTTP_REQUEST_ERROR <small>Value <code>-1</code></small>
* The value of the failure code when requesting to Auth server has timed out.
* @param {Number} XML_HTTP_NO_REPONSE_ERROR <small>Value <code>-2</code></small>
* The value of the failure code when response from Auth server is empty or timed out.
* @param {Number} NO_SOCKET_IO <small>Value <code>1</code></small>
* The value of the failure code when dependency <a href="http://socket.io/download/">Socket.IO client</a> is not loaded.
* <small>To resolve this, ensure that the Socket.IO client dependency is loaded before the Skylink SDK.
* You may use the provided Socket.IO client <a href="http://socket.io/download/">CDN here</a>.</small>
* @param {Number} NO_XMLHTTPREQUEST_SUPPORT <small>Value <code>2</code></small>
* The value of the failure code when <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest">
* XMLHttpRequest API</a> required to make request to Auth server is not supported.
* <small>To resolve this, display in the Web UI to ask clients to switch to the list of supported browser
* as <a href="https://github.com/Temasys/SkylinkJS/tree/0.6.14#supported-browsers">listed in here</a>.</small>
* @param {Number} NO_WEBRTC_SUPPORT <small>Value <code>3</code></small>
* The value of the failure code when <a href="https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/">
* RTCPeerConnection API</a> required for Peer connections is not supported.
* <small>To resolve this, display in the Web UI to ask clients to switch to the list of supported browser
* as <a href="https://github.com/Temasys/SkylinkJS/tree/0.6.14#supported-browsers">listed in here</a>.
* For <a href="http://confluence.temasys.com.sg/display/TWPP">plugin supported browsers</a>, 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.</small>
* @param {Number} NO_PATH <small>Value <code>4</code></small>
* The value of the failure code when provided <code>init()</code> configuration has errors.
* @param {Number} ADAPTER_NO_LOADED <small>Value <code>7</code></small>
* The value of the failure code when dependency <a href="https://github.com/Temasys/AdapterJS/">AdapterJS</a>
* is not loaded.
* <small>To resolve this, ensure that the AdapterJS dependency is loaded before the Skylink dependency.
* You may use the provided AdapterJS <a href="https://github.com/Temasys/AdapterJS/">CDN here</a>.</small>
* @param {Number} PARSE_CODECS <small>Value <code>8</code></small>
* The value of the failure code when codecs support cannot be parsed and retrieved.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.4.0
*/
Skylink.prototype.READY_STATE_CHANGE_ERROR = {
API_INVALID: 4001,
API_DOMAIN_NOT_MATCH: 4002,
API_CORS_DOMAIN_NOT_MATCH: 4003,
API_CREDENTIALS_INVALID: 4004,
API_CREDENTIALS_NOT_MATCH: 4005,
API_INVALID_PARENT_KEY: 4006,
API_NO_MEETING_RECORD_FOUND: 4010,
API_OVER_SEAT_LIMIT: 4020,
API_RETRIEVAL_FAILED: 4021,
API_WRONG_ACCESS_DOMAIN: 5005,
XML_HTTP_REQUEST_ERROR: -1,
XML_HTTP_NO_REPONSE_ERROR: -2,
NO_SOCKET_IO: 1,
NO_XMLHTTPREQUEST_SUPPORT: 2,
NO_WEBRTC_SUPPORT: 3,
NO_PATH: 4,
ADAPTER_NO_LOADED: 7,
PARSE_CODECS: 8
};
/**
* 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.
* @attribute REGIONAL_SERVER
* @type JSON
* @readOnly
* @private
* @for Skylink
* @since 0.6.16
*/
Skylink.prototype.REGIONAL_SERVER = {
APAC1: '',
US1: ''
};
/**
* The list of User's priority weight schemes for <a href="#method_joinRoom">
* <code>joinRoom()</code> method</a> connections.
* @attribute PRIORITY_WEIGHT_SCHEME
* @param {String} ENFORCE_OFFERER <small>Value <code>"enforceOfferer"</code></small>
* The value of the priority weight scheme to enforce User as the offerer.
* @param {String} ENFORCE_ANSWERER <small>Value <code>"enforceAnswerer"</code></small>
* The value of the priority weight scheme to enforce User as the answerer.
* @param {String} AUTO <small>Value <code>"auto"</code></small>
* The value of the priority weight scheme to let User be offerer or answerer based on Signaling server selection.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.18
*/
Skylink.prototype.PRIORITY_WEIGHT_SCHEME = {
ENFORCE_OFFERER: 'enforceOfferer',
ENFORCE_ANSWERER: 'enforceAnswerer',
AUTO: 'auto'
};
/**
* The list of the SDK <code>console</code> API log levels.
* @attribute LOG_LEVEL
* @param {Number} DEBUG <small>Value <code>4</code></small>
* The value of the log level that displays <code>console</code> <code>debug</code>,
* <code>log</code>, <code>info</code>, <code>warn</code> and <code>error</code> logs.
* @param {Number} LOG <small>Value <code>3</code></small>
* The value of the log level that displays only <code>console</code> <code>log</code>,
* <code>info</code>, <code>warn</code> and <code>error</code> logs.
* @param {Number} INFO <small>Value <code>2</code></small>
* The value of the log level that displays only <code>console</code> <code>info</code>,
* <code>warn</code> and <code>error</code> logs.
* @param {Number} WARN <small>Value <code>1</code></small>
* The value of the log level that displays only <code>console</code> <code>warn</code>
* and <code>error</code> logs.
* @param {Number} ERROR <small>Value <code>0</code></small>
* The value of the log level that displays only <code>console</code> <code>error</code> logs.
* @param {Number} NONE <small>Value <code>-1</code></small>
* The value of the log level that displays no logs.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.4
*/
Skylink.prototype.LOG_LEVEL = {
DEBUG: 4,
LOG: 3,
INFO: 2,
WARN: 1,
ERROR: 0,
NONE: -1
};
/**
* The list of <a href="#method_joinRoom"><code>joinRoom()</code> method</a> socket connection failure states.
* @attribute SOCKET_ERROR
* @param {Number} CONNECTION_FAILED <small>Value <code>0</code></small>
* The value of the failure state when <code>joinRoom()</code> socket connection failed to establish with
* the Signaling server at the first attempt.
* @param {Number} RECONNECTION_FAILED <small>Value <code>-1</code></small>
* The value of the failure state when <code>joinRoom()</code> socket connection failed to establish
* the Signaling server after the first attempt.
* @param {Number} CONNECTION_ABORTED <small>Value <code>-2</code></small>
* The value of the failure state when <code>joinRoom()</code> socket connection will not attempt
* to reconnect after the failure of the first attempt in <code>CONNECTION_FAILED</code> as there
* are no more ports or transports to attempt for reconnection.
* @param {Number} RECONNECTION_ABORTED <small>Value <code>-3</code></small>
* The value of the failure state when <code>joinRoom()</code> socket connection will not attempt
* to reconnect after the failure of several attempts in <code>RECONNECTION_FAILED</code> as there
* are no more ports or transports to attempt for reconnection.
* @param {Number} RECONNECTION_ATTEMPT <small>Value <code>-4</code></small>
* The value of the failure state when <code>joinRoom()</code> socket connection is attempting
* to reconnect with a new port or transport after the failure of attempts in
* <code>CONNECTION_FAILED</code> or <code>RECONNECTED_FAILED</code>.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.6
*/
Skylink.prototype.SOCKET_ERROR = {
CONNECTION_FAILED: 0,
RECONNECTION_FAILED: -1,
CONNECTION_ABORTED: -2,
RECONNECTION_ABORTED: -3,
RECONNECTION_ATTEMPT: -4
};
/**
* The list of <a href="#method_joinRoom"><code>joinRoom()</code> method</a> socket connection reconnection states.
* @attribute SOCKET_FALLBACK
* @param {String} NON_FALLBACK <small>Value <code>"nonfallback"</code></small>
* The value of the reconnection state when <code>joinRoom()</code> socket connection is at its initial state
* without transitioning to any new socket port or transports yet.
* @param {String} FALLBACK_PORT <small>Value <code>"fallbackPortNonSSL"</code></small>
* The value of the reconnection state when <code>joinRoom()</code> socket connection is reconnecting with
* another new HTTP port using WebSocket transports to attempt to establish connection with Signaling server.
* @param {String} FALLBACK_PORT_SSL <small>Value <code>"fallbackPortSSL"</code></small>
* The value of the reconnection state when <code>joinRoom()</code> socket connection is reconnecting with
* another new HTTPS port using WebSocket transports to attempt to establish connection with Signaling server.
* @param {String} LONG_POLLING <small>Value <code>"fallbackLongPollingNonSSL"</code></small>
* The value of the reconnection state when <code>joinRoom()</code> socket connection is reconnecting with
* another new HTTP port using Polling transports to attempt to establish connection with Signaling server.
* @param {String} LONG_POLLING_SSL <small>Value <code>"fallbackLongPollingSSL"</code></small>
* The value of the reconnection state when <code>joinRoom()</code> socket connection is reconnecting with
* another new HTTPS port using Polling transports to attempt to establish connection with Signaling server.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.6
*/
Skylink.prototype.SOCKET_FALLBACK = {
NON_FALLBACK: 'nonfallback',
FALLBACK_PORT: 'fallbackPortNonSSL',
FALLBACK_SSL_PORT: 'fallbackPortSSL',
LONG_POLLING: 'fallbackLongPollingNonSSL',
LONG_POLLING_SSL: 'fallbackLongPollingSSL'
};
/**
* <blockquote class="info">
* Note that this is used only for SDK developer purposes.<br>
* Current version: <code>0.1.4</code>
* </blockquote>
* The value of the current version of the Signaling socket message protocol.
* @attribute SM_PROTOCOL_VERSION
* @type String
* @for Skylink
* @since 0.6.0
*/
Skylink.prototype.SM_PROTOCOL_VERSION = '0.1.2.4';
/**
* <blockquote class="info">
* Note that if the video codec is not supported, the SDK will not configure the local <code>"offer"</code> or
* <code>"answer"</code> session description to prefer the codec.
* </blockquote>
* The 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 <a href="#method_init"><code>init()</code> method</a>.
* @attribute VIDEO_CODEC
* @param {String} AUTO <small>Value <code>"auto"</code></small>
* The value of the option to not prefer any video codec but rather use the created
* local <code>"offer"</code> / <code>"answer"</code> session description video codec preference.
* @param {String} VP8 <small>Value <code>"VP8"</code></small>
* The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/VP8">VP8</a> video codec.
* @param {String} VP9 <small>Value <code>"VP9"</code></small>
* The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/VP9">VP9</a> video codec.
* @param {String} H264 <small>Value <code>"H264"</code></small>
* The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC">H264</a> video codec.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.10
*/
Skylink.prototype.VIDEO_CODEC = {
AUTO: 'auto',
VP8: 'VP8',
H264: 'H264',
VP9: 'VP9'
//H264UC: 'H264UC'
};
/**
* <blockquote class="info">
* Note that if the audio codec is not supported, the SDK will not configure the local <code>"offer"</code> or
* <code>"answer"</code> session description to prefer the codec.
* </blockquote>
* The 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 <a href="#method_init"><code>init()</code> method</a>.
* @attribute AUDIO_CODEC
* @param {String} AUTO <small>Value <code>"auto"</code></small>
* The value of the option to not prefer any audio codec but rather use the created
* local <code>"offer"</code> / <code>"answer"</code> session description audio codec preference.
* @param {String} OPUS <small>Value <code>"opus"</code></small>
* The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/Opus_(audio_format)">OPUS</a> audio codec.
* @param {String} ISAC <small>Value <code>"ISAC"</code></small>
* The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/Internet_Speech_Audio_Codec">ISAC</a> audio codec.
* @param {String} ILBC <small>Value <code>"ILBC"</code></small>
* The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/Internet_Low_Bitrate_Codec">iLBC</a> audio codec.
* @param {String} G722 <small>Value <code>"G722"</code></small>
* The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/G.722">G722</a> audio codec.
* @param {String} PCMA <small>Value <code>"PCMA"</code></small>
* The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/G.711">G711u</a> audio codec.
* @param {String} PCMU <small>Value <code>"PCMU"</code></small>
* The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/G.711">G711a</a> audio codec.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.10
*/
Skylink.prototype.AUDIO_CODEC = {
AUTO: 'auto',
ISAC: 'ISAC',
OPUS: 'opus',
ILBC: 'ILBC',
G722: 'G722',
PCMU: 'PCMU',
PCMA: 'PCMA',
//SILK: 'SILK'
};
/**
* The list of available screensharing media sources configured in the
* <a href="#method_shareScreen"><code>shareScreen()</code> method</a>.
* @attribute MEDIA_SOURCE
* @param {String} SCREEN <small>Value <code>"screen"</code></small>
* The value of the option to share entire screen.
* @param {String} WINDOW <small>Value <code>"window"</code></small>
* The value of the option to share application windows.
* @param {String} TAB <small>Value <code>"tab"</code></small>
* The value of the option to share browser tab.
* <small>Note that this is only supported by from Chrome 52+ and Opera 39+.</small>
* @param {String} TAB_AUDIO <small>Value <code>"audio"</code></small>
* The value of the option to share browser tab audio.
* <small>Note that this is only supported by Chrome 52+ and Opera 39+.</small>
* <small><code>options.audio</code> has to be enabled with <code>TAB</code> also requested to enable sharing of tab audio.</small>
* @param {String} APPLICATION <small>Value <code>"application"</code></small>
* The value of the option to share applications.
* <small>Note that this is only supported by Firefox currently.</small>
* @param {String} BROWSER <small>Value <code>"browser"</code></small>
* The value of the option to share browser.
* <small>Note that this is only supported by Firefox currently, and requires toggling the <code>media.getUserMedia.browser.enabled</code>
* in <code>about:config</code>.</small>
* @param {String} CAMERA <small>Value <code>"camera"</code></small>
* The value of the option to share camera.
* <small>Note that this is only supported by Firefox currently.</small>
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.10
*/
Skylink.prototype.MEDIA_SOURCE = {
SCREEN: 'screen',
WINDOW: 'window',
TAB: 'tab',
TAB_AUDIO: 'audio',
APPLICATION: 'application',
BROWSER: 'browser',
CAMERA: 'camera'
};
/**
* <blockquote class="info">
* Note that currently <a href="#method_getUserMedia"><code>getUserMedia()</code> method</a> only configures
* the maximum resolution of the Stream due to browser interopability and support.
* </blockquote>
* The list of <a href="https://en.wikipedia.org/wiki/Graphics_display_resolution#Video_Graphics_Array">
* video resolutions</a> sets configured in the <a href="#method_getUserMedia"><code>getUserMedia()</code> method</a>.
* @attribute VIDEO_RESOLUTION
* @param {JSON} QQVGA <small>Value <code>{ width: 160, height: 120 }</code></small>
* The value of the option to configure QQVGA resolution.
* <small>Aspect ratio: <code>4:3</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} HQVGA <small>Value <code>{ width: 240, height: 160 }</code></small>
* The value of the option to configure HQVGA resolution.
* <small>Aspect ratio: <code>3:2</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} QVGA <small>Value <code>{ width: 320, height: 240 }</code></small>
* The value of the option to configure QVGA resolution.
* <small>Aspect ratio: <code>4:3</code></small>
* @param {JSON} WQVGA <small>Value <code>{ width: 384, height: 240 }</code></small>
* The value of the option to configure WQVGA resolution.
* <small>Aspect ratio: <code>16:10</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} HVGA <small>Value <code>{ width: 480, height: 320 }</code></small>
* The value of the option to configure HVGA resolution.
* <small>Aspect ratio: <code>3:2</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} VGA <small>Value <code>{ width: 640, height: 480 }</code></small>
* The value of the option to configure VGA resolution.
* <small>Aspect ratio: <code>4:3</code></small>
* @param {JSON} WVGA <small>Value <code>{ width: 768, height: 480 }</code></small>
* The value of the option to configure WVGA resolution.
* <small>Aspect ratio: <code>16:10</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} FWVGA <small>Value <code>{ width: 854, height: 480 }</code></small>
* The value of the option to configure FWVGA resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} SVGA <small>Value <code>{ width: 800, height: 600 }</code></small>
* The value of the option to configure SVGA resolution.
* <small>Aspect ratio: <code>4:3</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} DVGA <small>Value <code>{ width: 960, height: 640 }</code></small>
* The value of the option to configure DVGA resolution.
* <small>Aspect ratio: <code>3:2</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} WSVGA <small>Value <code>{ width: 1024, height: 576 }</code></small>
* The value of the option to configure WSVGA resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* @param {JSON} HD <small>Value <code>{ width: 1280, height: 720 }</code></small>
* The value of the option to configure HD resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* <small>Note that configurating this resolution may not be supported depending on device supports.</small>
* @param {JSON} HDPLUS <small>Value <code>{ width: 1600, height: 900 }</code></small>
* The value of the option to configure HDPLUS resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} FHD <small>Value <code>{ width: 1920, height: 1080 }</code></small>
* The value of the option to configure FHD resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* <small>Note that configurating this resolution may not be supported depending on device supports.</small>
* @param {JSON} QHD <small>Value <code>{ width: 2560, height: 1440 }</code></small>
* The value of the option to configure QHD resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} WQXGAPLUS <small>Value <code>{ width: 3200, height: 1800 }</code></small>
* The value of the option to configure WQXGAPLUS resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} UHD <small>Value <code>{ width: 3840, height: 2160 }</code></small>
* The value of the option to configure UHD resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} UHDPLUS <small>Value <code>{ width: 5120, height: 2880 }</code></small>
* The value of the option to configure UHDPLUS resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} FUHD <small>Value <code>{ width: 7680, height: 4320 }</code></small>
* The value of the option to configure FUHD resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @param {JSON} QUHD <small>Value <code>{ width: 15360, height: 8640 }</code></small>
* The value of the option to configure QUHD resolution.
* <small>Aspect ratio: <code>16:9</code></small>
* <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
* @type JSON
* @readOnly
* @for Skylink
* @since 0.5.6
*/
Skylink.prototype.VIDEO_RESOLUTION = {
QQVGA: { width: 160, height: 120 /*, aspectRatio: '4:3'*/ },
HQVGA: { width: 240, height: 160 /*, aspectRatio: '3:2'*/ },
QVGA: { width: 320, height: 240 /*, aspectRatio: '4:3'*/ },
WQVGA: { width: 384, height: 240 /*, aspectRatio: '16:10'*/ },
HVGA: { width: 480, height: 320 /*, aspectRatio: '3:2'*/ },
VGA: { width: 640, height: 480 /*, aspectRatio: '4:3'*/ },
WVGA: { width: 768, height: 480 /*, aspectRatio: '16:10'*/ },
FWVGA: { width: 854, height: 480 /*, aspectRatio: '16:9'*/ },
SVGA: { width: 800, height: 600 /*, aspectRatio: '4:3'*/ },
DVGA: { width: 960, height: 640 /*, aspectRatio: '3:2'*/ },
WSVGA: { width: 1024, height: 576 /*, aspectRatio: '16:9'*/ },
HD: { width: 1280, height: 720 /*, aspectRatio: '16:9'*/ },
HDPLUS: { width: 1600, height: 900 /*, aspectRatio: '16:9'*/ },
FHD: { width: 1920, height: 1080 /*, aspectRatio: '16:9'*/ },
QHD: { width: 2560, height: 1440 /*, aspectRatio: '16:9'*/ },
WQXGAPLUS: { width: 3200, height: 1800 /*, aspectRatio: '16:9'*/ },
UHD: { width: 3840, height: 2160 /*, aspectRatio: '16:9'*/ },
UHDPLUS: { width: 5120, height: 2880 /*, aspectRatio: '16:9'*/ },
FUHD: { width: 7680, height: 4320 /*, aspectRatio: '16:9'*/ },
QUHD: { width: 15360, height: 8640 /*, aspectRatio: '16:9'*/ }
};
/**
* The list of <a href="#method_getUserMedia"><code>getUserMedia()</code> method</a> or
* <a href="#method_shareScreen"><code>shareScreen()</code> method</a> Stream fallback states.
* @attribute MEDIA_ACCESS_FALLBACK_STATE
* @param {JSON} FALLBACKING <small>Value <code>0</code></small>
* The value of the state when <code>getUserMedia()</code> will retrieve audio track only
* when retrieving audio and video tracks failed.
* <small>This can be configured by <a href="#method_init"><code>init()</code> method</a>
* <code>audioFallback</code> option.</small>
* @param {JSON} FALLBACKED <small>Value <code>1</code></small>
* The value of the state when <code>getUserMedia()</code> or <code>shareScreen()</code>
* retrieves camera / screensharing Stream successfully but with missing originally required audio or video tracks.
* @param {JSON} ERROR <small>Value <code>-1</code></small>
* The value of the state when <code>getUserMedia()</code> failed to retrieve audio track only
* after retrieving audio and video tracks failed.
* @readOnly
* @for Skylink
* @since 0.6.14
*/
Skylink.prototype.MEDIA_ACCESS_FALLBACK_STATE = {
FALLBACKING: 0,
FALLBACKED: 1,
ERROR: -1
};
/**
* The list of recording states.
* @attribute RECORDING_STATE
* @param {Number} START <small>Value <code>0</code></small>
* The value of the state when recording session has started.
* @param {Number} STOP <small>Value <code>1</code></small>
* The value of the state when recording session has stopped.<br>
* <small>At this stage, the recorded videos will go through the mixin server to compile the videos.</small>
* @param {Number} LINK <small>Value <code>2</code></small>
* The value of the state when recording session mixin request has been completed.
* @param {Number} ERROR <small>Value <code>-1</code></small>
* The value of the state state when recording session has errors.
* <small>This can happen during recording session or during mixin of recording videos,
* and at this stage, any current recording session or mixin is aborted.</small>
* @type JSON
* @beta
* @for Skylink
* @since 0.6.16
*/
Skylink.prototype.RECORDING_STATE = {
START: 0,
STOP: 1,
LINK: 2,
ERROR: -1
};
/**
* Stores the data chunk size for Blob transfers.
* @attribute _CHUNK_FILE_SIZE
* @type Number
* @private
* @readOnly
* @for Skylink
* @since 0.5.2
*/
Skylink.prototype._CHUNK_FILE_SIZE = 49152;
/**
* 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).
* @attribute _MOZ_CHUNK_FILE_SIZE
* @type Number
* @private
* @readOnly
* @for Skylink
* @since 0.5.2
*/
Skylink.prototype._MOZ_CHUNK_FILE_SIZE = 12288;
/**
* Stores the data chunk size for binary Blob transfers.
* @attribute _BINARY_FILE_SIZE
* @type Number
* @private
* @readOnly
* @for Skylink
* @since 0.6.16
*/
Skylink.prototype._BINARY_FILE_SIZE = 65456;
/**
* Stores the data chunk size for binary Blob transfers.
* @attribute _MOZ_BINARY_FILE_SIZE
* @type Number
* @private
* @readOnly
* @for Skylink
* @since 0.6.16
*/
Skylink.prototype._MOZ_BINARY_FILE_SIZE = 16384;
/**
* Stores the data chunk size for data URI string transfers.
* @attribute _CHUNK_DATAURL_SIZE
* @type Number
* @private
* @readOnly
* @for Skylink
* @since 0.5.2
*/
Skylink.prototype._CHUNK_DATAURL_SIZE = 1212;
/**
* Stores the list of data transfer protocols.
* @attribute _DC_PROTOCOL_TYPE
* @param {String} WRQ The protocol to initiate data transfer.
* @param {String} ACK The protocol to request for data transfer chunk.
* Give <code>-1</code> to reject the request at the beginning and <code>0</code> to accept
* the data transfer request.
* @param {String} CANCEL The protocol to terminate data transfer.
* @param {String} ERROR The protocol when data transfer has errors and has to be terminated.
* @param {String} MESSAGE The protocol that is used to send P2P messages.
* @type JSON
* @readOnly
* @private
* @for Skylink
* @since 0.5.2
*/
Skylink.prototype._DC_PROTOCOL_TYPE = {
WRQ: 'WRQ',
ACK: 'ACK',
ERROR: 'ERROR',
CANCEL: 'CANCEL',
MESSAGE: 'MESSAGE'
};
/**
* Stores the list of socket messaging protocol types.
* See confluence docs for the list based on the current <code>SM_PROTOCOL_VERSION</code>.
* @attribute _SIG_MESSAGE_TYPE
* @type JSON
* @readOnly
* @private
* @for Skylink
* @since 0.5.6
*/
Skylink.prototype._SIG_MESSAGE_TYPE = {
JOIN_ROOM: 'joinRoom',
IN_ROOM: 'inRoom',
ENTER: 'enter',
WELCOME: 'welcome',
RESTART: 'restart',
OFFER: 'offer',
ANSWER: 'answer',
CANDIDATE: 'candidate',
BYE: 'bye',
REDIRECT: 'redirect',
UPDATE_USER: 'updateUserEvent',
ROOM_LOCK: 'roomLockEvent',
MUTE_VIDEO: 'muteVideoEvent',
MUTE_AUDIO: 'muteAudioEvent',
PUBLIC_MESSAGE: 'public',
PRIVATE_MESSAGE: 'private',
STREAM: 'stream',
GROUP: 'group',
GET_PEERS: 'getPeers',
PEER_LIST: 'peerList',
INTRODUCE: 'introduce',
INTRODUCE_ERROR: 'introduceError',
APPROACH: 'approach',
START_RECORDING: 'startRecordingRoom',
STOP_RECORDING: 'stopRecordingRoom',
RECORDING: 'recordingEvent',
END_OF_CANDIDATES: 'endOfCandidates'
};
/**
* Stores the list of socket messaging protocol types to queue when sent less than a second interval.
* @attribute _GROUP_MESSAGE_LIST
* @type Array
* @readOnly
* @private
* @for Skylink
* @since 0.5.10
*/
Skylink.prototype._GROUP_MESSAGE_LIST = [
Skylink.prototype._SIG_MESSAGE_TYPE.STREAM,
Skylink.prototype._SIG_MESSAGE_TYPE.UPDATE_USER,
Skylink.prototype._SIG_MESSAGE_TYPE.MUTE_AUDIO,
Skylink.prototype._SIG_MESSAGE_TYPE.MUTE_VIDEO,
Skylink.prototype._SIG_MESSAGE_TYPE.PUBLIC_MESSAGE
];
/**
* The options available for video and audio bitrates (kbps) quality.
* @attribute VIDEO_QUALITY
* @param {JSON} HD <small>Value <code>{ video: 3200, audio: 80 }</code></small>
* The value of option to prefer high definition video and audio bitrates.
* @param {JSON} HQ <small>Value <code>{ video: 1200, audio: 50 }</code></small>
* The value of option to prefer high quality video and audio bitrates.
* @param {JSON} SQ <small>Value <code>{ video: 800, audio: 30 }</code></small>
* The value of option to prefer standard quality video and audio bitrates.
* @param {JSON} LQ <small>Value <code>{ video: 500, audio: 20 }</code></small>
* The value of option to prefer low quality video and audio bitrates.
* @type JSON
* @readOnly
* @for Skylink
* @since 0.6.32
*/
Skylink.prototype.VIDEO_QUALITY = {
HD: { video: 3200, audio: 150 },
HQ: { video: 1200, audio: 80 },
SQ: { video: 800, audio: 30 },
LQ: { video: 400, audio: 20 }
};