@flashphoner/websdk 2.0.216 → 2.0.219

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