@flashphoner/websdk 2.0.215 → 2.0.218

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