File: source/constants.js

  1. /**
  2. * The list of Datachannel connection states.
  3. * @attribute DATA_CHANNEL_STATE
  4. * @param {String} CONNECTING <small>Value <code>"connecting"</code></small>
  5. * The value of the state when Datachannel is attempting to establish a connection.
  6. * @param {String} OPEN <small>Value <code>"open"</code></small>
  7. * The value of the state when Datachannel has established a connection.
  8. * @param {String} CLOSING <small>Value <code>"closing"</code></small>
  9. * The value of the state when Datachannel connection is closing.
  10. * @param {String} CLOSED <small>Value <code>"closed"</code></small>
  11. * The value of the state when Datachannel connection has closed.
  12. * @param {String} ERROR <small>Value <code>"error"</code></small>
  13. * The value of the state when Datachannel has encountered an exception during connection.
  14. * @param {String} CREATE_ERROR <small>Value <code>"createError"</code></small>
  15. * The value of the state when Datachannel has failed to establish a connection.
  16. * @param {String} BUFFERED_AMOUNT_LOW <small>Value <code>"bufferedAmountLow"</code></small>
  17. * The value of the state when Datachannel when the amount of data buffered to be sent
  18. * falls below the Datachannel threshold.
  19. * <small>This state should occur only during after <a href="#method_sendBlobData">
  20. * <code>sendBlobData()</code> method</a> or <a href="#method_sendURLData"><code>sendURLData()</code> method</a> or
  21. * <a href="#method_sendP2PMessage"><code>sendP2PMessage()</code> method</a>.</small>
  22. * @param {String} SEND_MESSAGE_ERROR <small>Value <code>"sendMessageError"</code></small>
  23. * The value of the state when Datachannel when data transfer packets or P2P message fails to send.
  24. * <small>This state should occur only during after <a href="#method_sendBlobData">
  25. * <code>sendBlobData()</code> method</a> or <a href="#method_sendURLData"><code>sendURLData()</code> method</a> or
  26. * <a href="#method_sendP2PMessage"><code>sendP2PMessage()</code> method</a>.</small>
  27. * @type JSON
  28. * @readOnly
  29. * @for Skylink
  30. * @since 0.1.0
  31. */
  32. Skylink.prototype.DATA_CHANNEL_STATE = {
  33. CONNECTING: 'connecting',
  34. OPEN: 'open',
  35. CLOSING: 'closing',
  36. CLOSED: 'closed',
  37. ERROR: 'error',
  38. CREATE_ERROR: 'createError',
  39. BUFFERED_AMOUNT_LOW: 'bufferedAmountLow',
  40. SEND_MESSAGE_ERROR: 'sendMessageError'
  41. };
  42.  
  43. /**
  44. * The list of Datachannel types.
  45. * @attribute DATA_CHANNEL_TYPE
  46. * @param {String} MESSAGING <small>Value <code>"messaging"</code></small>
  47. * The value of the Datachannel type that is used only for messaging in
  48. * <a href="#method_sendP2PMessage"><code>sendP2PMessage()</code> method</a>.
  49. * <small>However for Peers that do not support simultaneous data transfers, this Datachannel
  50. * type will be used to do data transfers (1 at a time).</small>
  51. * <small>Each Peer connections will only have one of this Datachannel type and the
  52. * connection will only close when the Peer connection is closed (happens when <a href="#event_peerConnectionState">
  53. * <code>peerConnectionState</code> event</a> triggers parameter payload <code>state</code> as
  54. * <code>CLOSED</code> for Peer).</small>
  55. * @param {String} DATA <small>Value <code>"data"</code></small>
  56. * The value of the Datachannel type that is used only for a data transfer in
  57. * <a href="#method_sendURLData"><code>sendURLData()</code> method</a> and
  58. * <a href="#method_sendBlobData"><code>sendBlobData()</code> method</a>.
  59. * <small>The connection will close after the data transfer has been completed or terminated (happens when
  60. * <a href="#event_dataTransferState"><code>dataTransferState</code> event</a> triggers parameter payload
  61. * <code>state</code> as <code>DOWNLOAD_COMPLETED</code>, <code>UPLOAD_COMPLETED</code>,
  62. * <code>REJECTED</code>, <code>CANCEL</code> or <code>ERROR</code> for Peer).</small>
  63. * @type JSON
  64. * @readOnly
  65. * @for Skylink
  66. * @since 0.6.1
  67. */
  68. Skylink.prototype.DATA_CHANNEL_TYPE = {
  69. MESSAGING: 'messaging',
  70. DATA: 'data'
  71. };
  72.  
  73. /**
  74. * The list of Datachannel sending message error types.
  75. * @attribute DATA_CHANNEL_MESSAGE_ERROR
  76. * @param {String} MESSAGE <small>Value <code>"message"</code></small>
  77. * The value of the Datachannel sending message error type when encountered during
  78. * sending P2P message from <a href="#method_sendP2PMessage"><code>sendP2PMessage()</code> method</a>.
  79. * @param {String} TRANSFER <small>Value <code>"transfer"</code></small>
  80. * The value of the Datachannel sending message error type when encountered during
  81. * data transfers from <a href="#method_sendURLData"><code>sendURLData()</code> method</a> or
  82. * <a href="#method_sendBlobData"><code>sendBlobData()</code> method</a>.
  83. * @type JSON
  84. * @readOnly
  85. * @for Skylink
  86. * @since 0.6.16
  87. */
  88. Skylink.prototype.DATA_CHANNEL_MESSAGE_ERROR = {
  89. MESSAGE: 'message',
  90. TRANSFER: 'transfer'
  91. };
  92.  
  93. /**
  94. * The list of supported data transfer data types.
  95. * @attribute DATA_TRANSFER_DATA_TYPE
  96. * @param {String} BINARY_STRING <small>Value <code>"binaryString"</code></small>
  97. * The value of data transfer data type when Blob binary data chunks encoded to Base64 encoded string are
  98. * sent or received over the Datachannel connection for the data transfer session.
  99. * <small>Used only in <a href="#method_sendBlobData"><code>sendBlobData()</code> method</a> when
  100. * parameter <code>sendChunksAsBinary</code> value is <code>false</code>.</small>
  101. * @param {String} ARRAY_BUFFER <small>Value <code>"arrayBuffer"</code></small>
  102. * The value of data transfer data type when ArrayBuffer binary data chunks are
  103. * sent or received over the Datachannel connection for the data transfer session.
  104. * <small>Used only in <a href="#method_sendBlobData"><code>sendBlobData()</code> method</a> when
  105. * parameter <code>sendChunksAsBinary</code> value is <code>true</code>.</small>
  106. * @param {String} BLOB <small>Value <code>"blob"</code></small>
  107. * The value of data transfer data type when Blob binary data chunks are
  108. * sent or received over the Datachannel connection for the data transfer session.
  109. * <small>Used only in <a href="#method_sendBlobData"><code>sendBlobData()</code> method</a> when
  110. * parameter <code>sendChunksAsBinary</code> value is <code>true</code>.</small>
  111. * @param {String} STRING <small>Value <code>"string"</code></small>
  112. * The value of data transfer data type when only string data chunks are
  113. * sent or received over the Datachannel connection for the data transfer session.
  114. * <small>Used only in <a href="#method_sendURLData"><code>sendURLData()</code> method</a>.</small>
  115. * @type JSON
  116. * @readOnly
  117. * @for Skylink
  118. * @since 0.1.0
  119. */
  120. Skylink.prototype.DATA_TRANSFER_DATA_TYPE = {
  121. BINARY_STRING: 'binaryString',
  122. ARRAY_BUFFER: 'arrayBuffer',
  123. BLOB: 'blob',
  124. STRING: 'string'
  125. };
  126.  
  127. /**
  128. * <blockquote class="info">
  129. * Note that this is used only for SDK developer purposes.<br>
  130. * Current version: <code>0.1.0</code>
  131. * </blockquote>
  132. * The value of the current version of the data transfer protocol.
  133. * @attribute DT_PROTOCOL_VERSION
  134. * @type String
  135. * @readOnly
  136. * @for Skylink
  137. * @since 0.5.10
  138. */
  139. Skylink.prototype.DT_PROTOCOL_VERSION = '0.1.3';
  140.  
  141. /**
  142. * The list of data transfers directions.
  143. * @attribute DATA_TRANSFER_TYPE
  144. * @param {String} UPLOAD <small>Value <code>"upload"</code></small>
  145. * The value of the data transfer direction when User is uploading data to Peer.
  146. * @param {String} DOWNLOAD <small>Value <code>"download"</code></small>
  147. * The value of the data transfer direction when User is downloading data from Peer.
  148. * @type JSON
  149. * @readOnly
  150. * @for Skylink
  151. * @since 0.1.0
  152. */
  153. Skylink.prototype.DATA_TRANSFER_TYPE = {
  154. UPLOAD: 'upload',
  155. DOWNLOAD: 'download'
  156. };
  157.  
  158. /**
  159. * The list of data transfers session types.
  160. * @attribute DATA_TRANSFER_SESSION_TYPE
  161. * @param {String} BLOB <small>Value <code>"blob"</code></small>
  162. * The value of the session type for
  163. * <a href="#method_sendURLData"><code>sendURLData()</code> method</a> data transfer.
  164. * @param {String} DATA_URL <small>Value <code>"dataURL"</code></small>
  165. * The value of the session type for
  166. * <a href="#method_sendBlobData"><code>method_sendBlobData()</code> method</a> data transfer.
  167. * @type JSON
  168. * @readOnly
  169. * @for Skylink
  170. * @since 0.1.0
  171. */
  172. Skylink.prototype.DATA_TRANSFER_SESSION_TYPE = {
  173. BLOB: 'blob',
  174. DATA_URL: 'dataURL'
  175. };
  176.  
  177. /**
  178. * The list of data transfer states.
  179. * @attribute DATA_TRANSFER_STATE
  180. * @param {String} UPLOAD_REQUEST <small>Value <code>"request"</code></small>
  181. * The value of the state when receiving an upload data transfer request from Peer to User.
  182. * <small>At this stage, the upload data transfer request from Peer may be accepted or rejected with the
  183. * <a href="#method_acceptDataTransfer"><code>acceptDataTransfer()</code> method</a> invoked by User.</small>
  184. * @parma {String} USER_UPLOAD_REQUEST <small>Value <code>"userRequest"</code></small>
  185. * The value of the state when User sent an upload data transfer request to Peer.
  186. * <small>At this stage, the upload data transfer request to Peer may be accepted or rejected with the
  187. * <a href="#method_acceptDataTransfer"><code>acceptDataTransfer()</code> method</a> invoked by Peer.</small>
  188. * @param {String} UPLOAD_STARTED <small>Value <code>"uploadStarted"</code></small>
  189. * The value of the state when the data transfer request has been accepted
  190. * and data transfer will start uploading data to Peer.
  191. * <small>At this stage, the data transfer may be terminated with the
  192. * <a href="#method_cancelDataTransfer"><code>cancelDataTransfer()</code> method</a>.</small>
  193. * @param {String} DOWNLOAD_STARTED <small>Value <code>"downloadStarted"</code></small>
  194. * The value of the state when the data transfer request has been accepted
  195. * and data transfer will start downloading data from Peer.
  196. * <small>At this stage, the data transfer may be terminated with the
  197. * <a href="#method_cancelDataTransfer"><code>cancelDataTransfer()</code> method</a>.</small>
  198. * @param {String} REJECTED <small>Value <code>"rejected"</code></small>
  199. * The value of the state when upload data transfer request to Peer has been rejected and terminated.
  200. * @param {String} USER_REJECTED <small>Value <code>"userRejected"</code></small>
  201. * The value of the state when User rejected and terminated upload data transfer request from Peer.
  202. * @param {String} UPLOADING <small>Value <code>"uploading"</code></small>
  203. * The value of the state when data transfer is uploading data to Peer.
  204. * @param {String} DOWNLOADING <small>Value <code>"downloading"</code></small>
  205. * The value of the state when data transfer is downloading data from Peer.
  206. * @param {String} UPLOAD_COMPLETED <small>Value <code>"uploadCompleted"</code></small>
  207. * The value of the state when data transfer has uploaded successfully to Peer.
  208. * @param {String} DOWNLOAD_COMPLETED <small>Value <code>"downloadCompleted"</code></small>
  209. * The value of the state when data transfer has downloaded successfully from Peer.
  210. * @param {String} CANCEL <small>Value <code>"cancel"</code></small>
  211. * The value of the state when data transfer has been terminated from / to Peer.
  212. * @param {String} ERROR <small>Value <code>"error"</code></small>
  213. * The value of the state when data transfer has errors and has been terminated from / to Peer.
  214. * @type JSON
  215. * @readOnly
  216. * @for Skylink
  217. * @since 0.4.0
  218. */
  219. Skylink.prototype.DATA_TRANSFER_STATE = {
  220. UPLOAD_REQUEST: 'request',
  221. UPLOAD_STARTED: 'uploadStarted',
  222. DOWNLOAD_STARTED: 'downloadStarted',
  223. REJECTED: 'rejected',
  224. CANCEL: 'cancel',
  225. ERROR: 'error',
  226. UPLOADING: 'uploading',
  227. DOWNLOADING: 'downloading',
  228. UPLOAD_COMPLETED: 'uploadCompleted',
  229. DOWNLOAD_COMPLETED: 'downloadCompleted',
  230. USER_REJECTED: 'userRejected',
  231. USER_UPLOAD_REQUEST: 'userRequest',
  232. START_ERROR: 'startError'
  233. };
  234.  
  235. /**
  236. * The list of data streaming states.
  237. * @attribute DATA_STREAM_STATE
  238. * @param {String} SENDING_STARTED <small>Value <code>"sendStart"</code></small>
  239. * The value of the state when data streaming session has started from User to Peer.
  240. * @param {String} RECEIVING_STARTED <small>Value <code>"receiveStart"</code></small>
  241. * The value of the state when data streaming session has started from Peer to Peer.
  242. * @param {String} RECEIVED <small>Value <code>"received"</code></small>
  243. * The value of the state when data streaming session data chunk has been received from Peer to User.
  244. * @param {String} SENT <small>Value <code>"sent"</code></small>
  245. * The value of the state when data streaming session data chunk has been sent from User to Peer.
  246. * @param {String} SENDING_STOPPED <small>Value <code>"sendStop"</code></small>
  247. * The value of the state when data streaming session has stopped from User to Peer.
  248. * @param {String} RECEIVING_STOPPED <small>Value <code>"receivingStop"</code></small>
  249. * The value of the state when data streaming session has stopped from Peer to User.
  250. * @param {String} ERROR <small>Value <code>"error"</code></small>
  251. * The value of the state when data streaming session has errors.
  252. * <small>At this stage, the data streaming state is considered <code>SENDING_STOPPED</code> or
  253. * <code>RECEIVING_STOPPED</code>.</small>
  254. * @param {String} START_ERROR <small>Value <code>"startError"</code></small>
  255. * The value of the state when data streaming session failed to start from User to Peer.
  256. * @type JSON
  257. * @readOnly
  258. * @for Skylink
  259. * @since 0.6.18
  260. */
  261. Skylink.prototype.DATA_STREAM_STATE = {
  262. SENDING_STARTED: 'sendStart',
  263. SENDING_STOPPED: 'sendStop',
  264. RECEIVING_STARTED: 'receiveStart',
  265. RECEIVING_STOPPED: 'receiveStop',
  266. RECEIVED: 'received',
  267. SENT: 'sent',
  268. ERROR: 'error',
  269. START_ERROR: 'startError'
  270. };
  271.  
  272. /**
  273. * <blockquote class="info">
  274. * Learn more about how ICE works in this
  275. * <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
  276. * </blockquote>
  277. * The list of Peer connection ICE gathering states.
  278. * @attribute CANDIDATE_GENERATION_STATE
  279. * @param {String} GATHERING <small>Value <code>"gathering"</code></small>
  280. * The value of the state when Peer connection is gathering ICE candidates.
  281. * <small>These ICE candidates are sent to Peer for its connection to check for a suitable matching
  282. * pair of ICE candidates to establish an ICE connection for stream audio, video and data.
  283. * See <a href="#event_iceConnectionState"><code>iceConnectionState</code> event</a> for ICE connection status.</small>
  284. * <small>This state cannot happen until Peer connection remote <code>"offer"</code> / <code>"answer"</code>
  285. * session description is set. See <a href="#event_peerConnectionState">
  286. * <code>peerConnectionState</code> event</a> for session description exchanging status.</small>
  287. * @param {String} COMPLETED <small>Value <code>"completed"</code></small>
  288. * The value of the state when Peer connection gathering of ICE candidates has completed.
  289. * @type JSON
  290. * @readOnly
  291. * @for Skylink
  292. * @since 0.4.1
  293. */
  294. Skylink.prototype.CANDIDATE_GENERATION_STATE = {
  295. NEW: 'new',
  296. GATHERING: 'gathering',
  297. COMPLETED: 'completed'
  298. };
  299.  
  300. /**
  301. * <blockquote class="info">
  302. * Learn more about how ICE works in this
  303. * <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
  304. * </blockquote>
  305. * The list of Peer connection remote ICE candidate processing states for trickle ICE connections.
  306. * @attribute CANDIDATE_PROCESSING_STATE
  307. * @param {String} RECEIVED <small>Value <code>"received"</code></small>
  308. * The value of the state when the remote ICE candidate was received.
  309. * @param {String} DROPPED <small>Value <code>"received"</code></small>
  310. * The value of the state when the remote ICE candidate is dropped.
  311. * @param {String} BUFFERED <small>Value <code>"buffered"</code></small>
  312. * The value of the state when the remote ICE candidate is buffered.
  313. * @param {String} PROCESSING <small>Value <code>"processing"</code></small>
  314. * The value of the state when the remote ICE candidate is being processed.
  315. * @param {String} PROCESS_SUCCESS <small>Value <code>"processSuccess"</code></small>
  316. * The value of the state when the remote ICE candidate has been processed successfully.
  317. * <small>The ICE candidate that is processed will be used to check against the list of
  318. * locally generated ICE candidate to start matching for the suitable pair for the best ICE connection.</small>
  319. * @param {String} PROCESS_ERROR <small>Value <code>"processError"</code></small>
  320. * The value of the state when the remote ICE candidate has failed to be processed.
  321. * @type JSON
  322. * @readOnly
  323. * @for Skylink
  324. * @since 0.6.16
  325. */
  326. Skylink.prototype.CANDIDATE_PROCESSING_STATE = {
  327. RECEIVED: 'received',
  328. DROPPED: 'dropped',
  329. BUFFERED: 'buffered',
  330. PROCESSING: 'processing',
  331. PROCESS_SUCCESS: 'processSuccess',
  332. PROCESS_ERROR: 'processError'
  333. };
  334.  
  335. /**
  336. * <blockquote class="info">
  337. * Learn more about how ICE works in this
  338. * <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
  339. * </blockquote>
  340. * The list of Peer connection ICE connection states.
  341. * @attribute ICE_CONNECTION_STATE
  342. * @param {String} CHECKING <small>Value <code>"checking"</code></small>
  343. * The value of the state when Peer connection is checking for a suitable matching pair of
  344. * ICE candidates to establish ICE connection.
  345. * <small>Exchanging of ICE candidates happens during <a href="#event_candidateGenerationState">
  346. * <code>candidateGenerationState</code> event</a>.</small>
  347. * @param {String} CONNECTED <small>Value <code>"connected"</code></small>
  348. * The value of the state when Peer connection has found a suitable matching pair of
  349. * ICE candidates to establish ICE connection but is still checking for a better
  350. * suitable matching pair of ICE candidates for the best ICE connectivity.
  351. * <small>At this state, ICE connection is already established and audio, video and
  352. * data streaming has already started.</small>
  353. * @param {String} COMPLETED <small>Value <code>"completed"</code></small>
  354. * The value of the state when Peer connection has found the best suitable matching pair
  355. * of ICE candidates to establish ICE connection and checking has stopped.
  356. * <small>At this state, ICE connection is already established and audio, video and
  357. * data streaming has already started. This may happpen after <code>CONNECTED</code>.</small>
  358. * @param {String} FAILED <small>Value <code>"failed"</code></small>
  359. * The value of the state when Peer connection ICE connection has failed.
  360. * @param {String} DISCONNECTED <small>Value <code>"disconnected"</code></small>
  361. * The value of the state when Peer connection ICE connection is disconnected.
  362. * <small>At this state, the Peer connection may attempt to revive the ICE connection.
  363. * This may happen due to flaky network conditions.</small>
  364. * @param {String} CLOSED <small>Value <code>"closed"</code></small>
  365. * The value of the state when Peer connection ICE connection has closed.
  366. * <small>This happens when Peer connection is closed and no streaming can occur at this stage.</small>
  367. * @param {String} TRICKLE_FAILED <small>Value <code>"trickeFailed"</code></small>
  368. * The value of the state when Peer connection ICE connection has failed during trickle ICE.
  369. * <small>Trickle ICE is enabled in <a href="#method_init"><code>init()</code> method</a>
  370. * <code>enableIceTrickle</code> option.</small>
  371. * @type JSON
  372. * @readOnly
  373. * @for Skylink
  374. * @since 0.1.0
  375. */
  376. Skylink.prototype.ICE_CONNECTION_STATE = {
  377. STARTING: 'starting',
  378. CHECKING: 'checking',
  379. CONNECTED: 'connected',
  380. COMPLETED: 'completed',
  381. CLOSED: 'closed',
  382. FAILED: 'failed',
  383. TRICKLE_FAILED: 'trickleFailed',
  384. DISCONNECTED: 'disconnected'
  385. };
  386.  
  387. /**
  388. * <blockquote class="info">
  389. * Note that configuring the protocol may not necessarily result in the desired network transports protocol
  390. * used in the actual TURN network traffic as it depends which protocol the browser selects and connects with.
  391. * This simply configures the TURN ICE server urls <code?transport=(protocol)</code> query option when constructing
  392. * the Peer connection. When all protocols are selected, the ICE servers urls are duplicated with all protocols.
  393. * </blockquote>
  394. * The list of TURN network transport protocols options when constructing Peer connections
  395. * configured in the <a href="#method_init"><code>init()</code> method</a>.
  396. * <small>Example <code>.urls</code> inital input: [<code>"turn:server.com?transport=tcp"</code>,
  397. * <code>"turn:server1.com:3478"</code>, <code>"turn:server.com?transport=udp"</code>]</small>
  398. * @attribute TURN_TRANSPORT
  399. * @param {String} TCP <small>Value <code>"tcp"</code></small>
  400. * The value of the option to configure using only TCP network transport protocol.
  401. * <small>Example <code>.urls</code> output: [<code>"turn:server.com?transport=tcp"</code>,
  402. * <code>"turn:server1.com:3478?transport=tcp"</code>]</small>
  403. * @param {String} UDP <small>Value <code>"udp"</code></small>
  404. * The value of the option to configure using only UDP network transport protocol.
  405. * <small>Example <code>.urls</code> output: [<code>"turn:server.com?transport=udp"</code>,
  406. * <code>"turn:server1.com:3478?transport=udp"</code>]</small>
  407. * @param {String} ANY <small>Value <code>"any"</code></small>
  408. * The value of the option to configure using any network transport protocols configured from the Signaling server.
  409. * <small>Example <code>.urls</code> output: [<code>"turn:server.com?transport=tcp"</code>,
  410. * <code>"turn:server1.com:3478"</code>, <code>"turn:server.com?transport=udp"</code>]</small>
  411. * @param {String} NONE <small>Value <code>"none"</code></small>
  412. * The value of the option to not configure using any network transport protocols.
  413. * <small>Example <code>.urls</code> output: [<code>"turn:server.com"</code>, <code>"turn:server1.com:3478"</code>]</small>
  414. * <small>Configuring this does not mean that no protocols will be used, but
  415. * rather removing <code>?transport=(protocol)</code> query option in
  416. * the TURN ICE server <code>.urls</code> when constructing the Peer connection.</small>
  417. * @param {String} ALL <small>Value <code>"all"</code></small>
  418. * The value of the option to configure using both TCP and UDP network transport protocols.
  419. * <small>Example <code>.urls</code> output: [<code>"turn:server.com?transport=tcp"</code>,
  420. * <code>"turn:server.com?transport=udp"</code>, <code>"turn:server1.com:3478?transport=tcp"</code>,
  421. * <code>"turn:server1.com:3478?transport=udp"</code>]</small>
  422. * @type JSON
  423. * @readOnly
  424. * @for Skylink
  425. * @since 0.5.4
  426. */
  427. Skylink.prototype.TURN_TRANSPORT = {
  428. UDP: 'udp',
  429. TCP: 'tcp',
  430. ANY: 'any',
  431. NONE: 'none',
  432. ALL: 'all'
  433. };
  434.  
  435. /**
  436. * <blockquote class="info">
  437. * Learn more about how ICE works in this
  438. * <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
  439. * </blockquote>
  440. * The list of Peer connection session description exchanging states.
  441. * @attribute PEER_CONNECTION_STATE
  442. * @param {String} STABLE <small>Value <code>"stable"</code></small>
  443. * The value of the state when there is no session description being exchanged between Peer connection.
  444. * @param {String} HAVE_LOCAL_OFFER <small>Value <code>"have-local-offer"</code></small>
  445. * The value of the state when local <code>"offer"</code> session description is set.
  446. * <small>This should transition to <code>STABLE</code> state after remote <code>"answer"</code>
  447. * session description is set.</small>
  448. * <small>See <a href="#event_handshakeProgress"><code>handshakeProgress</code> event</a> for a more
  449. * detailed exchanging of session description states.</small>
  450. * @param {String} HAVE_REMOTE_OFFER <small>Value <code>"have-remote-offer"</code></small>
  451. * The value of the state when remote <code>"offer"</code> session description is set.
  452. * <small>This should transition to <code>STABLE</code> state after local <code>"answer"</code>
  453. * session description is set.</small>
  454. * <small>See <a href="#event_handshakeProgress"><code>handshakeProgress</code> event</a> for a more
  455. * detailed exchanging of session description states.</small>
  456. * @param {String} CLOSED <small>Value <code>"closed"</code></small>
  457. * The value of the state when Peer connection is closed and no session description can be exchanged and set.
  458. * @type JSON
  459. * @readOnly
  460. * @for Skylink
  461. * @since 0.5.0
  462. */
  463. Skylink.prototype.PEER_CONNECTION_STATE = {
  464. STABLE: 'stable',
  465. HAVE_LOCAL_OFFER: 'have-local-offer',
  466. HAVE_REMOTE_OFFER: 'have-remote-offer',
  467. CLOSED: 'closed'
  468. };
  469.  
  470. /**
  471. * The list of <a href="#method_getConnectionStatus"><code>getConnectionStatus()</code>
  472. * method</a> retrieval states.
  473. * @attribute GET_CONNECTION_STATUS_STATE
  474. * @param {Number} RETRIEVING <small>Value <code>0</code></small>
  475. * The value of the state when <code>getConnectionStatus()</code> is retrieving the Peer connection stats.
  476. * @param {Number} RETRIEVE_SUCCESS <small>Value <code>1</code></small>
  477. * The value of the state when <code>getConnectionStatus()</code> has retrieved the Peer connection stats successfully.
  478. * @param {Number} RETRIEVE_ERROR <small>Value <code>-1</code></small>
  479. * The value of the state when <code>getConnectionStatus()</code> has failed retrieving the Peer connection stats.
  480. * @type JSON
  481. * @readOnly
  482. * @for Skylink
  483. * @since 0.1.0
  484. */
  485. Skylink.prototype.GET_CONNECTION_STATUS_STATE = {
  486. RETRIEVING: 0,
  487. RETRIEVE_SUCCESS: 1,
  488. RETRIEVE_ERROR: -1
  489. };
  490.  
  491. /**
  492. * <blockquote class="info">
  493. * As there are more features getting implemented, there will be eventually more different types of
  494. * server Peers.
  495. * </blockquote>
  496. * The list of available types of server Peer connections.
  497. * @attribute SERVER_PEER_TYPE
  498. * @param {String} MCU <small>Value <code>"mcu"</code></small>
  499. * The value of the server Peer type that is used for MCU connection.
  500. * @type JSON
  501. * @readOnly
  502. * @for Skylink
  503. * @since 0.6.1
  504. */
  505. Skylink.prototype.SERVER_PEER_TYPE = {
  506. MCU: 'mcu'
  507. //SIP: 'sip'
  508. };
  509.  
  510. /**
  511. * <blockquote class="info">
  512. * Learn more about how ICE works in this
  513. * <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
  514. * </blockquote>
  515. * The list of available Peer connection bundle policies.
  516. * @attribute BUNDLE_POLICY
  517. * @param {String} MAX_COMPAT <small>Value <code>"max-compat"</code></small>
  518. * The value of the bundle policy to generate ICE candidates for each media type
  519. * so each media type flows through different transports.
  520. * @param {String} MAX_BUNDLE <small>Value <code>"max-bundle"</code></small>
  521. * The value of the bundle policy to generate ICE candidates for one media type
  522. * so all media type flows through a single transport.
  523. * @param {String} BALANCED <small>Value <code>"balanced"</code></small>
  524. * The value of the bundle policy to use <code>MAX_BUNDLE</code> if Peer supports it,
  525. * else fallback to <code>MAX_COMPAT</code>.
  526. * @param {String} NONE <small>Value <code>"none"</code></small>
  527. * The value of the bundle policy to not use any media bundle.
  528. * <small>This removes the <code>a=group:BUNDLE</code> line from session descriptions.</small>
  529. * @type JSON
  530. * @readOnly
  531. * @for Skylink
  532. * @since 0.6.18
  533. */
  534. Skylink.prototype.BUNDLE_POLICY = {
  535. MAX_COMPAT: 'max-compat',
  536. BALANCED: 'balanced',
  537. MAX_BUNDLE: 'max-bundle',
  538. NONE: 'none'
  539. };
  540.  
  541. /**
  542. * <blockquote class="info">
  543. * Learn more about how ICE works in this
  544. * <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
  545. * </blockquote>
  546. * The list of available Peer connection RTCP mux policies.
  547. * @attribute RTCP_MUX_POLICY
  548. * @param {String} REQUIRE <small>Value <code>"require"</code></small>
  549. * The value of the RTCP mux policy to generate ICE candidates for RTP only and RTCP shares the same ICE candidates.
  550. * @param {String} NEGOTIATE <small>Value <code>"negotiate"</code></small>
  551. * The value of the RTCP mux policy to generate ICE candidates for both RTP and RTCP each.
  552. * @type JSON
  553. * @readOnly
  554. * @for Skylink
  555. * @since 0.6.18
  556. */
  557. Skylink.prototype.RTCP_MUX_POLICY = {
  558. REQUIRE: 'require',
  559. NEGOTIATE: 'negotiate'
  560. };
  561.  
  562. /**
  563. * <blockquote class="info">
  564. * Learn more about how ICE works in this
  565. * <a href="https://temasys.com.sg/ice-what-is-this-sorcery/">article here</a>.
  566. * </blockquote>
  567. * The list of available Peer connection certificates cryptographic algorithm to use.
  568. * @attribute PEER_CERTIFICATE
  569. * @param {String} RSA <small>Value <code>"RSA"</code></small>
  570. * The value of the Peer connection certificate algorithm to use RSA-1024.
  571. * @param {String} ECDSA <small>Value <code>"ECDSA"</code></small>
  572. * The value of the Peer connection certificate algorithm to use ECDSA.
  573. * @param {String} AUTO <small>Value <code>"AUTO"</code></small>
  574. * The value of the Peer connection to use the default certificate generated.
  575. * @type JSON
  576. * @readOnly
  577. * @for Skylink
  578. * @since 0.6.18
  579. */
  580. Skylink.prototype.PEER_CERTIFICATE = {
  581. RSA: 'RSA',
  582. ECDSA: 'ECDSA',
  583. AUTO: 'AUTO'
  584. };
  585.  
  586. /**
  587. * The list of Peer connection states.
  588. * @attribute HANDSHAKE_PROGRESS
  589. * @param {String} ENTER <small>Value <code>"enter"</code></small>
  590. * The value of the connection state when Peer has just entered the Room.
  591. * <small>At this stage, <a href="#event_peerJoined"><code>peerJoined</code> event</a>
  592. * is triggered.</small>
  593. * @param {String} WELCOME <small>Value <code>"welcome"</code></small>
  594. * The value of the connection state when Peer is aware that User has entered the Room.
  595. * <small>At this stage, <a href="#event_peerJoined"><code>peerJoined</code> event</a>
  596. * is triggered and Peer connection may commence.</small>
  597. * @param {String} OFFER <small>Value <code>"offer"</code></small>
  598. * The value of the connection state when Peer connection has set the local / remote <code>"offer"</code>
  599. * session description to start streaming connection.
  600. * @param {String} ANSWER <small>Value <code>"answer"</code></small>
  601. * The value of the connection state when Peer connection has set the local / remote <code>"answer"</code>
  602. * session description to establish streaming connection.
  603. * @param {String} ERROR <small>Value <code>"error"</code></small>
  604. * The value of the connection state when Peer connection has failed to establish streaming connection.
  605. * <small>This happens when there are errors that occurs in creating local <code>"offer"</code> /
  606. * <code>"answer"</code>, or when setting remote / local <code>"offer"</code> / <code>"answer"</code>.</small>
  607. * @type JSON
  608. * @readOnly
  609. * @for Skylink
  610. * @since 0.1.0
  611. */
  612. Skylink.prototype.HANDSHAKE_PROGRESS = {
  613. ENTER: 'enter',
  614. WELCOME: 'welcome',
  615. OFFER: 'offer',
  616. ANSWER: 'answer',
  617. ERROR: 'error'
  618. };
  619.  
  620. /**
  621. * <blockquote class="info">
  622. * Note that this feature requires <code>"isPrivileged"</code> flag to be enabled for the App Key
  623. * provided in the <a href="#method_init"><code>init()</code> method</a>, as only Users connecting using
  624. * the App Key with this flag enabled (which we call privileged Users / Peers) can retrieve the list of
  625. * Peer IDs from Rooms within the same App space.
  626. * <a href="http://support.temasys.io/support/solutions/articles/12000012342-what-is-a-privileged-key-">
  627. * Read more about privileged App Key feature here</a>.
  628. * </blockquote>
  629. * The list of <a href="#method_getPeers"><code>getPeers()</code> method</a> retrieval states.
  630. * @attribute GET_PEERS_STATE
  631. * @param {String} ENQUIRED <small>Value <code>"enquired"</code></small>
  632. * The value of the state when <code>getPeers()</code> is retrieving the list of Peer IDs
  633. * from Rooms within the same App space from the Signaling server.
  634. * @param {String} RECEIVED <small>Value <code>"received"</code></small>
  635. * The value of the state when <code>getPeers()</code> has retrieved the list of Peer IDs
  636. * from Rooms within the same App space from the Signaling server successfully.
  637. * @type JSON
  638. * @readOnly
  639. * @for Skylink
  640. * @since 0.6.1
  641. */
  642. Skylink.prototype.GET_PEERS_STATE = {
  643. ENQUIRED: 'enquired',
  644. RECEIVED: 'received'
  645. };
  646.  
  647. /**
  648. * <blockquote class="info">
  649. * Note that this feature requires <code>"isPrivileged"</code> flag to be enabled and
  650. * <code>"autoIntroduce"</code> flag to be disabled for the App Key provided in the
  651. * <a href="#method_init"><code>init()</code> method</a>, as only Users connecting using
  652. * the App Key with this flag enabled (which we call privileged Users / Peers) can retrieve the list of
  653. * Peer IDs from Rooms within the same App space.
  654. * <a href="http://support.temasys.io/support/solutions/articles/12000012342-what-is-a-privileged-key-">
  655. * Read more about privileged App Key feature here</a>.
  656. * </blockquote>
  657. * The list of <a href="#method_introducePeer"><code>introducePeer</code> method</a> Peer introduction request states.
  658. * @attribute INTRODUCE_STATE
  659. * @param {String} INTRODUCING <small>Value <code>"enquired"</code></small>
  660. * The value of the state when introduction request for the selected pair of Peers has been made to the Signaling server.
  661. * @param {String} ERROR <small>Value <code>"error"</code></small>
  662. * The value of the state when introduction request made to the Signaling server
  663. * for the selected pair of Peers has failed.
  664. * @readOnly
  665. * @for Skylink
  666. * @since 0.6.1
  667. */
  668. Skylink.prototype.INTRODUCE_STATE = {
  669. INTRODUCING: 'introducing',
  670. ERROR: 'error'
  671. };
  672.  
  673. /**
  674. * The list of Signaling server reaction states during <a href="#method_joinRoom"><code>joinRoom()</code> method</a>.
  675. * @attribute SYSTEM_ACTION
  676. * @param {String} WARNING <small>Value <code>"warning"</code></small>
  677. * The value of the state when Room session is about to end.
  678. * @param {String} REJECT <small>Value <code>"reject"</code></small>
  679. * The value of the state when Room session has failed to start or has ended.
  680. * @type JSON
  681. * @readOnly
  682. * @for Skylink
  683. * @since 0.5.1
  684. */
  685. Skylink.prototype.SYSTEM_ACTION = {
  686. WARNING: 'warning',
  687. REJECT: 'reject'
  688. };
  689.  
  690. /**
  691. * The list of Signaling server reaction states reason of action code during
  692. * <a href="#method_joinRoom"><code>joinRoom()</code> method</a>.
  693. * @attribute SYSTEM_ACTION_REASON
  694. * @param {String} CREDENTIALS_EXPIRED <small>Value <code>"oldTimeStamp"</code></small>
  695. * The value of the reason code when Room session token has expired.
  696. * <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
  697. * <small>Results with: <code>REJECT</code></small>
  698. * @param {String} CREDENTIALS_ERROR <small>Value <code>"credentialError"</code></small>
  699. * The value of the reason code when Room session token provided is invalid.
  700. * <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
  701. * @param {String} DUPLICATED_LOGIN <small>Value <code>"duplicatedLogin"</code></small>
  702. * The value of the reason code when Room session token has been used already.
  703. * <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
  704. * <small>Results with: <code>REJECT</code></small>
  705. * @param {String} ROOM_NOT_STARTED <small>Value <code>"notStart"</code></small>
  706. * The value of the reason code when Room session has not started.
  707. * <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
  708. * <small>Results with: <code>REJECT</code></small>
  709. * @param {String} EXPIRED <small>Value <code>"expired"</code></small>
  710. * The value of the reason code when Room session has ended already.
  711. * <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
  712. * <small>Results with: <code>REJECT</code></small>
  713. * @param {String} ROOM_LOCKED <small>Value <code>"locked"</code></small>
  714. * The value of the reason code when Room is locked.
  715. * <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
  716. * <small>Results with: <code>REJECT</code></small>
  717. * @param {String} FAST_MESSAGE <small>Value <code>"fastmsg"</code></small>
  718. * The value of the reason code when User is flooding socket messages to the Signaling server
  719. * that is sent too quickly within less than a second interval.
  720. * <small>Happens after Room session has started. This can be caused by various methods like
  721. * <a href="#method_sendMessage"><code>sendMessage()</code> method</a>,
  722. * <a href="#method_setUserData"><code>setUserData()</code> method</a>,
  723. * <a href="#method_muteStream"><code>muteStream()</code> method</a>,
  724. * <a href="#method_enableAudio"><code>enableAudio()</code> method</a>,
  725. * <a href="#method_enableVideo"><code>enableVideo()</code> method</a>,
  726. * <a href="#method_disableAudio"><code>disableAudio()</code> method</a> and
  727. * <a href="#method_disableVideo"><code>disableVideo()</code> method</a></small>
  728. * <small>Results with: <code>WARNING</code></small>
  729. * @param {String} ROOM_CLOSING <small>Value <code>"toClose"</code></small>
  730. * The value of the reason code when Room session is ending.
  731. * <small>Happens after Room session has started. This serves as a prerequisite warning before
  732. * <code>ROOM_CLOSED</code> occurs.</small>
  733. * <small>Results with: <code>WARNING</code></small>
  734. * @param {String} ROOM_CLOSED <small>Value <code>"roomclose"</code></small>
  735. * The value of the reason code when Room session has just ended.
  736. * <small>Happens after Room session has started.</small>
  737. * <small>Results with: <code>REJECT</code></small>
  738. * @param {String} SERVER_ERROR <small>Value <code>"serverError"</code></small>
  739. * The value of the reason code when Room session fails to start due to some technical errors.
  740. * <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
  741. * <small>Results with: <code>REJECT</code></small>
  742. * @param {String} KEY_ERROR <small>Value <code>"keyFailed"</code></small>
  743. * The value of the reason code when Room session fails to start due to some technical error pertaining to
  744. * App Key initialization.
  745. * <small>Happens during <a href="#method_joinRoom"><code>joinRoom()</code> method</a> request.</small>
  746. * <small>Results with: <code>REJECT</code></small>
  747. * @type JSON
  748. * @readOnly
  749. * @for Skylink
  750. * @since 0.5.2
  751. */
  752. Skylink.prototype.SYSTEM_ACTION_REASON = {
  753. CREDENTIALS_EXPIRED: 'oldTimeStamp',
  754. CREDENTIALS_ERROR: 'credentialError',
  755. DUPLICATED_LOGIN: 'duplicatedLogin',
  756. ROOM_NOT_STARTED: 'notStart',
  757. EXPIRED: 'expired',
  758. ROOM_LOCKED: 'locked',
  759. FAST_MESSAGE: 'fastmsg',
  760. ROOM_CLOSING: 'toclose',
  761. ROOM_CLOSED: 'roomclose',
  762. SERVER_ERROR: 'serverError',
  763. KEY_ERROR: 'keyFailed'
  764. };
  765.  
  766. /**
  767. * Contains the current version of Skylink Web SDK.
  768. * @attribute VERSION
  769. * @type String
  770. * @readOnly
  771. * @for Skylink
  772. * @since 0.1.0
  773. */
  774. Skylink.prototype.VERSION = '@@version';
  775.  
  776. /**
  777. * The list of <a href="#method_init"><code>init()</code> method</a> ready states.
  778. * @attribute READY_STATE_CHANGE
  779. * @param {Number} INIT <small>Value <code>0</code></small>
  780. * The value of the state when <code>init()</code> has just started.
  781. * @param {Number} LOADING <small>Value <code>1</code></small>
  782. * The value of the state when <code>init()</code> is authenticating App Key provided
  783. * (and with credentials if provided as well) with the Auth server.
  784. * @param {Number} COMPLETED <small>Value <code>2</code></small>
  785. * The value of the state when <code>init()</code> has successfully authenticated with the Auth server.
  786. * Room session token is generated for joining the <code>defaultRoom</code> provided in <code>init()</code>.
  787. * <small>Room session token has to be generated each time User switches to a different Room
  788. * in <a href="#method_joinRoom"><code>joinRoom()</code> method</a>.</small>
  789. * @param {Number} ERROR <small>Value <code>-1</code></small>
  790. * The value of the state when <code>init()</code> has failed authenticating with the Auth server.
  791. * [Rel: Skylink.READY_STATE_CHANGE_ERROR]
  792. * @type JSON
  793. * @readOnly
  794. * @for Skylink
  795. * @since 0.1.0
  796. */
  797. Skylink.prototype.READY_STATE_CHANGE = {
  798. INIT: 0,
  799. LOADING: 1,
  800. COMPLETED: 2,
  801. ERROR: -1
  802. };
  803.  
  804. /**
  805. * The list of <a href="#method_init"><code>init()</code> method</a> ready state failure codes.
  806. * @attribute READY_STATE_CHANGE_ERROR
  807. * @param {Number} API_INVALID <small>Value <code>4001</code></small>
  808. * The value of the failure code when provided App Key in <code>init()</code> does not exists.
  809. * <small>To resolve this, check that the provided App Key exists in
  810. * <a href="https://console.temasys.io">the Temasys Console</a>.</small>
  811. * @param {Number} API_DOMAIN_NOT_MATCH <small>Value <code>4002</code></small>
  812. * The value of the failure code when <code>"domainName"</code> property in the App Key does not
  813. * match the accessing server IP address.
  814. * <small>To resolve this, contact our <a href="http://support.temasys.io">support portal</a>.</small>
  815. * @param {Number} API_CORS_DOMAIN_NOT_MATCH <small>Value <code>4003</code></small>
  816. * The value of the failure code when <code>"corsurl"</code> property in the App Key does not match accessing CORS.
  817. * <small>To resolve this, configure the App Key CORS in
  818. * <a href="https://console.temasys.io">the Temasys Console</a>.</small>
  819. * @param {Number} API_CREDENTIALS_INVALID <small>Value <code>4004</code></small>
  820. * The value of the failure code when there is no [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)
  821. * present in the HTTP headers during the request to the Auth server present nor
  822. * <code>options.credentials.credentials</code> configuration provided in the <code>init()</code>.
  823. * <small>To resolve this, ensure that CORS are present in the HTTP headers during the request to the Auth server.</small>
  824. * @param {Number} API_CREDENTIALS_NOT_MATCH <small>Value <code>4005</code></small>
  825. * The value of the failure code when the <code>options.credentials.credentials</code> configuration provided in the
  826. * <code>init()</code> does not match up with the <code>options.credentials.startDateTime</code>,
  827. * <code>options.credentials.duration</code> or that the <code>"secret"</code> used to generate
  828. * <code>options.credentials.credentials</code> does not match the App Key's <code>"secret</code> property provided.
  829. * <small>To resolve this, check that the <code>options.credentials.credentials</code> is generated correctly and
  830. * that the <code>"secret"</code> used to generate it is from the App Key provided in the <code>init()</code>.</small>
  831. * @param {Number} API_INVALID_PARENT_KEY <small>Value <code>4006</code></small>
  832. * The value of the failure code when the App Key provided does not belong to any existing App.
  833. * <small>To resolve this, check that the provided App Key exists in
  834. * <a href="https://console.temasys.io">the Developer Console</a>.</small>
  835. * @param {Number} API_NO_MEETING_RECORD_FOUND <small>Value <code>4010</code></small>
  836. * The value of the failure code when provided <code>options.credentials</code>
  837. * does not match any scheduled meetings available for the "Persistent Room" enabled App Key provided.
  838. * <small>See the <a href="http://support.temasys.io/support/solutions/articles/
  839. * 12000002811-using-the-persistent-room-feature-to-configure-meetings">Persistent Room article</a> to learn more.</small>
  840. * @param {Number} API_OVER_SEAT_LIMIT <small>Value <code>4020</code></small>
  841. * The value of the failure code when App Key has reached its current concurrent users limit.
  842. * <small>To resolve this, use another App Key. To create App Keys dynamically, see the
  843. * <a href="https://temasys.atlassian.net/wiki/display/TPD/SkylinkAPI+-+Application+Resources">Application REST API
  844. * docs</a> for more information.</small>
  845. * @param {Number} API_RETRIEVAL_FAILED <small>Value <code>4021</code></small>
  846. * The value of the failure code when App Key retrieval of authentication token fails.
  847. * <small>If this happens frequently, contact our <a href="http://support.temasys.io">support portal</a>.</small>
  848. * @param {Number} API_WRONG_ACCESS_DOMAIN <small>Value <code>5005</code></small>
  849. * The value of the failure code when App Key makes request to the incorrect Auth server.
  850. * <small>To resolve this, ensure that the <code>roomServer</code> is not configured. If this persists even without
  851. * <code>roomServer</code> configuration, contact our <a href="http://support.temasys.io">support portal</a>.</small>
  852. * @param {Number} XML_HTTP_REQUEST_ERROR <small>Value <code>-1</code></small>
  853. * The value of the failure code when requesting to Auth server has timed out.
  854. * @param {Number} XML_HTTP_NO_REPONSE_ERROR <small>Value <code>-2</code></small>
  855. * The value of the failure code when response from Auth server is empty or timed out.
  856. * @param {Number} NO_SOCKET_IO <small>Value <code>1</code></small>
  857. * The value of the failure code when dependency <a href="http://socket.io/download/">Socket.IO client</a> is not loaded.
  858. * <small>To resolve this, ensure that the Socket.IO client dependency is loaded before the Skylink SDK.
  859. * You may use the provided Socket.IO client <a href="http://socket.io/download/">CDN here</a>.</small>
  860. * @param {Number} NO_XMLHTTPREQUEST_SUPPORT <small>Value <code>2</code></small>
  861. * The value of the failure code when <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest">
  862. * XMLHttpRequest API</a> required to make request to Auth server is not supported.
  863. * <small>To resolve this, display in the Web UI to ask clients to switch to the list of supported browser
  864. * as <a href="https://github.com/Temasys/SkylinkJS/tree/0.6.14#supported-browsers">listed in here</a>.</small>
  865. * @param {Number} NO_WEBRTC_SUPPORT <small>Value <code>3</code></small>
  866. * The value of the failure code when <a href="https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/">
  867. * RTCPeerConnection API</a> required for Peer connections is not supported.
  868. * <small>To resolve this, display in the Web UI to ask clients to switch to the list of supported browser
  869. * as <a href="https://github.com/Temasys/SkylinkJS/tree/0.6.14#supported-browsers">listed in here</a>.
  870. * For <a href="http://confluence.temasys.com.sg/display/TWPP">plugin supported browsers</a>, if the clients
  871. * does not have the plugin installed, there will be an installation toolbar that will prompt for installation
  872. * to support the RTCPeerConnection API.</small>
  873. * @param {Number} NO_PATH <small>Value <code>4</code></small>
  874. * The value of the failure code when provided <code>init()</code> configuration has errors.
  875. * @param {Number} ADAPTER_NO_LOADED <small>Value <code>7</code></small>
  876. * The value of the failure code when dependency <a href="https://github.com/Temasys/AdapterJS/">AdapterJS</a>
  877. * is not loaded.
  878. * <small>To resolve this, ensure that the AdapterJS dependency is loaded before the Skylink dependency.
  879. * You may use the provided AdapterJS <a href="https://github.com/Temasys/AdapterJS/">CDN here</a>.</small>
  880. * @param {Number} PARSE_CODECS <small>Value <code>8</code></small>
  881. * The value of the failure code when codecs support cannot be parsed and retrieved.
  882. * @type JSON
  883. * @readOnly
  884. * @for Skylink
  885. * @since 0.4.0
  886. */
  887. Skylink.prototype.READY_STATE_CHANGE_ERROR = {
  888. API_INVALID: 4001,
  889. API_DOMAIN_NOT_MATCH: 4002,
  890. API_CORS_DOMAIN_NOT_MATCH: 4003,
  891. API_CREDENTIALS_INVALID: 4004,
  892. API_CREDENTIALS_NOT_MATCH: 4005,
  893. API_INVALID_PARENT_KEY: 4006,
  894. API_NO_MEETING_RECORD_FOUND: 4010,
  895. API_OVER_SEAT_LIMIT: 4020,
  896. API_RETRIEVAL_FAILED: 4021,
  897. API_WRONG_ACCESS_DOMAIN: 5005,
  898. XML_HTTP_REQUEST_ERROR: -1,
  899. XML_HTTP_NO_REPONSE_ERROR: -2,
  900. NO_SOCKET_IO: 1,
  901. NO_XMLHTTPREQUEST_SUPPORT: 2,
  902. NO_WEBRTC_SUPPORT: 3,
  903. NO_PATH: 4,
  904. ADAPTER_NO_LOADED: 7,
  905. PARSE_CODECS: 8
  906. };
  907.  
  908. /**
  909. * Spoofs the REGIONAL_SERVER to prevent errors on deployed apps except the fact this no longer works.
  910. * Automatic regional selection has already been implemented hence REGIONAL_SERVER is no longer useful.
  911. * @attribute REGIONAL_SERVER
  912. * @type JSON
  913. * @readOnly
  914. * @private
  915. * @for Skylink
  916. * @since 0.6.16
  917. */
  918. Skylink.prototype.REGIONAL_SERVER = {
  919. APAC1: '',
  920. US1: ''
  921. };
  922.  
  923. /**
  924. * The list of User's priority weight schemes for <a href="#method_joinRoom">
  925. * <code>joinRoom()</code> method</a> connections.
  926. * @attribute PRIORITY_WEIGHT_SCHEME
  927. * @param {String} ENFORCE_OFFERER <small>Value <code>"enforceOfferer"</code></small>
  928. * The value of the priority weight scheme to enforce User as the offerer.
  929. * @param {String} ENFORCE_ANSWERER <small>Value <code>"enforceAnswerer"</code></small>
  930. * The value of the priority weight scheme to enforce User as the answerer.
  931. * @param {String} AUTO <small>Value <code>"auto"</code></small>
  932. * The value of the priority weight scheme to let User be offerer or answerer based on Signaling server selection.
  933. * @type JSON
  934. * @readOnly
  935. * @for Skylink
  936. * @since 0.6.18
  937. */
  938. Skylink.prototype.PRIORITY_WEIGHT_SCHEME = {
  939. ENFORCE_OFFERER: 'enforceOfferer',
  940. ENFORCE_ANSWERER: 'enforceAnswerer',
  941. AUTO: 'auto'
  942. };
  943.  
  944. /**
  945. * The list of the SDK <code>console</code> API log levels.
  946. * @attribute LOG_LEVEL
  947. * @param {Number} DEBUG <small>Value <code>4</code></small>
  948. * The value of the log level that displays <code>console</code> <code>debug</code>,
  949. * <code>log</code>, <code>info</code>, <code>warn</code> and <code>error</code> logs.
  950. * @param {Number} LOG <small>Value <code>3</code></small>
  951. * The value of the log level that displays only <code>console</code> <code>log</code>,
  952. * <code>info</code>, <code>warn</code> and <code>error</code> logs.
  953. * @param {Number} INFO <small>Value <code>2</code></small>
  954. * The value of the log level that displays only <code>console</code> <code>info</code>,
  955. * <code>warn</code> and <code>error</code> logs.
  956. * @param {Number} WARN <small>Value <code>1</code></small>
  957. * The value of the log level that displays only <code>console</code> <code>warn</code>
  958. * and <code>error</code> logs.
  959. * @param {Number} ERROR <small>Value <code>0</code></small>
  960. * The value of the log level that displays only <code>console</code> <code>error</code> logs.
  961. * @param {Number} NONE <small>Value <code>-1</code></small>
  962. * The value of the log level that displays no logs.
  963. * @type JSON
  964. * @readOnly
  965. * @for Skylink
  966. * @since 0.5.4
  967. */
  968. Skylink.prototype.LOG_LEVEL = {
  969. DEBUG: 4,
  970. LOG: 3,
  971. INFO: 2,
  972. WARN: 1,
  973. ERROR: 0,
  974. NONE: -1
  975. };
  976.  
  977. /**
  978. * The list of <a href="#method_joinRoom"><code>joinRoom()</code> method</a> socket connection failure states.
  979. * @attribute SOCKET_ERROR
  980. * @param {Number} CONNECTION_FAILED <small>Value <code>0</code></small>
  981. * The value of the failure state when <code>joinRoom()</code> socket connection failed to establish with
  982. * the Signaling server at the first attempt.
  983. * @param {Number} RECONNECTION_FAILED <small>Value <code>-1</code></small>
  984. * The value of the failure state when <code>joinRoom()</code> socket connection failed to establish
  985. * the Signaling server after the first attempt.
  986. * @param {Number} CONNECTION_ABORTED <small>Value <code>-2</code></small>
  987. * The value of the failure state when <code>joinRoom()</code> socket connection will not attempt
  988. * to reconnect after the failure of the first attempt in <code>CONNECTION_FAILED</code> as there
  989. * are no more ports or transports to attempt for reconnection.
  990. * @param {Number} RECONNECTION_ABORTED <small>Value <code>-3</code></small>
  991. * The value of the failure state when <code>joinRoom()</code> socket connection will not attempt
  992. * to reconnect after the failure of several attempts in <code>RECONNECTION_FAILED</code> as there
  993. * are no more ports or transports to attempt for reconnection.
  994. * @param {Number} RECONNECTION_ATTEMPT <small>Value <code>-4</code></small>
  995. * The value of the failure state when <code>joinRoom()</code> socket connection is attempting
  996. * to reconnect with a new port or transport after the failure of attempts in
  997. * <code>CONNECTION_FAILED</code> or <code>RECONNECTED_FAILED</code>.
  998. * @type JSON
  999. * @readOnly
  1000. * @for Skylink
  1001. * @since 0.5.6
  1002. */
  1003. Skylink.prototype.SOCKET_ERROR = {
  1004. CONNECTION_FAILED: 0,
  1005. RECONNECTION_FAILED: -1,
  1006. CONNECTION_ABORTED: -2,
  1007. RECONNECTION_ABORTED: -3,
  1008. RECONNECTION_ATTEMPT: -4
  1009. };
  1010.  
  1011. /**
  1012. * The list of <a href="#method_joinRoom"><code>joinRoom()</code> method</a> socket connection reconnection states.
  1013. * @attribute SOCKET_FALLBACK
  1014. * @param {String} NON_FALLBACK <small>Value <code>"nonfallback"</code></small>
  1015. * The value of the reconnection state when <code>joinRoom()</code> socket connection is at its initial state
  1016. * without transitioning to any new socket port or transports yet.
  1017. * @param {String} FALLBACK_PORT <small>Value <code>"fallbackPortNonSSL"</code></small>
  1018. * The value of the reconnection state when <code>joinRoom()</code> socket connection is reconnecting with
  1019. * another new HTTP port using WebSocket transports to attempt to establish connection with Signaling server.
  1020. * @param {String} FALLBACK_PORT_SSL <small>Value <code>"fallbackPortSSL"</code></small>
  1021. * The value of the reconnection state when <code>joinRoom()</code> socket connection is reconnecting with
  1022. * another new HTTPS port using WebSocket transports to attempt to establish connection with Signaling server.
  1023. * @param {String} LONG_POLLING <small>Value <code>"fallbackLongPollingNonSSL"</code></small>
  1024. * The value of the reconnection state when <code>joinRoom()</code> socket connection is reconnecting with
  1025. * another new HTTP port using Polling transports to attempt to establish connection with Signaling server.
  1026. * @param {String} LONG_POLLING_SSL <small>Value <code>"fallbackLongPollingSSL"</code></small>
  1027. * The value of the reconnection state when <code>joinRoom()</code> socket connection is reconnecting with
  1028. * another new HTTPS port using Polling transports to attempt to establish connection with Signaling server.
  1029. * @type JSON
  1030. * @readOnly
  1031. * @for Skylink
  1032. * @since 0.5.6
  1033. */
  1034. Skylink.prototype.SOCKET_FALLBACK = {
  1035. NON_FALLBACK: 'nonfallback',
  1036. FALLBACK_PORT: 'fallbackPortNonSSL',
  1037. FALLBACK_SSL_PORT: 'fallbackPortSSL',
  1038. LONG_POLLING: 'fallbackLongPollingNonSSL',
  1039. LONG_POLLING_SSL: 'fallbackLongPollingSSL'
  1040. };
  1041.  
  1042. /**
  1043. * <blockquote class="info">
  1044. * Note that this is used only for SDK developer purposes.<br>
  1045. * Current version: <code>0.1.4</code>
  1046. * </blockquote>
  1047. * The value of the current version of the Signaling socket message protocol.
  1048. * @attribute SM_PROTOCOL_VERSION
  1049. * @type String
  1050. * @for Skylink
  1051. * @since 0.6.0
  1052. */
  1053. Skylink.prototype.SM_PROTOCOL_VERSION = '0.1.2.4';
  1054.  
  1055. /**
  1056. * <blockquote class="info">
  1057. * Note that if the video codec is not supported, the SDK will not configure the local <code>"offer"</code> or
  1058. * <code>"answer"</code> session description to prefer the codec.
  1059. * </blockquote>
  1060. * The list of available video codecs to set as the preferred video codec to use to encode
  1061. * sending video data when available encoded video codec for Peer connections
  1062. * configured in the <a href="#method_init"><code>init()</code> method</a>.
  1063. * @attribute VIDEO_CODEC
  1064. * @param {String} AUTO <small>Value <code>"auto"</code></small>
  1065. * The value of the option to not prefer any video codec but rather use the created
  1066. * local <code>"offer"</code> / <code>"answer"</code> session description video codec preference.
  1067. * @param {String} VP8 <small>Value <code>"VP8"</code></small>
  1068. * The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/VP8">VP8</a> video codec.
  1069. * @param {String} VP9 <small>Value <code>"VP9"</code></small>
  1070. * The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/VP9">VP9</a> video codec.
  1071. * @param {String} H264 <small>Value <code>"H264"</code></small>
  1072. * The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC">H264</a> video codec.
  1073. * @type JSON
  1074. * @readOnly
  1075. * @for Skylink
  1076. * @since 0.5.10
  1077. */
  1078. Skylink.prototype.VIDEO_CODEC = {
  1079. AUTO: 'auto',
  1080. VP8: 'VP8',
  1081. H264: 'H264',
  1082. VP9: 'VP9'
  1083. //H264UC: 'H264UC'
  1084. };
  1085.  
  1086. /**
  1087. * <blockquote class="info">
  1088. * Note that if the audio codec is not supported, the SDK will not configure the local <code>"offer"</code> or
  1089. * <code>"answer"</code> session description to prefer the codec.
  1090. * </blockquote>
  1091. * The list of available audio codecs to set as the preferred audio codec to use to encode
  1092. * sending audio data when available encoded audio codec for Peer connections
  1093. * configured in the <a href="#method_init"><code>init()</code> method</a>.
  1094. * @attribute AUDIO_CODEC
  1095. * @param {String} AUTO <small>Value <code>"auto"</code></small>
  1096. * The value of the option to not prefer any audio codec but rather use the created
  1097. * local <code>"offer"</code> / <code>"answer"</code> session description audio codec preference.
  1098. * @param {String} OPUS <small>Value <code>"opus"</code></small>
  1099. * The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/Opus_(audio_format)">OPUS</a> audio codec.
  1100. * @param {String} ISAC <small>Value <code>"ISAC"</code></small>
  1101. * The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/Internet_Speech_Audio_Codec">ISAC</a> audio codec.
  1102. * @param {String} ILBC <small>Value <code>"ILBC"</code></small>
  1103. * The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/Internet_Low_Bitrate_Codec">iLBC</a> audio codec.
  1104. * @param {String} G722 <small>Value <code>"G722"</code></small>
  1105. * The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/G.722">G722</a> audio codec.
  1106. * @param {String} PCMA <small>Value <code>"PCMA"</code></small>
  1107. * The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/G.711">G711u</a> audio codec.
  1108. * @param {String} PCMU <small>Value <code>"PCMU"</code></small>
  1109. * The value of the option to prefer the <a href="https://en.wikipedia.org/wiki/G.711">G711a</a> audio codec.
  1110. * @type JSON
  1111. * @readOnly
  1112. * @for Skylink
  1113. * @since 0.5.10
  1114. */
  1115. Skylink.prototype.AUDIO_CODEC = {
  1116. AUTO: 'auto',
  1117. ISAC: 'ISAC',
  1118. OPUS: 'opus',
  1119. ILBC: 'ILBC',
  1120. G722: 'G722',
  1121. PCMU: 'PCMU',
  1122. PCMA: 'PCMA',
  1123. //SILK: 'SILK'
  1124. };
  1125.  
  1126. /**
  1127. * The list of available screensharing media sources configured in the
  1128. * <a href="#method_shareScreen"><code>shareScreen()</code> method</a>.
  1129. * @attribute MEDIA_SOURCE
  1130. * @param {String} SCREEN <small>Value <code>"screen"</code></small>
  1131. * The value of the option to share entire screen.
  1132. * @param {String} WINDOW <small>Value <code>"window"</code></small>
  1133. * The value of the option to share application windows.
  1134. * @param {String} TAB <small>Value <code>"tab"</code></small>
  1135. * The value of the option to share browser tab.
  1136. * <small>Note that this is only supported by from Chrome 52+ and Opera 39+.</small>
  1137. * @param {String} TAB_AUDIO <small>Value <code>"audio"</code></small>
  1138. * The value of the option to share browser tab audio.
  1139. * <small>Note that this is only supported by Chrome 52+ and Opera 39+.</small>
  1140. * <small><code>options.audio</code> has to be enabled with <code>TAB</code> also requested to enable sharing of tab audio.</small>
  1141. * @param {String} APPLICATION <small>Value <code>"application"</code></small>
  1142. * The value of the option to share applications.
  1143. * <small>Note that this is only supported by Firefox currently.</small>
  1144. * @param {String} BROWSER <small>Value <code>"browser"</code></small>
  1145. * The value of the option to share browser.
  1146. * <small>Note that this is only supported by Firefox currently, and requires toggling the <code>media.getUserMedia.browser.enabled</code>
  1147. * in <code>about:config</code>.</small>
  1148. * @param {String} CAMERA <small>Value <code>"camera"</code></small>
  1149. * The value of the option to share camera.
  1150. * <small>Note that this is only supported by Firefox currently.</small>
  1151. * @type JSON
  1152. * @readOnly
  1153. * @for Skylink
  1154. * @since 0.5.10
  1155. */
  1156. Skylink.prototype.MEDIA_SOURCE = {
  1157. SCREEN: 'screen',
  1158. WINDOW: 'window',
  1159. TAB: 'tab',
  1160. TAB_AUDIO: 'audio',
  1161. APPLICATION: 'application',
  1162. BROWSER: 'browser',
  1163. CAMERA: 'camera'
  1164. };
  1165.  
  1166. /**
  1167. * <blockquote class="info">
  1168. * Note that currently <a href="#method_getUserMedia"><code>getUserMedia()</code> method</a> only configures
  1169. * the maximum resolution of the Stream due to browser interopability and support.
  1170. * </blockquote>
  1171. * The list of <a href="https://en.wikipedia.org/wiki/Graphics_display_resolution#Video_Graphics_Array">
  1172. * video resolutions</a> sets configured in the <a href="#method_getUserMedia"><code>getUserMedia()</code> method</a>.
  1173. * @attribute VIDEO_RESOLUTION
  1174. * @param {JSON} QQVGA <small>Value <code>{ width: 160, height: 120 }</code></small>
  1175. * The value of the option to configure QQVGA resolution.
  1176. * <small>Aspect ratio: <code>4:3</code></small>
  1177. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1178. * @param {JSON} HQVGA <small>Value <code>{ width: 240, height: 160 }</code></small>
  1179. * The value of the option to configure HQVGA resolution.
  1180. * <small>Aspect ratio: <code>3:2</code></small>
  1181. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1182. * @param {JSON} QVGA <small>Value <code>{ width: 320, height: 240 }</code></small>
  1183. * The value of the option to configure QVGA resolution.
  1184. * <small>Aspect ratio: <code>4:3</code></small>
  1185. * @param {JSON} WQVGA <small>Value <code>{ width: 384, height: 240 }</code></small>
  1186. * The value of the option to configure WQVGA resolution.
  1187. * <small>Aspect ratio: <code>16:10</code></small>
  1188. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1189. * @param {JSON} HVGA <small>Value <code>{ width: 480, height: 320 }</code></small>
  1190. * The value of the option to configure HVGA resolution.
  1191. * <small>Aspect ratio: <code>3:2</code></small>
  1192. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1193. * @param {JSON} VGA <small>Value <code>{ width: 640, height: 480 }</code></small>
  1194. * The value of the option to configure VGA resolution.
  1195. * <small>Aspect ratio: <code>4:3</code></small>
  1196. * @param {JSON} WVGA <small>Value <code>{ width: 768, height: 480 }</code></small>
  1197. * The value of the option to configure WVGA resolution.
  1198. * <small>Aspect ratio: <code>16:10</code></small>
  1199. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1200. * @param {JSON} FWVGA <small>Value <code>{ width: 854, height: 480 }</code></small>
  1201. * The value of the option to configure FWVGA resolution.
  1202. * <small>Aspect ratio: <code>16:9</code></small>
  1203. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1204. * @param {JSON} SVGA <small>Value <code>{ width: 800, height: 600 }</code></small>
  1205. * The value of the option to configure SVGA resolution.
  1206. * <small>Aspect ratio: <code>4:3</code></small>
  1207. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1208. * @param {JSON} DVGA <small>Value <code>{ width: 960, height: 640 }</code></small>
  1209. * The value of the option to configure DVGA resolution.
  1210. * <small>Aspect ratio: <code>3:2</code></small>
  1211. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1212. * @param {JSON} WSVGA <small>Value <code>{ width: 1024, height: 576 }</code></small>
  1213. * The value of the option to configure WSVGA resolution.
  1214. * <small>Aspect ratio: <code>16:9</code></small>
  1215. * @param {JSON} HD <small>Value <code>{ width: 1280, height: 720 }</code></small>
  1216. * The value of the option to configure HD resolution.
  1217. * <small>Aspect ratio: <code>16:9</code></small>
  1218. * <small>Note that configurating this resolution may not be supported depending on device supports.</small>
  1219. * @param {JSON} HDPLUS <small>Value <code>{ width: 1600, height: 900 }</code></small>
  1220. * The value of the option to configure HDPLUS resolution.
  1221. * <small>Aspect ratio: <code>16:9</code></small>
  1222. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1223. * @param {JSON} FHD <small>Value <code>{ width: 1920, height: 1080 }</code></small>
  1224. * The value of the option to configure FHD resolution.
  1225. * <small>Aspect ratio: <code>16:9</code></small>
  1226. * <small>Note that configurating this resolution may not be supported depending on device supports.</small>
  1227. * @param {JSON} QHD <small>Value <code>{ width: 2560, height: 1440 }</code></small>
  1228. * The value of the option to configure QHD resolution.
  1229. * <small>Aspect ratio: <code>16:9</code></small>
  1230. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1231. * @param {JSON} WQXGAPLUS <small>Value <code>{ width: 3200, height: 1800 }</code></small>
  1232. * The value of the option to configure WQXGAPLUS resolution.
  1233. * <small>Aspect ratio: <code>16:9</code></small>
  1234. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1235. * @param {JSON} UHD <small>Value <code>{ width: 3840, height: 2160 }</code></small>
  1236. * The value of the option to configure UHD resolution.
  1237. * <small>Aspect ratio: <code>16:9</code></small>
  1238. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1239. * @param {JSON} UHDPLUS <small>Value <code>{ width: 5120, height: 2880 }</code></small>
  1240. * The value of the option to configure UHDPLUS resolution.
  1241. * <small>Aspect ratio: <code>16:9</code></small>
  1242. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1243. * @param {JSON} FUHD <small>Value <code>{ width: 7680, height: 4320 }</code></small>
  1244. * The value of the option to configure FUHD resolution.
  1245. * <small>Aspect ratio: <code>16:9</code></small>
  1246. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1247. * @param {JSON} QUHD <small>Value <code>{ width: 15360, height: 8640 }</code></small>
  1248. * The value of the option to configure QUHD resolution.
  1249. * <small>Aspect ratio: <code>16:9</code></small>
  1250. * <small>Note that configurating this resolution may not be supported depending on browser and device supports.</small>
  1251. * @type JSON
  1252. * @readOnly
  1253. * @for Skylink
  1254. * @since 0.5.6
  1255. */
  1256. Skylink.prototype.VIDEO_RESOLUTION = {
  1257. QQVGA: { width: 160, height: 120 /*, aspectRatio: '4:3'*/ },
  1258. HQVGA: { width: 240, height: 160 /*, aspectRatio: '3:2'*/ },
  1259. QVGA: { width: 320, height: 240 /*, aspectRatio: '4:3'*/ },
  1260. WQVGA: { width: 384, height: 240 /*, aspectRatio: '16:10'*/ },
  1261. HVGA: { width: 480, height: 320 /*, aspectRatio: '3:2'*/ },
  1262. VGA: { width: 640, height: 480 /*, aspectRatio: '4:3'*/ },
  1263. WVGA: { width: 768, height: 480 /*, aspectRatio: '16:10'*/ },
  1264. FWVGA: { width: 854, height: 480 /*, aspectRatio: '16:9'*/ },
  1265. SVGA: { width: 800, height: 600 /*, aspectRatio: '4:3'*/ },
  1266. DVGA: { width: 960, height: 640 /*, aspectRatio: '3:2'*/ },
  1267. WSVGA: { width: 1024, height: 576 /*, aspectRatio: '16:9'*/ },
  1268. HD: { width: 1280, height: 720 /*, aspectRatio: '16:9'*/ },
  1269. HDPLUS: { width: 1600, height: 900 /*, aspectRatio: '16:9'*/ },
  1270. FHD: { width: 1920, height: 1080 /*, aspectRatio: '16:9'*/ },
  1271. QHD: { width: 2560, height: 1440 /*, aspectRatio: '16:9'*/ },
  1272. WQXGAPLUS: { width: 3200, height: 1800 /*, aspectRatio: '16:9'*/ },
  1273. UHD: { width: 3840, height: 2160 /*, aspectRatio: '16:9'*/ },
  1274. UHDPLUS: { width: 5120, height: 2880 /*, aspectRatio: '16:9'*/ },
  1275. FUHD: { width: 7680, height: 4320 /*, aspectRatio: '16:9'*/ },
  1276. QUHD: { width: 15360, height: 8640 /*, aspectRatio: '16:9'*/ }
  1277. };
  1278.  
  1279. /**
  1280. * The list of <a href="#method_getUserMedia"><code>getUserMedia()</code> method</a> or
  1281. * <a href="#method_shareScreen"><code>shareScreen()</code> method</a> Stream fallback states.
  1282. * @attribute MEDIA_ACCESS_FALLBACK_STATE
  1283. * @param {JSON} FALLBACKING <small>Value <code>0</code></small>
  1284. * The value of the state when <code>getUserMedia()</code> will retrieve audio track only
  1285. * when retrieving audio and video tracks failed.
  1286. * <small>This can be configured by <a href="#method_init"><code>init()</code> method</a>
  1287. * <code>audioFallback</code> option.</small>
  1288. * @param {JSON} FALLBACKED <small>Value <code>1</code></small>
  1289. * The value of the state when <code>getUserMedia()</code> or <code>shareScreen()</code>
  1290. * retrieves camera / screensharing Stream successfully but with missing originally required audio or video tracks.
  1291. * @param {JSON} ERROR <small>Value <code>-1</code></small>
  1292. * The value of the state when <code>getUserMedia()</code> failed to retrieve audio track only
  1293. * after retrieving audio and video tracks failed.
  1294. * @readOnly
  1295. * @for Skylink
  1296. * @since 0.6.14
  1297. */
  1298. Skylink.prototype.MEDIA_ACCESS_FALLBACK_STATE = {
  1299. FALLBACKING: 0,
  1300. FALLBACKED: 1,
  1301. ERROR: -1
  1302. };
  1303.  
  1304. /**
  1305. * The list of recording states.
  1306. * @attribute RECORDING_STATE
  1307. * @param {Number} START <small>Value <code>0</code></small>
  1308. * The value of the state when recording session has started.
  1309. * @param {Number} STOP <small>Value <code>1</code></small>
  1310. * The value of the state when recording session has stopped.<br>
  1311. * <small>At this stage, the recorded videos will go through the mixin server to compile the videos.</small>
  1312. * @param {Number} LINK <small>Value <code>2</code></small>
  1313. * The value of the state when recording session mixin request has been completed.
  1314. * @param {Number} ERROR <small>Value <code>-1</code></small>
  1315. * The value of the state state when recording session has errors.
  1316. * <small>This can happen during recording session or during mixin of recording videos,
  1317. * and at this stage, any current recording session or mixin is aborted.</small>
  1318. * @type JSON
  1319. * @beta
  1320. * @for Skylink
  1321. * @since 0.6.16
  1322. */
  1323. Skylink.prototype.RECORDING_STATE = {
  1324. START: 0,
  1325. STOP: 1,
  1326. LINK: 2,
  1327. ERROR: -1
  1328. };
  1329.  
  1330. /**
  1331. * Stores the data chunk size for Blob transfers.
  1332. * @attribute _CHUNK_FILE_SIZE
  1333. * @type Number
  1334. * @private
  1335. * @readOnly
  1336. * @for Skylink
  1337. * @since 0.5.2
  1338. */
  1339. Skylink.prototype._CHUNK_FILE_SIZE = 49152;
  1340.  
  1341. /**
  1342. * Stores the data chunk size for Blob transfers transferring from/to
  1343. * Firefox browsers due to limitation tested in the past in some PCs (linx predominatly).
  1344. * @attribute _MOZ_CHUNK_FILE_SIZE
  1345. * @type Number
  1346. * @private
  1347. * @readOnly
  1348. * @for Skylink
  1349. * @since 0.5.2
  1350. */
  1351. Skylink.prototype._MOZ_CHUNK_FILE_SIZE = 12288;
  1352.  
  1353. /**
  1354. * Stores the data chunk size for binary Blob transfers.
  1355. * @attribute _BINARY_FILE_SIZE
  1356. * @type Number
  1357. * @private
  1358. * @readOnly
  1359. * @for Skylink
  1360. * @since 0.6.16
  1361. */
  1362. Skylink.prototype._BINARY_FILE_SIZE = 65456;
  1363.  
  1364. /**
  1365. * Stores the data chunk size for binary Blob transfers.
  1366. * @attribute _MOZ_BINARY_FILE_SIZE
  1367. * @type Number
  1368. * @private
  1369. * @readOnly
  1370. * @for Skylink
  1371. * @since 0.6.16
  1372. */
  1373. Skylink.prototype._MOZ_BINARY_FILE_SIZE = 16384;
  1374.  
  1375. /**
  1376. * Stores the data chunk size for data URI string transfers.
  1377. * @attribute _CHUNK_DATAURL_SIZE
  1378. * @type Number
  1379. * @private
  1380. * @readOnly
  1381. * @for Skylink
  1382. * @since 0.5.2
  1383. */
  1384. Skylink.prototype._CHUNK_DATAURL_SIZE = 1212;
  1385.  
  1386. /**
  1387. * Stores the list of data transfer protocols.
  1388. * @attribute _DC_PROTOCOL_TYPE
  1389. * @param {String} WRQ The protocol to initiate data transfer.
  1390. * @param {String} ACK The protocol to request for data transfer chunk.
  1391. * Give <code>-1</code> to reject the request at the beginning and <code>0</code> to accept
  1392. * the data transfer request.
  1393. * @param {String} CANCEL The protocol to terminate data transfer.
  1394. * @param {String} ERROR The protocol when data transfer has errors and has to be terminated.
  1395. * @param {String} MESSAGE The protocol that is used to send P2P messages.
  1396. * @type JSON
  1397. * @readOnly
  1398. * @private
  1399. * @for Skylink
  1400. * @since 0.5.2
  1401. */
  1402. Skylink.prototype._DC_PROTOCOL_TYPE = {
  1403. WRQ: 'WRQ',
  1404. ACK: 'ACK',
  1405. ERROR: 'ERROR',
  1406. CANCEL: 'CANCEL',
  1407. MESSAGE: 'MESSAGE'
  1408. };
  1409.  
  1410. /**
  1411. * Stores the list of socket messaging protocol types.
  1412. * See confluence docs for the list based on the current <code>SM_PROTOCOL_VERSION</code>.
  1413. * @attribute _SIG_MESSAGE_TYPE
  1414. * @type JSON
  1415. * @readOnly
  1416. * @private
  1417. * @for Skylink
  1418. * @since 0.5.6
  1419. */
  1420. Skylink.prototype._SIG_MESSAGE_TYPE = {
  1421. JOIN_ROOM: 'joinRoom',
  1422. IN_ROOM: 'inRoom',
  1423. ENTER: 'enter',
  1424. WELCOME: 'welcome',
  1425. RESTART: 'restart',
  1426. OFFER: 'offer',
  1427. ANSWER: 'answer',
  1428. ANSWER_ACK: 'answerAck',
  1429. CANDIDATE: 'candidate',
  1430. BYE: 'bye',
  1431. REDIRECT: 'redirect',
  1432. UPDATE_USER: 'updateUserEvent',
  1433. ROOM_LOCK: 'roomLockEvent',
  1434. MUTE_VIDEO: 'muteVideoEvent',
  1435. MUTE_AUDIO: 'muteAudioEvent',
  1436. PUBLIC_MESSAGE: 'public',
  1437. PRIVATE_MESSAGE: 'private',
  1438. STREAM: 'stream',
  1439. GROUP: 'group',
  1440. GET_PEERS: 'getPeers',
  1441. PEER_LIST: 'peerList',
  1442. INTRODUCE: 'introduce',
  1443. INTRODUCE_ERROR: 'introduceError',
  1444. APPROACH: 'approach',
  1445. START_RECORDING: 'startRecordingRoom',
  1446. STOP_RECORDING: 'stopRecordingRoom',
  1447. START_RTMP: 'startRTMP',
  1448. STOP_RTMP: 'stopRTMP',
  1449. RTMP: 'rtmpEvent',
  1450. RECORDING: 'recordingEvent',
  1451. END_OF_CANDIDATES: 'endOfCandidates'
  1452. };
  1453.  
  1454. /**
  1455. * Stores the list of socket messaging protocol types to queue when sent less than a second interval.
  1456. * @attribute _GROUP_MESSAGE_LIST
  1457. * @type Array
  1458. * @readOnly
  1459. * @private
  1460. * @for Skylink
  1461. * @since 0.5.10
  1462. */
  1463. Skylink.prototype._GROUP_MESSAGE_LIST = [
  1464. Skylink.prototype._SIG_MESSAGE_TYPE.STREAM,
  1465. Skylink.prototype._SIG_MESSAGE_TYPE.UPDATE_USER,
  1466. Skylink.prototype._SIG_MESSAGE_TYPE.MUTE_AUDIO,
  1467. Skylink.prototype._SIG_MESSAGE_TYPE.MUTE_VIDEO,
  1468. Skylink.prototype._SIG_MESSAGE_TYPE.PUBLIC_MESSAGE
  1469. ];
  1470.  
  1471. /**
  1472. * <blockquote class="info">
  1473. * Note that this is used only for SDK development purposes.<br>
  1474. * Current version: <code>1.1</code>
  1475. * </blockquote>
  1476. * The value of the current version of the stats API used.
  1477. * @attribute STATS_API_VERSION
  1478. * @type String
  1479. * @readOnly
  1480. * @for Skylink
  1481. * @since 0.6.31
  1482. */
  1483. Skylink.prototype.STATS_API_VERSION = '1.1';
  1484.  
  1485. /**
  1486. * The options available for video and audio bitrates (kbps) quality.
  1487. * @attribute VIDEO_QUALITY
  1488. * @param {JSON} HD <small>Value <code>{ video: 3200, audio: 80 }</code></small>
  1489. * The value of option to prefer high definition video and audio bitrates.
  1490. * @param {JSON} HQ <small>Value <code>{ video: 1200, audio: 50 }</code></small>
  1491. * The value of option to prefer high quality video and audio bitrates.
  1492. * @param {JSON} SQ <small>Value <code>{ video: 800, audio: 30 }</code></small>
  1493. * The value of option to prefer standard quality video and audio bitrates.
  1494. * @param {JSON} LQ <small>Value <code>{ video: 500, audio: 20 }</code></small>
  1495. * The value of option to prefer low quality video and audio bitrates.
  1496. * @type JSON
  1497. * @readOnly
  1498. * @for Skylink
  1499. * @since 0.6.32
  1500. */
  1501. Skylink.prototype.VIDEO_QUALITY = {
  1502. HD: { video: 3200, audio: 150 },
  1503. HQ: { video: 1200, audio: 80 },
  1504. SQ: { video: 800, audio: 30 },
  1505. LQ: { video: 400, audio: 20 }
  1506. };
  1507.  
  1508. /**
  1509. * The list of RTMP states.
  1510. * @attribute RTMP_STATE
  1511. * @param {Number} START <small>Value <code>0</code></small>
  1512. * The value of the state when live streaming session has started.
  1513. * @param {Number} STOP <small>Value <code>1</code></small>
  1514. * The value of the state when live streaming session has stopped.<br>
  1515. * <small>At this stage, the recorded videos will go through the mixin server to compile the videos.</small>
  1516. * @param {Number} ERROR <small>Value <code>-1</code></small>
  1517. * The value of the state state when live streaming session has errors.
  1518. * @type JSON
  1519. * @beta
  1520. * @for Skylink
  1521. * @since 0.6.34
  1522. */
  1523. Skylink.prototype.RTMP_STATE = {
  1524. START: 0,
  1525. STOP: 1,
  1526. ERROR: -1
  1527. };