Source: constants.js

  1. 'use strict';
  2. /**
  3. * @namespace Flashphoner.constants.SESSION_STATUS
  4. * @see Session
  5. */
  6. const SESSION_STATUS = Object.freeze({
  7. /**
  8. * Fires when {@link Session} ws socket opens.
  9. * @event CONNECTED
  10. * @memberof Flashphoner.constants.SESSION_STATUS
  11. */
  12. CONNECTED: 'CONNECTED',
  13. /**
  14. * Fires when {@link Session} receives connect ack from REST App.
  15. * @event ESTABLISHED
  16. * @memberof Flashphoner.constants.SESSION_STATUS
  17. */
  18. ESTABLISHED: 'ESTABLISHED',
  19. /**
  20. * Fires when {@link Session} disconnects.
  21. * @event DISCONNECTED
  22. * @memberof Flashphoner.constants.SESSION_STATUS
  23. */
  24. DISCONNECTED: 'DISCONNECTED',
  25. /**
  26. * Fires if {@link Session} call of rest method error.
  27. * @event WARN
  28. * @memberof Flashphoner.constants.SESSION_STATUS
  29. */
  30. WARN: 'WARN',
  31. /**
  32. * Fires if {@link Session} connection failed.
  33. * Some of the reasons can be network connection failed, REST App failed
  34. * @event FAILED
  35. * @memberof Flashphoner.constants.SESSION_STATUS
  36. */
  37. FAILED: 'FAILED',
  38. /**
  39. * Fires wneh {@link Session} receives debug event
  40. * @event DEBUG
  41. * @memberof Flashphoner.constants.SESSION_STATUS
  42. */
  43. DEBUG: 'DEBUG',
  44. /**
  45. * Fires when {@link Session} receives custom REST App message.
  46. *
  47. * @event APP_DATA
  48. * @memberof Flashphoner.constants.SESSION_STATUS
  49. */
  50. APP_DATA: 'APP_DATA',
  51. /**
  52. * Fires when {@link Session} receives status of sendData operation.
  53. *
  54. * @event SEND_DATA_STATUS
  55. * @memberof Flashphoner.constants.SESSION_STATUS
  56. */
  57. SEND_DATA_STATUS: 'SEND_DATA_STATUS',
  58. /**
  59. * State of newly created {@link Session}.
  60. *
  61. * @event PENDING
  62. * @memberof Flashphoner.constants.SESSION_STATUS
  63. */
  64. PENDING: 'PENDING',
  65. /**
  66. * Fires when {@link Session} registers as sip client.
  67. *
  68. * @event REGISTERED
  69. * @memberof Flashphoner.constants.SESSION_STATUS
  70. */
  71. REGISTERED: 'REGISTERED',
  72. /**
  73. * Fires when {@link Session} unregisters as sip client.
  74. *
  75. * @event UNREGISTERED
  76. * @memberof Flashphoner.constants.SESSION_STATUS
  77. */
  78. UNREGISTERED: 'UNREGISTERED',
  79. /**
  80. * Fires when {@link Session} receives an incoming call.
  81. *
  82. * @event INCOMING_CALL
  83. * @memberof Flashphoner.constants.SESSION_STATUS
  84. */
  85. INCOMING_CALL: 'INCOMING_CALL'
  86. });
  87. /**
  88. * @namespace Flashphoner.constants.STREAM_STATUS
  89. * @see Stream
  90. */
  91. const STREAM_STATUS = Object.freeze({
  92. /**
  93. * State of newly created {@link Stream}.
  94. *
  95. * @event NEW
  96. * @memberof Flashphoner.constants.STREAM_STATUS
  97. */
  98. NEW: 'NEW',
  99. /**
  100. * State before {@link Stream} publishing/playing.
  101. *
  102. * @event PENDING
  103. * @memberof Flashphoner.constants.STREAM_STATUS
  104. */
  105. PENDING: 'PENDING',
  106. /**
  107. * Fires when {@link Stream} starts publishing.
  108. * @event PUBLISHING
  109. * @memberof Flashphoner.constants.STREAM_STATUS
  110. */
  111. PUBLISHING: 'PUBLISHING',
  112. /**
  113. * Fires when {@link Stream} starts playing.
  114. * @event PLAYING
  115. * @memberof Flashphoner.constants.STREAM_STATUS
  116. */
  117. PLAYING: 'PLAYING',
  118. /**
  119. * Fires if {@link Stream} paused.
  120. * @event PAUSED
  121. * @memberof Flashphoner.constants.STREAM_STATUS
  122. */
  123. PAUSED: 'PAUSED',
  124. /**
  125. * Fires if {@link Stream} was unpublished.
  126. * @event UNPUBLISHED
  127. * @memberof Flashphoner.constants.STREAM_STATUS
  128. */
  129. UNPUBLISHED: 'UNPUBLISHED',
  130. /**
  131. * Fires if playing {@link Stream} was stopped.
  132. * @event STOPPED
  133. * @memberof Flashphoner.constants.STREAM_STATUS
  134. */
  135. STOPPED: 'STOPPED',
  136. /**
  137. * Fires if {@link Stream} failed.
  138. * @event FAILED
  139. * @memberof Flashphoner.constants.STREAM_STATUS
  140. */
  141. FAILED: 'FAILED',
  142. /**
  143. * Fires if {@link Stream} playback problem.
  144. * @event PLAYBACK_PROBLEM
  145. * @memberof Flashphoner.constants.STREAM_STATUS
  146. */
  147. PLAYBACK_PROBLEM: 'PLAYBACK_PROBLEM',
  148. /**
  149. * @deprecated WCS-3228 moved to {@link STREAM_EVENT_TYPE}
  150. * Fires if playing {@link Stream} picture resizing.
  151. * @event RESIZE
  152. * @memberof Flashphoner.constants.STREAM_STATUS
  153. */
  154. RESIZE: 'RESIZE',
  155. /**
  156. * @deprecated WCS-3228 moved to {@link STREAM_EVENT_TYPE}
  157. * Fires when {@link Stream} snapshot becomes available.
  158. * Snapshot is base64 encoded png available through {@link Stream.getInfo}
  159. * @event SNAPSHOT_COMPLETE
  160. * @memberof Flashphoner.constants.STREAM_STATUS
  161. */
  162. SNAPSHOT_COMPLETE: 'SNAPSHOT_COMPLETE',
  163. /**
  164. * @deprecated WCS-3228 moved to {@link STREAM_EVENT_TYPE}
  165. * Fires on playing {@link Stream} if bitrate is higher than available network bandwidth.
  166. * @event NOT_ENOUGH_BANDWIDTH
  167. * @memberof Flashphoner.constants.NOT_ENOUGH_BANDWIDTH
  168. */
  169. NOT_ENOUGH_BANDWIDTH: 'NOT_ENOUGH_BANDWIDTH'
  170. });
  171. /**
  172. * @namespace Flashphoner.constants.CALL_STATUS
  173. * @see Call
  174. */
  175. const CALL_STATUS = Object.freeze({
  176. /**
  177. * State of newly created {@link Call}
  178. * @event NEW
  179. * @memberof Flashphoner.constants.CALL_STATUS
  180. */
  181. NEW: 'NEW',
  182. /**
  183. * The server is ringing to the callee
  184. * @event RING
  185. * @memberof Flashphoner.constants.CALL_STATUS
  186. */
  187. RING: 'RING',
  188. RING_MEDIA: 'RING_MEDIA',
  189. /**
  190. * The {@link Call} was put on hold
  191. * @event HOLD
  192. * @memberof Flashphoner.constants.CALL_STATUS
  193. */
  194. HOLD: 'HOLD',
  195. /**
  196. * The {@link Call} is established
  197. * @event ESTABLISHED
  198. * @memberof Flashphoner.constants.CALL_STATUS
  199. */
  200. ESTABLISHED: 'ESTABLISHED',
  201. /**
  202. * The {@link Call} is finished
  203. * @event FINISH
  204. * @memberof Flashphoner.constants.CALL_STATUS
  205. */
  206. FINISH: 'FINISH',
  207. /**
  208. * Callee is busy
  209. * @event BUSY
  210. * @memberof Flashphoner.constants.CALL_STATUS
  211. */
  212. BUSY: 'BUSY',
  213. /**
  214. * SIP session is in progress
  215. * @event SESSION_PROGRESS
  216. * @memberof Flashphoner.constants.CALL_STATUS
  217. */
  218. SESSION_PROGRESS: 'SESSION_PROGRESS',
  219. /**
  220. * The {@link Call} is failed
  221. * @event FAILED
  222. * @memberof Flashphoner.constants.CALL_STATUS
  223. */
  224. FAILED: 'FAILED',
  225. /**
  226. * The {@link Call} state before ringing
  227. * @event PENDING
  228. * @memberof Flashphoner.constants.CALL_STATUS
  229. */
  230. PENDING: 'PENDING',
  231. /**
  232. * The server trying to establish {@link Call}
  233. * @event TRYING
  234. * @memberof Flashphoner.constants.CALL_STATUS
  235. */
  236. TRYING: 'TRYING'
  237. });
  238. /**
  239. * @namespace Flashphoner.constants.STREAM_STATUS_INFO
  240. * @see Stream
  241. */
  242. const STREAM_STATUS_INFO = Object.freeze({
  243. /**
  244. * Indicates general error during ICE negotiation. Usually occurs if client is behind some exotic nat/firewall.
  245. * @event FAILED_BY_ICE_ERROR
  246. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  247. */
  248. FAILED_BY_ICE_ERROR: 'Failed by ICE error',
  249. /**
  250. * Timeout has been reached during ICE establishment.
  251. * @event FAILED_BY_ICE_TIMEOUT
  252. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  253. */
  254. FAILED_BY_ICE_TIMEOUT: 'Failed by ICE timeout',
  255. /**
  256. * ICE refresh failed on session.
  257. * @event FAILED_BY_KEEP_ALIVE
  258. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  259. */
  260. FAILED_BY_KEEP_ALIVE: 'Failed by ICE keep alive',
  261. /**
  262. * DTLS has wrong fingerprint.
  263. * @event FAILED_BY_DTLS_FINGERPRINT_ERROR
  264. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  265. */
  266. FAILED_BY_DTLS_FINGERPRINT_ERROR: 'Failed by DTLS fingerprint error',
  267. /**
  268. * Client did not send DTLS packets or packets were lost/corrupted during transmission.
  269. * @event FAILED_BY_DTLS_ERROR
  270. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  271. */
  272. FAILED_BY_DTLS_ERROR: 'Failed by DTLS error',
  273. /**
  274. * Indicates general HLS packetizer error, can occur during initialization or packetization (wrong input or out of disk space).
  275. * @event FAILED_BY_HLS_WRITER_ERROR
  276. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  277. */
  278. FAILED_BY_HLS_WRITER_ERROR: 'Failed by HLS writer error',
  279. /**
  280. * Indicates general RTMP republishing error, can occur during initialization or rtmp packetization.
  281. * @event FAILED_BY_RTMP_WRITER_ERROR
  282. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  283. */
  284. FAILED_BY_RTMP_WRITER_ERROR: 'Failed by RTMP writer error',
  285. /**
  286. * RTP session failed by RTP activity timer.
  287. * @event FAILED_BY_RTP_ACTIVITY
  288. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  289. */
  290. FAILED_BY_RTP_ACTIVITY: 'Failed by RTP activity',
  291. /**
  292. * Related session was disconnected.
  293. * @event STOPPED_BY_SESSION_DISCONNECT
  294. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  295. */
  296. STOPPED_BY_SESSION_DISCONNECT: 'Stopped by session disconnect',
  297. /**
  298. * Stream was stopped by rest terminate request.
  299. * @event STOPPED_BY_REST_TERMINATE
  300. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  301. */
  302. STOPPED_BY_REST_TERMINATE: 'Stopped by rest /terminate',
  303. /**
  304. * Related publisher stopped its stream or lost connection.
  305. * @event STOPPED_BY_PUBLISHER_STOP
  306. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  307. */
  308. STOPPED_BY_PUBLISHER_STOP: 'Stopped by publisher stop',
  309. /**
  310. * Stop the media session by user after call was finished or unpublish stream.
  311. * @event STOPPED_BY_USER
  312. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  313. */
  314. STOPPED_BY_USER: 'Stopped by user',
  315. /**
  316. * Error occurred on the stream.
  317. * @event FAILED_BY_ERROR
  318. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  319. */
  320. FAILED_BY_ERROR: 'Failed by error',
  321. /**
  322. * Indicates that error occurred during media session creation. This might be SDP parsing error, all ports are busy, wrong session related config etc.
  323. * @event FAILED_TO_ADD_STREAM_TO_PROXY
  324. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  325. */
  326. FAILED_TO_ADD_STREAM_TO_PROXY: 'Failed to add stream to proxy',
  327. /**
  328. * Stopped shapshot distributor.
  329. * @event DISTRIBUTOR_STOPPED
  330. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  331. */
  332. DISTRIBUTOR_STOPPED: 'Distributor stopped',
  333. /**
  334. * Publish stream is not ready, try again later.
  335. * @event PUBLISH_STREAM_IS_NOT_READY
  336. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  337. */
  338. PUBLISH_STREAM_IS_NOT_READY: 'Publish stream is not ready',
  339. /**
  340. * Stream with this name is not found, check the correct of the name.
  341. * @event STREAM_NOT_FOUND
  342. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  343. */
  344. STREAM_NOT_FOUND: 'Stream not found',
  345. /**
  346. * Server already has a publish stream with the same name, try using different one.
  347. * @event STREAM_NAME_ALREADY_IN_USE
  348. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  349. */
  350. STREAM_NAME_ALREADY_IN_USE: 'Stream name is already in use',
  351. /**
  352. * Error indicates that stream object received by server has empty mediaSessionId field.
  353. * @event MEDIASESSION_ID_NULL
  354. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  355. */
  356. MEDIASESSION_ID_NULL: 'MediaSessionId is null',
  357. /**
  358. * Published or subscribed sessions used this MediaSessionId.
  359. * @event MEDIASESSION_ID_ALREADY_IN_USE
  360. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  361. */
  362. MEDIASESSION_ID_ALREADY_IN_USE: 'MediaSessionId is already in use',
  363. /**
  364. * Session is not initialized or terminated on play ordinary stream.
  365. * @event SESSION_NOT_READY
  366. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  367. */
  368. SESSION_NOT_READY: 'Session not ready',
  369. /**
  370. * Actual session does not exist.
  371. * @event SESSION_DOES_NOT_EXIST
  372. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  373. */
  374. SESSION_DOES_NOT_EXIST: 'Session does not exist',
  375. /**
  376. * RTSP has wrong format on play stream, check the RTSP url validity.
  377. * @event RTSP_HAS_WRONG_FORMAT
  378. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  379. */
  380. RTSP_HAS_WRONG_FORMAT: 'Rtsp has wrong format',
  381. /**
  382. * Failed to play vod stream, this format is not supported.
  383. * @event FILE_HAS_WRONG_FORMAT
  384. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  385. */
  386. FILE_HAS_WRONG_FORMAT: 'File has wrong format',
  387. /**
  388. * Failed to connect to rtsp stream.
  389. * @event FAILED_TO_CONNECT_TO_RTSP_STREAM
  390. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  391. */
  392. FAILED_TO_CONNECT_TO_RTSP_STREAM: 'Failed to connect to rtsp stream',
  393. /**
  394. * Rtsp stream is not found, agent received "404-Not Found".
  395. * @event RTSP_STREAM_NOT_FOUND
  396. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  397. */
  398. RTSP_STREAM_NOT_FOUND: 'Rtsp stream not found',
  399. /**
  400. * On shutdown RTSP agent.
  401. * @event RTSPAGENT_SHUTDOWN
  402. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  403. */
  404. RTSPAGENT_SHUTDOWN: 'RtspAgent shutdown',
  405. /**
  406. * Stream failed
  407. * @event STREAM_FAILED
  408. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  409. */
  410. STREAM_FAILED: 'Stream failed',
  411. /**
  412. * No common codecs on setup track, did not found corresponding trackId->mediaPort.
  413. * @event NO_COMMON_CODECS
  414. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  415. */
  416. NO_COMMON_CODECS: 'No common codecs',
  417. /**
  418. * Bad referenced rtsp link, check for correct, example: rtsp://user:b@d_password@127.0.0.1/stream.
  419. * @event BAD_URI
  420. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  421. */
  422. BAD_URI: 'Bad URI',
  423. /**
  424. * General VOD error, indicates that Exception occurred while reading/processing media file.
  425. * @event GOT_EXCEPTION_WHILE_STREAMING_FILE
  426. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  427. */
  428. GOT_EXCEPTION_WHILE_STREAMING_FILE: 'Got exception while streaming file',
  429. /**
  430. * Requested stream shutdown.
  431. * @event REQUESTED_STREAM_SHUTDOWN
  432. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  433. */
  434. REQUESTED_STREAM_SHUTDOWN: 'Requested stream shutdown',
  435. /**
  436. * Failed to create movie, file can not be read.
  437. * @event FAILED_TO_READ_FILE
  438. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  439. */
  440. FAILED_TO_READ_FILE: 'Failed to read file',
  441. /**
  442. * File does not exist, check filename.
  443. * @event FILE_NOT_FOUND
  444. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  445. */
  446. FILE_NOT_FOUND: 'File not found',
  447. /**
  448. * Server failed to establish websocket connection with origin server.
  449. * @event FAILED_TO_CONNECT_TO_ORIGIN_STREAM
  450. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  451. */
  452. FAILED_TO_CONNECT_TO_ORIGIN_STREAM: 'Failed to connect to origin stream',
  453. /**
  454. * CDN stream not found.
  455. * @event CDN_STREAM_NOT_FOUND
  456. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  457. */
  458. CDN_STREAM_NOT_FOUND: 'CDN stream not found',
  459. /**
  460. * Indicates that provided URL protocol in stream name is invalid.
  461. * Valid: vod://file.mp4
  462. * Invalid: dov://file.mp4
  463. * @event FAILED_TO_GET_AGENT_STORAGE
  464. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  465. */
  466. FAILED_TO_GET_AGENT_STORAGE: 'Failed to get agent storage',
  467. /**
  468. * Shutdown agent servicing origin stream.
  469. * @event AGENT_SERVICING_ORIGIN_STREAM_IS_SHUTTING_DOWN
  470. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  471. */
  472. AGENT_SERVICING_ORIGIN_STREAM_IS_SHUTTING_DOWN: 'Agent servicing origin stream is shutting down',
  473. /**
  474. * Terminated by keep-alive on walk through subscribers.
  475. * @event TERMINATED_BY_KEEP_ALIVE
  476. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  477. */
  478. TERMINATED_BY_KEEP_ALIVE: 'Terminated by keep-alive',
  479. /**
  480. * Transcoding required, but disabled in server settings
  481. * @event TRANSCODING_REQUIRED_BUT_DISABLED
  482. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  483. */
  484. TRANSCODING_REQUIRED_BUT_DISABLED: 'Transcoding required, but disabled',
  485. /**
  486. * Access restricted by access list
  487. * @event RESTRICTED_ACCESS
  488. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  489. */
  490. RESTRICTED_ACCESS: 'Restricted access',
  491. /**
  492. * No available transcoders for stream
  493. * @event NO_AVAILABLE_TRANSCODERS
  494. * @memberof Flashphoner.constants.STREAM_STATUS_INFO
  495. */
  496. NO_AVAILABLE_TRANSCODERS: 'No available transcoders'
  497. });
  498. /**
  499. * @namespace Flashphoner.constants.CALL_STATUS_INFO
  500. * @see Call
  501. */
  502. const CALL_STATUS_INFO = Object.freeze({
  503. /**
  504. * Normal call hangup.
  505. * @event NORMAL_CALL_CLEARING
  506. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  507. */
  508. NORMAL_CALL_CLEARING: 'Normal call clearing',
  509. /**
  510. * Error occurred while creating a session
  511. * @event FAILED_BY_SESSION_CREATION
  512. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  513. */
  514. FAILED_BY_SESSION_CREATION: 'Failed by session creation',
  515. /**
  516. * Failed by error during ICE establishment.
  517. * @event FAILED_BY_ICE_ERROR
  518. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  519. */
  520. FAILED_BY_ICE_ERROR: 'Failed by ICE error',
  521. /**
  522. * RTP session failed by RTP activity timer.
  523. * @event FAILED_BY_RTP_ACTIVITY
  524. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  525. */
  526. FAILED_BY_RTP_ACTIVITY: 'Failed by RTP activity',
  527. /**
  528. * FF writer was failed on RTMP.
  529. * @event FAILED_BY_RTMP_WRITER_ERROR
  530. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  531. */
  532. FAILED_BY_RTMP_WRITER_ERROR: 'Failed by RTMP writer error',
  533. /**
  534. * DTLS wrong fingerprint.
  535. * @event FAILED_BY_DTLS_FINGERPRINT_ERROR
  536. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  537. */
  538. FAILED_BY_DTLS_FINGERPRINT_ERROR: 'Failed by DTLS fingerprint error',
  539. /**
  540. * No common codecs in sdp
  541. * @event NO_COMMON_CODECS
  542. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  543. */
  544. NO_COMMON_CODECS: 'No common codecs',
  545. /**
  546. * Client did not send DTLS packets or packets were lost/corrupted during transmission.
  547. * @event FAILED_BY_DTLS_ERROR
  548. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  549. */
  550. FAILED_BY_DTLS_ERROR: 'Failed by DTLS error',
  551. /**
  552. * Error occurred during the call
  553. * @event FAILED_BY_ERROR
  554. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  555. */
  556. FAILED_BY_ERROR: 'Failed by error',
  557. /**
  558. * Call failed by request timeout
  559. * @event FAILED_BY_REQUEST_TIMEOUT
  560. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  561. */
  562. FAILED_BY_REQUEST_TIMEOUT: 'Failed by request timeout',
  563. /**
  564. * Transcoding required, but disabled in settings
  565. * @event TRANSCODING_REQUIRED_BUT_DISABLED
  566. * @memberof Flashphoner.constants.CALL_STATUS_INFO
  567. */
  568. TRANSCODING_REQUIRED_BUT_DISABLED: 'Transcoding required, but disabled'
  569. });
  570. /**
  571. * @namespace Flashphoner.constants.ERROR_INFO
  572. */
  573. const ERROR_INFO = Object.freeze({
  574. /**
  575. * Error if none of MediaProviders available
  576. * @event NONE_OF_MEDIAPROVIDERS_AVAILABLE
  577. * @memberof Flashphoner.constants.ERROR_INFO
  578. */
  579. NONE_OF_MEDIAPROVIDERS_AVAILABLE: 'None of MediaProviders available',
  580. /**
  581. * Error if none of preferred MediaProviders available
  582. * @event NONE_OF_PREFERRED_MEDIAPROVIDERS_AVAILABLE
  583. * @memberof Flashphoner.constants.ERROR_INFO
  584. */
  585. NONE_OF_PREFERRED_MEDIAPROVIDERS_AVAILABLE: 'None of preferred MediaProviders available',
  586. /**
  587. * Error if API is not initialized
  588. * @event FLASHPHONER_API_NOT_INITIALIZED
  589. * @memberof Flashphoner.constants.ERROR_INFO
  590. */
  591. FLASHPHONER_API_NOT_INITIALIZED: 'Flashphoner API is not initialized',
  592. /**
  593. * Error if options.urlServer is not specified
  594. * @event OPTIONS_URLSERVER_MUST_BE_PROVIDED
  595. * @memberof Flashphoner.constants.ERROR_INFO
  596. */
  597. OPTIONS_URLSERVER_MUST_BE_PROVIDED: 'options.urlServer must be provided',
  598. /**
  599. * Error if session state is not valid
  600. * @event INVALID_SESSION_STATE
  601. * @memberof Flashphoner.constants.ERROR_INFO
  602. */
  603. INVALID_SESSION_STATE: 'Invalid session state',
  604. /**
  605. * Error if no options provided
  606. * @event OPTIONS_MUST_BE_PROVIDED
  607. * @memberof Flashphoner.constants.ERROR_INFO
  608. */
  609. OPTIONS_MUST_BE_PROVIDED: 'options must be provided',
  610. /**
  611. * Error if call status is not {@link Flashphoner.constants.CALL_STATUS.NEW}
  612. * @event INVALID_CALL_STATE
  613. * @memberof Flashphoner.constants.ERROR_INFO
  614. */
  615. INVALID_CALL_STATE: 'Invalid call state',
  616. /**
  617. * Error if event is not specified
  618. * @event EVENT_CANT_BE_NULL
  619. * @memberof Flashphoner.constants.ERROR_INFO
  620. */
  621. EVENT_CANT_BE_NULL: 'Event can\'t be null',
  622. /**
  623. * Error if callback is not a valid function
  624. * @event CALLBACK_NEEDS_TO_BE_A_VALID_FUNCTION
  625. * @memberof Flashphoner.constants.ERROR_INFO
  626. */
  627. CALLBACK_NEEDS_TO_BE_A_VALID_FUNCTION: 'Callback needs to be a valid function',
  628. /**
  629. * Error if options.name is not specified
  630. * @event OPTIONS_NAME_MUST_BE_PROVIDED
  631. * @memberof Flashphoner.constants.ERROR_INFO
  632. */
  633. OPTIONS_NAME_MUST_BE_PROVIDED: 'options.name must be provided',
  634. /**
  635. * Error if number of cams is less than 2 or camera is already used by other application
  636. * @event CAN_NOT_SWITCH_CAM
  637. * @memberOf Flashphoner.constants.ERROR_INFO
  638. */
  639. CAN_NOT_SWITCH_CAM: 'Number of cams is less than 2 or camera is already used by other application',
  640. /**
  641. * Error if number of mics is less than 2 or microphone is already used by other application
  642. * @event CAN_NOT_SWITCH_MIC
  643. * @memberOf Flashphoner.constants.ERROR_INFO
  644. */
  645. CAN_NOT_SWITCH_MIC: 'Number of mics is less than 2 or microphone is already used by other application',
  646. /**
  647. * Local browser error detected
  648. * @event LOCAL_ERROR
  649. * @memberOf Flashphoner.constants.ERROR_INFO
  650. */
  651. LOCAL_ERROR: 'Local error'
  652. });
  653. /**
  654. * Local media devices type
  655. * @namespace Flashphoner.constants.MEDIA_DEVICE_KIND
  656. */
  657. const MEDIA_DEVICE_KIND = Object.freeze({
  658. /**
  659. * List local media output devices
  660. * @see Flashphoner.getMediaDevices
  661. * @memberOf Flashphoner.constants.MEDIA_DEVICE_KIND
  662. */
  663. OUTPUT: 'output',
  664. /**
  665. * List local media input devices
  666. * @see Flashphoner.getMediaDevices
  667. * @memberOf Flashphoner.constants.MEDIA_DEVICE_KIND
  668. */
  669. INPUT: 'input',
  670. /**
  671. * List local media devices
  672. * @see Flashphoner.getMediaDevices
  673. * @memberOf Flashphoner.constants.MEDIA_DEVICE_KIND
  674. */
  675. ALL: 'all'
  676. });
  677. /**
  678. * WebRTC transport type
  679. * @namespace Flashphoner.constants.TRANSPORT_TYPE
  680. */
  681. const TRANSPORT_TYPE = Object.freeze({
  682. /**
  683. * WebRTC RTP traffic goes over UDP (default)
  684. * @see Stream
  685. * @memberOf Flashphoner.constants.TRANSPORT_TYPE
  686. */
  687. UDP: 'UDP',
  688. /**
  689. * WebRTC RTP traffic goes over TCP
  690. * @see Stream
  691. * @memberOf Flashphoner.constants.TRANSPORT_TYPE
  692. */
  693. TCP: 'TCP'
  694. });
  695. /**
  696. * WebRTC connection quality type
  697. * @namespace Flashphoner.constants.CONNECTION_QUALITY
  698. */
  699. const CONNECTION_QUALITY = Object.freeze({
  700. /**
  701. * Channel bandwidth is perfect
  702. * @see Stream
  703. * @memberOf Flashphoner.constants.CONNECTION_QUALITY
  704. */
  705. PERFECT: 'PERFECT',
  706. /**
  707. * Channel bandwidth is good
  708. * @see Stream
  709. * @memberOf Flashphoner.constants.CONNECTION_QUALITY
  710. */
  711. GOOD: 'GOOD',
  712. /**
  713. * Channel bandwidth is bad
  714. * @see Stream
  715. * @memberOf Flashphoner.constants.CONNECTION_QUALITY
  716. */
  717. BAD: 'BAD',
  718. /**
  719. * Channel bandwidth is unknown (initial state)
  720. * @see Stream
  721. * @memberOf Flashphoner.constants.CONNECTION_QUALITY
  722. */
  723. UNKNOWN: 'UNKNOWN',
  724. /**
  725. * Channel bandwidth is updating
  726. * @see Stream
  727. * @memberOf Flashphoner.constants.CONNECTION_QUALITY
  728. */
  729. UPDATE: 'UPDATE'
  730. });
  731. /**
  732. * Websocket signaling stream event
  733. * @see Stream
  734. * @memberOf Flashphoner.constants
  735. */
  736. const STREAM_EVENT = 'STREAM_EVENT';
  737. /**
  738. * Websocket signaling stream event type
  739. * @namespace Flashphoner.constants.STREAM_EVENT_TYPE
  740. */
  741. const STREAM_EVENT_TYPE = Object.freeze({
  742. /**
  743. * Stream audio is muted
  744. * @see Stream
  745. * @memberOf Flashphoner.constants.STREAM_EVENT_TYPE
  746. */
  747. AUDIO_MUTED: 'audioMuted',
  748. /**
  749. * Stream audio is unmuted
  750. * @see Stream
  751. * @memberOf Flashphoner.constants.STREAM_EVENT_TYPE
  752. */
  753. AUDIO_UNMUTED: 'audioUnmuted',
  754. /**
  755. * Stream video is muted
  756. * @see Stream
  757. * @memberOf Flashphoner.constants.STREAM_EVENT_TYPE
  758. */
  759. VIDEO_MUTED: 'videoMuted',
  760. /**
  761. * Stream videoo is unmuted
  762. * @see Stream
  763. * @memberOf Flashphoner.constants.STREAM_EVENT_TYPE
  764. */
  765. VIDEO_UNMUTED: 'videoUnmuted',
  766. /**
  767. * Data bound to the stream are received
  768. * @see Stream
  769. * @memberOf Flashphoner.constants.STREAM_EVENT_TYPE
  770. */
  771. DATA: 'data',
  772. /**
  773. * Stream snapshot is completed
  774. * @see Stream
  775. * @memberOf Flashphoner.constants.STREAM_EVENT_TYPE
  776. */
  777. SNAPSHOT_COMPLETED: 'snapshotCompleted',
  778. /**
  779. * Stream snapshot is failed
  780. * @see Stream
  781. * @memberOf Flashphoner.constants.STREAM_EVENT_TYPE
  782. */
  783. SNAPSHOT_FAILED: 'snapshotFailed',
  784. /**
  785. * Fires if playing {@link Stream} picture resizing.
  786. * @event RESIZE
  787. * @memberof Flashphoner.constants.STREAM_STATUS
  788. */
  789. RESIZE: 'resize',
  790. /**
  791. * Fires on playing {@link Stream} if bitrate is higher than available network bandwidth.
  792. * @event NOT_ENOUGH_BANDWIDTH
  793. * @memberof Flashphoner.constants.NOT_ENOUGH_BANDWIDTH
  794. */
  795. NOT_ENOUGH_BANDWIDTH: 'notEnoughBandwidth'
  796. });
  797. /**
  798. * WebRTC video content hint type
  799. * @namespace Flashphoner.constants.CONTENT_HINT_TYPE
  800. */
  801. const CONTENT_HINT_TYPE = Object.freeze({
  802. /**
  803. * Video content is motion (webcam case): keep FPS, resolution and bitrate may change
  804. * @see Stream
  805. * @memberOf Flashphoner.constants.CONTENT_HINT_TYPE
  806. */
  807. MOTION: 'motion',
  808. /**
  809. * Video content is detail (sreen sharing case): keep resolution, bitrate may change, FPS may drop
  810. * @see Stream
  811. * @memberOf Flashphoner.constants.CONTENT_HINT_TYPE
  812. */
  813. DETAIL: 'detail',
  814. /**
  815. * Video content is text (sreen sharing case): keep resolution and bitrate, FPS may drop
  816. * @see Stream
  817. * @memberOf Flashphoner.constants.CONTENT_HINT_TYPE
  818. */
  819. TEXT: 'text'
  820. });
  821. module.exports = {
  822. SESSION_STATUS,
  823. STREAM_STATUS,
  824. CALL_STATUS,
  825. STREAM_STATUS_INFO,
  826. CALL_STATUS_INFO,
  827. ERROR_INFO,
  828. MEDIA_DEVICE_KIND,
  829. TRANSPORT_TYPE,
  830. CONNECTION_QUALITY,
  831. STREAM_EVENT,
  832. STREAM_EVENT_TYPE,
  833. CONTENT_HINT_TYPE
  834. };