Bläddra i källkod

feat(ts) TypeScript convesion of AnalyticsEvents

dev1
Gary Hunt 3 år sedan
förälder
incheckning
0399d6e487
Inget konto är kopplat till bidragsgivarens mejladress

+ 0
- 584
service/statistics/AnalyticsEvents.js Visa fil

@@ -1,584 +0,0 @@
1
-/**
2
- * This class exports constants and factory methods related to the analytics
3
- * API provided by AnalyticsAdapter. In order for entries in a database to be
4
- * somewhat easily traceable back to the code which produced them, events sent
5
- * through analytics should be defined here.
6
- *
7
- * Since the AnalyticsAdapter API can be used in different ways, for some events
8
- * it is more convenient to just define the event name as a constant. For other
9
- * events a factory function is easier.
10
- *
11
- * A general approach for adding a new event:
12
- * 1. Determine the event type: track, UI, page, or operational. If in doubt use
13
- * operational.
14
- * 2. Determine whether the event is related to other existing events, and
15
- * which fields are desired to be set: name, action, actionSubject, source.
16
- * 3. If the name is sufficient (the other fields are not important), use a
17
- * constant. Otherwise use a factory function.
18
- *
19
- * Note that the AnalyticsAdapter uses the events passed to its functions for
20
- * its own purposes, and might modify them. Because of this, factory functions
21
- * should create new objects.
22
- *
23
- */
24
-
25
-/**
26
- * The constant which identifies an event of type "operational".
27
- * @type {string}
28
- */
29
-export const TYPE_OPERATIONAL = 'operational';
30
-
31
-/**
32
- * The constant which identifies an event of type "page".
33
- * @type {string}
34
- */
35
-export const TYPE_PAGE = 'page';
36
-
37
-/**
38
- * The constant which identifies an event of type "track".
39
- * @type {string}
40
- */
41
-export const TYPE_TRACK = 'track';
42
-
43
-/**
44
- * The constant which identifies an event of type "ui".
45
- * @type {string}
46
- */
47
-export const TYPE_UI = 'ui';
48
-
49
-/**
50
- * The "action" value for Jingle events which indicates that the Jingle session
51
- * was restarted (TODO: verify/fix the documentation)
52
- * @type {string}
53
- */
54
-export const ACTION_JINGLE_RESTART = 'restart';
55
-
56
-/**
57
- * The "action" value for Jingle events which indicates that a session-accept
58
- * timed out (TODO: verify/fix the documentation)
59
- * @type {string}
60
- */
61
-export const ACTION_JINGLE_SA_TIMEOUT = 'session-accept.timeout';
62
-
63
-/**
64
- * The "action" value for Jingle events which indicates that a session-initiate
65
- * was received.
66
- * @type {string}
67
- */
68
-export const ACTION_JINGLE_SI_RECEIVED = 'session-initiate.received';
69
-
70
-/**
71
- * The "action" value for Jingle events which indicates that a session-initiate
72
- * not arrived within a timeout (the value is specified in
73
- * the {@link JingleSessionPC}.
74
- * @type {string}
75
- */
76
-export const ACTION_JINGLE_SI_TIMEOUT = 'session-initiate.timeout';
77
-
78
-/**
79
- * A constant for the "terminate" action for Jingle events. TODO: verify/fix
80
- * the documentation)
81
- * @type {string}
82
- */
83
-export const ACTION_JINGLE_TERMINATE = 'terminate';
84
-
85
-/**
86
- * The "action" value for Jingle events which indicates that a transport-replace
87
- * was received.
88
- * @type {string}
89
- */
90
-export const ACTION_JINGLE_TR_RECEIVED
91
-    = 'transport-replace.received';
92
-
93
-/**
94
- * The "action" value for Jingle events which indicates that a transport-replace
95
- * succeeded (TODO: verify/fix the documentation)
96
- * @type {string}
97
- */
98
-export const ACTION_JINGLE_TR_SUCCESS
99
-    = 'transport-replace.success';
100
-
101
-/**
102
- * The "action" value for P2P events which indicates that P2P session initiate message has been rejected by the client
103
- * because the mandatory requirements were not met.
104
- * @type {string}
105
- */
106
-export const ACTION_P2P_DECLINED = 'decline';
107
-
108
-/**
109
- * The "action" value for P2P events which indicates that a connection was
110
- * established (TODO: verify/fix the documentation)
111
- * @type {string}
112
- */
113
-export const ACTION_P2P_ESTABLISHED = 'established';
114
-
115
-/**
116
- * The "action" value for P2P events which indicates that something failed.
117
- * @type {string}
118
- */
119
-export const ACTION_P2P_FAILED = 'failed';
120
-
121
-/**
122
- * The "action" value for P2P events which indicates that a switch to
123
- * jitsi-videobridge happened.
124
- * @type {string}
125
- */
126
-export const ACTION_P2P_SWITCH_TO_JVB = 'switch.to.jvb';
127
-
128
-/**
129
- * The name of an event which indicates an available device. We send one such
130
- * event per available device once when the available devices are first known,
131
- * and every time that they change
132
- * @type {string}
133
- *
134
- * Properties:
135
- *      audio_input_device_count: the number of audio input devices available at
136
- *          the time the event was sent.
137
- *      audio_output_device_count: the number of audio output devices available
138
- *          at the time the event was sent.
139
- *      video_input_device_count: the number of video input devices available at
140
- *          the time the event was sent.
141
- *      video_output_device_count: the number of video output devices available
142
- *          at the time the event was sent.
143
- *      device_id: an identifier of the device described in this event.
144
- *      device_group_id:
145
- *      device_kind: one of 'audioinput', 'audiooutput', 'videoinput' or
146
- *          'videooutput'.
147
- *      device_label: a string which describes the device.
148
- */
149
-export const AVAILABLE_DEVICE = 'available.device';
150
-
151
-/**
152
- * This appears to be fired only in certain cases when the XMPP connection
153
- * disconnects (and it was intentional?). It is currently never observed to
154
- * fire in production.
155
- *
156
- * TODO: document
157
- *
158
- * Properties:
159
- *      message: an error message
160
- */
161
-export const CONNECTION_DISCONNECTED = 'connection.disconnected';
162
-
163
-/**
164
- * Indicates that the user of the application provided feedback in terms of a
165
- * rating (an integer from 1 to 5) and an optional comment.
166
- * Properties:
167
- *      value: the user's rating (an integer from 1 to 5)
168
- *      comment: the user's comment
169
- */
170
-export const FEEDBACK = 'feedback';
171
-
172
-/**
173
- * Indicates the duration of a particular phase of the ICE connectivity
174
- * establishment.
175
- *
176
- * Properties:
177
- *      phase: the ICE phase (e.g. 'gathering', 'checking', 'establishment')
178
- *      value: the duration in milliseconds.
179
- *      p2p: whether the associated ICE connection is p2p or towards a
180
- *          jitsi-videobridge
181
- *      initiator: whether the local Jingle peer is the initiator or responder
182
- *          in the Jingle session. XXX we probably actually care about the ICE
183
- *          role (controlling vs controlled), and we assume that this correlates
184
- *          with the Jingle initiator.
185
- */
186
-export const ICE_DURATION = 'ice.duration';
187
-
188
-/**
189
- * Indicates the difference in milliseconds between the ICE establishment time
190
- * for the P2P and JVB connections (e.g. a value of 10 would indicate that the
191
- * P2P connection took 10ms more than JVB connection to establish).
192
- *
193
- * Properties:
194
- *      value: the difference in establishment durations in milliseconds.
195
- *
196
- */
197
-export const ICE_ESTABLISHMENT_DURATION_DIFF
198
-    = 'ice.establishment.duration.diff';
199
-
200
-/**
201
- * Indicates that the ICE state has changed.
202
- *
203
- * Properties:
204
- *      state: the ICE state which was entered (e.g. 'checking', 'connected',
205
- *          'completed', etc).
206
- *      value: the time in milliseconds (as reported by
207
- *          window.performance.now()) that the state change occurred.
208
- *      p2p: whether the associated ICE connection is p2p or towards a
209
- *          jitsi-videobridge
210
- *      signalingState: The signaling state of the associated PeerConnection
211
- *      reconnect: whether the associated Jingle session is in the process of
212
- *          reconnecting (or is it ICE? TODO: verify/fix the documentation)
213
- */
214
-export const ICE_STATE_CHANGED = 'ice.state.changed';
215
-
216
-/**
217
- * Indicates that no bytes have been sent for the track.
218
- *
219
- * Properties:
220
- *      mediaType: the media type of the local track ('audio' or 'video').
221
- */
222
-export const NO_BYTES_SENT = 'track.no-bytes-sent';
223
-
224
-/**
225
- * Indicates that a track was unmuted (?).
226
- *
227
- * Properties:
228
- *      mediaType: the media type of the local track ('audio' or 'video').
229
- *      trackType: the type of the track ('local' or 'remote').
230
- *      value: TODO: document
231
- */
232
-export const TRACK_UNMUTED = 'track.unmuted';
233
-
234
-/**
235
- * Creates an operational event which indicates that we have received a
236
- * "bridge down" event from jicofo.
237
- */
238
-export const createBridgeDownEvent = function() {
239
-    const bridgeDown = 'bridge.down';
240
-
241
-    return {
242
-        action: bridgeDown,
243
-        actionSubject: bridgeDown,
244
-        type: TYPE_OPERATIONAL
245
-    };
246
-};
247
-
248
-/**
249
- * Creates an event which indicates that the XMPP connection failed
250
- * @param errorType TODO
251
- * @param errorMessage TODO
252
- * @param detail connection failed details.
253
- */
254
-export const createConnectionFailedEvent
255
-    = function(errorType, errorMessage, details) {
256
-        return {
257
-            type: TYPE_OPERATIONAL,
258
-            action: 'connection.failed',
259
-            attributes: {
260
-                'error_type': errorType,
261
-                'error_message': errorMessage,
262
-                ...details
263
-            }
264
-        };
265
-    };
266
-
267
-/**
268
- * Creates a conference event.
269
- *
270
- * @param {string} action - The action of the event.
271
- * @param {Object} attributes - The attributes to be added to the event.
272
- * @returns {{type: string, source: string, action: string, attributes: object}}
273
- */
274
-export function createConferenceEvent(action, attributes) {
275
-    return {
276
-        action,
277
-        attributes,
278
-        source: 'conference',
279
-        type: TYPE_OPERATIONAL
280
-    };
281
-}
282
-
283
-/**
284
- * Creates an operational event which indicates that a particular connection
285
- * stage was reached (i.e. the XMPP connection transitioned to the "connected"
286
- * state).
287
- *
288
- * @param stage the stage which was reached
289
- * @param attributes additional attributes for the event. This should be an
290
- * object with a "value" property indicating a timestamp in milliseconds
291
- * relative to the beginning of the document's lifetime.
292
- *
293
- */
294
-export const createConnectionStageReachedEvent = function(stage, attributes) {
295
-    const action = 'connection.stage.reached';
296
-
297
-    return {
298
-        action,
299
-        actionSubject: stage,
300
-        attributes,
301
-        source: action,
302
-        type: TYPE_OPERATIONAL
303
-    };
304
-};
305
-
306
-/**
307
- * Creates an operational event for the end-to-end round trip time to a
308
- * specific remote participant.
309
- * @param participantId the ID of the remote participant.
310
- * @param region the region of the remote participant
311
- * @param rtt the rtt
312
- */
313
-export const createE2eRttEvent = function(participantId, region, rtt) {
314
-    const attributes = {
315
-        'participant_id': participantId,
316
-        region,
317
-        rtt
318
-    };
319
-
320
-    return {
321
-        attributes,
322
-        name: 'e2e_rtt',
323
-        type: TYPE_OPERATIONAL
324
-    };
325
-};
326
-
327
-/**
328
- * Creates an event which indicates that the focus has left the MUC.
329
- */
330
-export const createFocusLeftEvent = function() {
331
-    const action = 'focus.left';
332
-
333
-    return {
334
-        action,
335
-        actionSubject: action,
336
-        type: TYPE_OPERATIONAL
337
-    };
338
-};
339
-
340
-/**
341
- * Creates an event related to a getUserMedia call.
342
- *
343
- * @param action the type of the result that the event represents: 'error',
344
- * 'success', 'warning', etc.
345
- * @param attributes the attributes to attach to the event.
346
- * @returns {{type: string, source: string, name: string}}
347
- */
348
-export const createGetUserMediaEvent = function(action, attributes = {}) {
349
-    return {
350
-        type: TYPE_OPERATIONAL,
351
-        source: 'get.user.media',
352
-        action,
353
-        attributes
354
-    };
355
-};
356
-
357
-/**
358
- * Creates an event related to remote participant connection status changes.
359
- *
360
- * @param attributes the attributes to attach to the event.
361
- * @returns {{type: string, source: string, name: string}}
362
- */
363
-export const createParticipantConnectionStatusEvent = function(attributes = {}) {
364
-    const action = 'duration';
365
-
366
-    return {
367
-        type: TYPE_OPERATIONAL,
368
-        source: 'peer.conn.status',
369
-        action,
370
-        attributes
371
-    };
372
-};
373
-
374
-/**
375
- * Creates an event related to remote track streaming status changes.
376
- *
377
- * @param attributes the attributes to attach to the event.
378
- * @returns {{type: string, source: string, name: string}}
379
- */
380
-export const createTrackStreamingStatusEvent = function(attributes = {}) {
381
-    const action = 'duration';
382
-
383
-    return {
384
-        type: TYPE_OPERATIONAL,
385
-        source: 'track.streaming.status',
386
-        action,
387
-        attributes
388
-    };
389
-};
390
-
391
-/**
392
- * Creates an event for a Jingle-related event.
393
- * @param action the action of the event
394
- * @param attributes attributes to add to the event.
395
- */
396
-export const createJingleEvent = function(action, attributes = {}) {
397
-    return {
398
-        type: TYPE_OPERATIONAL,
399
-        action,
400
-        source: 'jingle',
401
-        attributes
402
-    };
403
-};
404
-
405
-/**
406
- * Creates an event which indicates that a local track was not able to read
407
- * data from its source (a camera or a microphone).
408
- *
409
- * @param mediaType {String} the media type of the local track ('audio' or
410
- * 'video').
411
- */
412
-export const createNoDataFromSourceEvent = function(mediaType, value) {
413
-    return {
414
-        attributes: {
415
-            'media_type': mediaType,
416
-            value
417
-        },
418
-        action: 'track.no.data.from.source',
419
-        type: TYPE_OPERATIONAL
420
-    };
421
-};
422
-
423
-/**
424
- * Creates an event for a p2p-related event.
425
- * @param action the action of the event
426
- * @param attributes attributes to add to the event.
427
- */
428
-export const createP2PEvent = function(action, attributes = {}) {
429
-    return {
430
-        type: TYPE_OPERATIONAL,
431
-        action,
432
-        source: 'p2p',
433
-        attributes
434
-    };
435
-};
436
-
437
-/**
438
- * Indicates that we received a remote command to mute.
439
- */
440
-export const createRemotelyMutedEvent = function(mediaType) {
441
-    return {
442
-        type: TYPE_OPERATIONAL,
443
-        action: 'remotely.muted',
444
-        mediaType
445
-    };
446
-};
447
-
448
-/**
449
- * Creates an event which contains RTP statistics such as RTT and packet loss.
450
- *
451
- * All average RTP stats are currently reported under 1 event name, but with
452
- * different properties that allows to distinguish between a P2P call, a
453
- * call relayed through TURN or the JVB, and multiparty vs 1:1.
454
- *
455
- * The structure of the event is:
456
- *
457
- * {
458
- *      p2p: true,
459
- *      conferenceSize: 2,
460
- *      localCandidateType: "relay",
461
- *      remoteCandidateType: "relay",
462
- *      transportType: "udp",
463
- *
464
- *      // Average RTT of 200ms
465
- *      "rtt.avg": 200,
466
- *      "rtt.samples": "[100, 200, 300]",
467
- *
468
- *      // Average packet loss of 10%
469
- *      "packet.loss.avg": 10,
470
- *      "packet.loss.samples": '[5, 10, 15]'
471
- *
472
- *      // Difference in milliseconds in the end-to-end RTT between p2p and jvb.
473
- *      // The e2e RTT through jvb is 15ms shorter:
474
- *      "rtt.diff": 15,
475
- *
476
- *      // End-to-end RTT through JVB is ms.
477
- *      "end2end.rtt.avg" = 100
478
- * }
479
- *
480
- * Note that the value of the "samples" properties are (JSON encoded) strings,
481
- * and not JSON arrays, as events' attributes can not be nested. The samples are
482
- * currently included for debug purposes only and can be removed anytime soon
483
- * from the structure.
484
- *
485
- * Also note that not all of values are present in each event, as values are
486
- * obtained and calculated as part of different process/event pipe. For example
487
- * {@link ConnectionAvgStats} instances are doing the reports for each
488
- * {@link TraceablePeerConnection} and work independently from the main stats
489
- * pipe.
490
- */
491
-export const createRtpStatsEvent = function(attributes) {
492
-    return {
493
-        type: TYPE_OPERATIONAL,
494
-        action: 'rtp.stats',
495
-        attributes
496
-    };
497
-};
498
-
499
-/**
500
- * Creates an event which contains the round trip time (RTT) to a set of
501
- * regions.
502
- *
503
- * @param attributes
504
- * @returns {{type: string, action: string, attributes: *}}
505
- */
506
-export const createRttByRegionEvent = function(attributes) {
507
-    return {
508
-        type: TYPE_OPERATIONAL,
509
-        action: 'rtt.by.region',
510
-        attributes
511
-    };
512
-};
513
-
514
-/**
515
- * Creates an event which contains the local and remote ICE candidate types
516
- * for the transport that is currently selected.
517
- *
518
- * @param attributes
519
- * @returns {{type: string, action: string, attributes: *}}
520
- */
521
-export const createTransportStatsEvent = function(attributes) {
522
-    return {
523
-        type: TYPE_OPERATIONAL,
524
-        action: 'transport.stats',
525
-        attributes
526
-    };
527
-};
528
-
529
-/**
530
- * Creates an event which contains information about the audio output problem (the user id of the affected participant,
531
- * the local audio levels and the remote audio levels that triggered the event).
532
- *
533
- * @param {string} userID - The user id of the affected participant.
534
- * @param {*} localAudioLevels - The local audio levels.
535
- * @param {*} remoteAudioLevels - The audio levels received from the participant.
536
- */
537
-export function createAudioOutputProblemEvent(userID, localAudioLevels, remoteAudioLevels) {
538
-    return {
539
-        type: TYPE_OPERATIONAL,
540
-        action: 'audio.output.problem',
541
-        attributes: {
542
-            userID,
543
-            localAudioLevels,
544
-            remoteAudioLevels
545
-        }
546
-    };
547
-}
548
-
549
-/**
550
- * Creates an event which contains an information related to the bridge channel close event.
551
- *
552
- * @param {string} code - A code from {@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}
553
- * @param {string} reason - A string which describes the reason for closing the bridge channel.
554
- * @returns {{type: string, action: string, attributes: { code: string, reason: string }}}
555
- */
556
-export const createBridgeChannelClosedEvent = function(code, reason) {
557
-    return {
558
-        type: TYPE_OPERATIONAL,
559
-        action: 'bridge-channel.error',
560
-        attributes: {
561
-            code,
562
-            reason
563
-        }
564
-    };
565
-};
566
-
567
-/**
568
- * Creates an event which indicates the Time To First Media (TTFM).
569
- * It is measured in milliseconds relative to the beginning of the document's
570
- * lifetime (i.e. the origin used by window.performance.now()), and it excludes
571
- * the following:
572
- * 1. The delay due to getUserMedia()
573
- * 2. The period between the MUC being joined and the reception of the Jingle
574
- * session-initiate from jicofo. This is because jicofo will not start a Jingle
575
- * session until there are at least 2 participants in the room.
576
- *
577
- * @param attributes the attributes to add to the event. Currently used fields:
578
- *      mediaType: the media type of the local track ('audio' or 'video').
579
- *      muted: whether the track has ever been muted (?)
580
- *      value: the TTMF in milliseconds.
581
- */
582
-export const createTtfmEvent = function(attributes) {
583
-    return createConnectionStageReachedEvent('ttfm', attributes);
584
-};

+ 29
- 2
service/statistics/AnalyticsEvents.spec.ts Visa fil

@@ -46,9 +46,9 @@ describe( "/service/statistics/AnalyticsEvents members", () => {
46 46
         createAudioOutputProblemEvent,
47 47
         createBridgeChannelClosedEvent,
48 48
         createTtfmEvent,
49
-        /*AnalyticsEvents,*/
49
+        AnalyticsEvents,
50 50
         ...others
51
-    } = exported as any; // TODO: remove cast after typescript conversion
51
+    } = exported;
52 52
 
53 53
     it( "known members", () => {
54 54
         expect( TYPE_OPERATIONAL ).toBe( 'operational' );
@@ -74,6 +74,33 @@ describe( "/service/statistics/AnalyticsEvents members", () => {
74 74
         expect( ICE_STATE_CHANGED ).toBe( 'ice.state.changed' );
75 75
         expect( NO_BYTES_SENT ).toBe( 'track.no-bytes-sent' );
76 76
         expect( TRACK_UNMUTED ).toBe( 'track.unmuted' );
77
+
78
+        expect( AnalyticsEvents ).toBeDefined();
79
+
80
+        expect( AnalyticsEvents.TYPE_OPERATIONAL ).toBe( 'operational' );
81
+        expect( AnalyticsEvents.TYPE_PAGE ).toBe( 'page' );
82
+        expect( AnalyticsEvents.TYPE_TRACK ).toBe( 'track' );
83
+        expect( AnalyticsEvents.TYPE_UI ).toBe( 'ui' );
84
+        expect( AnalyticsEvents.ACTION_JINGLE_RESTART ).toBe( 'restart' );
85
+        expect( AnalyticsEvents.ACTION_JINGLE_SA_TIMEOUT ).toBe( 'session-accept.timeout' );
86
+        expect( AnalyticsEvents.ACTION_JINGLE_SI_RECEIVED ).toBe( 'session-initiate.received' );
87
+        expect( AnalyticsEvents.ACTION_JINGLE_SI_TIMEOUT ).toBe( 'session-initiate.timeout' );
88
+        expect( AnalyticsEvents.ACTION_JINGLE_TERMINATE ).toBe( 'terminate' );
89
+        expect( AnalyticsEvents.ACTION_JINGLE_TR_RECEIVED ).toBe( 'transport-replace.received' );
90
+        expect( AnalyticsEvents.ACTION_JINGLE_TR_SUCCESS ).toBe( 'transport-replace.success' );
91
+        expect( AnalyticsEvents.ACTION_P2P_DECLINED ).toBe( 'decline' );
92
+        expect( AnalyticsEvents.ACTION_P2P_ESTABLISHED ).toBe( 'established' );
93
+        expect( AnalyticsEvents.ACTION_P2P_FAILED ).toBe( 'failed' );
94
+        expect( AnalyticsEvents.ACTION_P2P_SWITCH_TO_JVB ).toBe( 'switch.to.jvb' );
95
+        expect( AnalyticsEvents.AVAILABLE_DEVICE ).toBe( 'available.device' );
96
+        expect( AnalyticsEvents.CONNECTION_DISCONNECTED ).toBe( 'connection.disconnected' );
97
+        expect( AnalyticsEvents.FEEDBACK ).toBe( 'feedback' );
98
+        expect( AnalyticsEvents.ICE_DURATION ).toBe( 'ice.duration' );
99
+        expect( AnalyticsEvents.ICE_ESTABLISHMENT_DURATION_DIFF ).toBe( 'ice.establishment.duration.diff' );
100
+        expect( AnalyticsEvents.ICE_STATE_CHANGED ).toBe( 'ice.state.changed' );
101
+        expect( AnalyticsEvents.NO_BYTES_SENT ).toBe( 'track.no-bytes-sent' );
102
+        expect( AnalyticsEvents.TRACK_UNMUTED ).toBe( 'track.unmuted' );
103
+
77 104
         expect( typeof ( createBridgeDownEvent ) ).toBe( 'function' );
78 105
         expect( typeof ( createConnectionFailedEvent ) ).toBe( 'function' );
79 106
         expect( typeof ( createConferenceEvent ) ).toBe( 'function' );

+ 534
- 0
service/statistics/AnalyticsEvents.ts Visa fil

@@ -0,0 +1,534 @@
1
+/**
2
+ * This class exports constants and factory methods related to the analytics
3
+ * API provided by AnalyticsAdapter. In order for entries in a database to be
4
+ * somewhat easily traceable back to the code which produced them, events sent
5
+ * through analytics should be defined here.
6
+ *
7
+ * Since the AnalyticsAdapter API can be used in different ways, for some events
8
+ * it is more convenient to just define the event name as a constant. For other
9
+ * events a factory function is easier.
10
+ *
11
+ * A general approach for adding a new event:
12
+ * 1. Determine the event type: track, UI, page, or operational. If in doubt use
13
+ * operational.
14
+ * 2. Determine whether the event is related to other existing events, and
15
+ * which fields are desired to be set: name, action, actionSubject, source.
16
+ * 3. If the name is sufficient (the other fields are not important), use a
17
+ * constant. Otherwise use a factory function.
18
+ *
19
+ * Note that the AnalyticsAdapter uses the events passed to its functions for
20
+ * its own purposes, and might modify them. Because of this, factory functions
21
+ * should create new objects.
22
+ *
23
+ */
24
+
25
+export enum AnalyticsEvents {
26
+    /**
27
+     * The constant which identifies an event of type "operational".
28
+     */
29
+    TYPE_OPERATIONAL = 'operational',
30
+
31
+    /**
32
+     * The constant which identifies an event of type "page".
33
+     */
34
+    TYPE_PAGE = 'page',
35
+
36
+    /**
37
+     * The constant which identifies an event of type "track".
38
+     */
39
+    TYPE_TRACK = 'track',
40
+
41
+    /**
42
+     * The constant which identifies an event of type "ui".
43
+     */
44
+    TYPE_UI = 'ui',
45
+
46
+    /**
47
+     * The "action" value for Jingle events which indicates that the Jingle session
48
+     * was restarted (TODO: verify/fix the documentation)
49
+     */
50
+    ACTION_JINGLE_RESTART = 'restart',
51
+
52
+    /**
53
+     * The "action" value for Jingle events which indicates that a session-accept
54
+     * timed out (TODO: verify/fix the documentation)
55
+     */
56
+    ACTION_JINGLE_SA_TIMEOUT = 'session-accept.timeout',
57
+
58
+    /**
59
+     * The "action" value for Jingle events which indicates that a session-initiate
60
+     * was received.
61
+     */
62
+    ACTION_JINGLE_SI_RECEIVED = 'session-initiate.received',
63
+
64
+    /**
65
+     * The "action" value for Jingle events which indicates that a session-initiate
66
+     * not arrived within a timeout (the value is specified in
67
+     * the {@link JingleSessionPC}.
68
+     */
69
+    ACTION_JINGLE_SI_TIMEOUT = 'session-initiate.timeout',
70
+
71
+    /**
72
+     * A constant for the "terminate" action for Jingle events. TODO: verify/fix
73
+     * the documentation)
74
+     */
75
+    ACTION_JINGLE_TERMINATE = 'terminate',
76
+
77
+    /**
78
+     * The "action" value for Jingle events which indicates that a transport-replace
79
+     * was received.
80
+     */
81
+    ACTION_JINGLE_TR_RECEIVED = 'transport-replace.received',
82
+
83
+    /**
84
+     * The "action" value for Jingle events which indicates that a transport-replace
85
+     * succeeded (TODO: verify/fix the documentation)
86
+     */
87
+    ACTION_JINGLE_TR_SUCCESS = 'transport-replace.success',
88
+
89
+    /**
90
+     * The "action" value for P2P events which indicates that P2P session initiate message has been rejected by the client
91
+     * because the mandatory requirements were not met.
92
+     */
93
+    ACTION_P2P_DECLINED = 'decline',
94
+
95
+    /**
96
+     * The "action" value for P2P events which indicates that a connection was
97
+     * established (TODO: verify/fix the documentation)
98
+     */
99
+    ACTION_P2P_ESTABLISHED = 'established',
100
+
101
+    /**
102
+     * The "action" value for P2P events which indicates that something failed.
103
+     */
104
+    ACTION_P2P_FAILED = 'failed',
105
+
106
+    /**
107
+     * The "action" value for P2P events which indicates that a switch to
108
+     * jitsi-videobridge happened.
109
+     */
110
+    ACTION_P2P_SWITCH_TO_JVB = 'switch.to.jvb',
111
+
112
+    /**
113
+     * The name of an event which indicates an available device. We send one such
114
+     * event per available device once when the available devices are first known,
115
+     * and every time that they change
116
+     *
117
+     * Properties:
118
+     *      audio_input_device_count: the number of audio input devices available at
119
+     *          the time the event was sent.
120
+     *      audio_output_device_count: the number of audio output devices available
121
+     *          at the time the event was sent.
122
+     *      video_input_device_count: the number of video input devices available at
123
+     *          the time the event was sent.
124
+     *      video_output_device_count: the number of video output devices available
125
+     *          at the time the event was sent.
126
+     *      device_id: an identifier of the device described in this event.
127
+     *      device_group_id:
128
+     *      device_kind: one of 'audioinput', 'audiooutput', 'videoinput' or
129
+     *          'videooutput'.
130
+     *      device_label: a string which describes the device.
131
+     */
132
+    AVAILABLE_DEVICE = 'available.device',
133
+
134
+    /**
135
+     * This appears to be fired only in certain cases when the XMPP connection
136
+     * disconnects (and it was intentional?). It is currently never observed to
137
+     * fire in production.
138
+     *
139
+     * TODO: document
140
+     *
141
+     * Properties:
142
+     *      message: an error message
143
+     */
144
+    CONNECTION_DISCONNECTED = 'connection.disconnected',
145
+
146
+    /**
147
+     * Indicates that the user of the application provided feedback in terms of a
148
+     * rating (an integer from 1 to 5) and an optional comment.
149
+     * Properties:
150
+     *      value: the user's rating (an integer from 1 to 5)
151
+     *      comment: the user's comment
152
+     */
153
+    FEEDBACK = 'feedback',
154
+
155
+    /**
156
+     * Indicates the duration of a particular phase of the ICE connectivity
157
+     * establishment.
158
+     *
159
+     * Properties:
160
+     *      phase: the ICE phase (e.g. 'gathering', 'checking', 'establishment')
161
+     *      value: the duration in milliseconds.
162
+     *      p2p: whether the associated ICE connection is p2p or towards a
163
+     *          jitsi-videobridge
164
+     *      initiator: whether the local Jingle peer is the initiator or responder
165
+     *          in the Jingle session. XXX we probably actually care about the ICE
166
+     *          role (controlling vs controlled), and we assume that this correlates
167
+     *          with the Jingle initiator.
168
+     */
169
+    ICE_DURATION = 'ice.duration',
170
+
171
+    /**
172
+     * Indicates the difference in milliseconds between the ICE establishment time
173
+     * for the P2P and JVB connections (e.g. a value of 10 would indicate that the
174
+     * P2P connection took 10ms more than JVB connection to establish).
175
+     *
176
+     * Properties:
177
+     *      value: the difference in establishment durations in milliseconds.
178
+     *
179
+     */
180
+    ICE_ESTABLISHMENT_DURATION_DIFF = 'ice.establishment.duration.diff',
181
+
182
+    /**
183
+     * Indicates that the ICE state has changed.
184
+     *
185
+     * Properties:
186
+     *      state: the ICE state which was entered (e.g. 'checking', 'connected',
187
+     *          'completed', etc).
188
+     *      value: the time in milliseconds (as reported by
189
+     *          window.performance.now()) that the state change occurred.
190
+     *      p2p: whether the associated ICE connection is p2p or towards a
191
+     *          jitsi-videobridge
192
+     *      signalingState: The signaling state of the associated PeerConnection
193
+     *      reconnect: whether the associated Jingle session is in the process of
194
+     *          reconnecting (or is it ICE? TODO: verify/fix the documentation)
195
+     */
196
+    ICE_STATE_CHANGED = 'ice.state.changed',
197
+
198
+    /**
199
+     * Indicates that no bytes have been sent for the track.
200
+     *
201
+     * Properties:
202
+     *      mediaType: the media type of the local track ('audio' or 'video').
203
+     */
204
+    NO_BYTES_SENT = 'track.no-bytes-sent',
205
+
206
+    /**
207
+     * Indicates that a track was unmuted (?).
208
+     *
209
+     * Properties:
210
+     *      mediaType: the media type of the local track ('audio' or 'video').
211
+     *      trackType: the type of the track ('local' or 'remote').
212
+     *      value: TODO: document
213
+     */
214
+    TRACK_UNMUTED = 'track.unmuted'
215
+}
216
+
217
+// exported for backward compatibility
218
+export const TYPE_OPERATIONAL = AnalyticsEvents.TYPE_OPERATIONAL;
219
+export const TYPE_PAGE = AnalyticsEvents.TYPE_PAGE;
220
+export const TYPE_TRACK = AnalyticsEvents.TYPE_TRACK;
221
+export const TYPE_UI = AnalyticsEvents.TYPE_UI;
222
+export const ACTION_JINGLE_RESTART = AnalyticsEvents.ACTION_JINGLE_RESTART;
223
+export const ACTION_JINGLE_SA_TIMEOUT = AnalyticsEvents.ACTION_JINGLE_SA_TIMEOUT;
224
+export const ACTION_JINGLE_SI_RECEIVED = AnalyticsEvents.ACTION_JINGLE_SI_RECEIVED;
225
+export const ACTION_JINGLE_SI_TIMEOUT = AnalyticsEvents.ACTION_JINGLE_SI_TIMEOUT;
226
+export const ACTION_JINGLE_TERMINATE = AnalyticsEvents.ACTION_JINGLE_TERMINATE;
227
+export const ACTION_JINGLE_TR_RECEIVED = AnalyticsEvents.ACTION_JINGLE_TR_RECEIVED;
228
+export const ACTION_JINGLE_TR_SUCCESS = AnalyticsEvents.ACTION_JINGLE_TR_SUCCESS;
229
+export const ACTION_P2P_DECLINED = AnalyticsEvents.ACTION_P2P_DECLINED;
230
+export const ACTION_P2P_ESTABLISHED = AnalyticsEvents.ACTION_P2P_ESTABLISHED;
231
+export const ACTION_P2P_FAILED = AnalyticsEvents.ACTION_P2P_FAILED;
232
+export const ACTION_P2P_SWITCH_TO_JVB = AnalyticsEvents.ACTION_P2P_SWITCH_TO_JVB;
233
+export const AVAILABLE_DEVICE = AnalyticsEvents.AVAILABLE_DEVICE;
234
+export const CONNECTION_DISCONNECTED = AnalyticsEvents.CONNECTION_DISCONNECTED;
235
+export const FEEDBACK = AnalyticsEvents.FEEDBACK;
236
+export const ICE_DURATION = AnalyticsEvents.ICE_DURATION;
237
+export const ICE_ESTABLISHMENT_DURATION_DIFF = AnalyticsEvents.ICE_ESTABLISHMENT_DURATION_DIFF;
238
+export const ICE_STATE_CHANGED = AnalyticsEvents.ICE_STATE_CHANGED;
239
+export const NO_BYTES_SENT = AnalyticsEvents.NO_BYTES_SENT;
240
+export const TRACK_UNMUTED = AnalyticsEvents.TRACK_UNMUTED;
241
+
242
+/**
243
+ * Creates an operational event which indicates that we have received a
244
+ * "bridge down" event from jicofo.
245
+ */
246
+export const createBridgeDownEvent = () => ( {
247
+    action: 'bridge.down',
248
+    actionSubject: 'bridge.down',
249
+    type: TYPE_OPERATIONAL
250
+} );
251
+
252
+/**
253
+ * Creates an event which indicates that the XMPP connection failed
254
+ * @param errorType TODO
255
+ * @param errorMessage TODO
256
+ * @param detail connection failed details.
257
+ */
258
+export const createConnectionFailedEvent = ( errorType: unknown, errorMessage: unknown, details: object ) => ( {
259
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
260
+    action: 'connection.failed',
261
+    attributes: {
262
+        'error_type': errorType,
263
+        'error_message': errorMessage,
264
+        ...details
265
+    }
266
+} );
267
+
268
+/**
269
+ * Creates a conference event.
270
+ *
271
+ * @param action - The action of the event.
272
+ * @param attributes - The attributes to be added to the event.
273
+ */
274
+export const createConferenceEvent = ( action: string, attributes: object ) => ( {
275
+    action,
276
+    attributes,
277
+    source: 'conference',
278
+    type: AnalyticsEvents.TYPE_OPERATIONAL
279
+} );
280
+
281
+/**
282
+ * Creates an operational event which indicates that a particular connection
283
+ * stage was reached (i.e. the XMPP connection transitioned to the "connected"
284
+ * state).
285
+ *
286
+ * @param stage the stage which was reached
287
+ * @param attributes additional attributes for the event. This should be an
288
+ * object with a "value" property indicating a timestamp in milliseconds
289
+ * relative to the beginning of the document's lifetime.
290
+ *
291
+ */
292
+export const createConnectionStageReachedEvent = ( stage: unknown, attributes: object ) => ( {
293
+    action: 'connection.stage.reached',
294
+    actionSubject: stage,
295
+    attributes,
296
+    source: 'connection.stage.reached',
297
+    type: AnalyticsEvents.TYPE_OPERATIONAL
298
+} );
299
+
300
+/**
301
+ * Creates an operational event for the end-to-end round trip time to a
302
+ * specific remote participant.
303
+ * @param participantId the ID of the remote participant.
304
+ * @param region the region of the remote participant
305
+ * @param rtt the rtt
306
+ */
307
+export const createE2eRttEvent = ( participantId: unknown, region: unknown, rtt: unknown ) => ( {
308
+    attributes: {
309
+        'participant_id': participantId,
310
+        region,
311
+        rtt
312
+    },
313
+    name: 'e2e_rtt',
314
+    type: AnalyticsEvents.TYPE_OPERATIONAL
315
+} );
316
+
317
+/**
318
+ * Creates an event which indicates that the focus has left the MUC.
319
+ */
320
+export const createFocusLeftEvent = () => ( {
321
+    action: 'focus.left',
322
+    actionSubject: 'focus.left',
323
+    type: AnalyticsEvents.TYPE_OPERATIONAL
324
+} );
325
+
326
+/**
327
+ * Creates an event related to a getUserMedia call.
328
+ *
329
+ * @param action the type of the result that the event represents: 'error',
330
+ * 'success', 'warning', etc.
331
+ * @param attributes the attributes to attach to the event.
332
+ */
333
+export const createGetUserMediaEvent = ( action: 'error' | 'success' | 'warning' | string, attributes: object = {} ) => ( {
334
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
335
+    source: 'get.user.media',
336
+    action,
337
+    attributes
338
+} );
339
+
340
+/**
341
+ * Creates an event related to remote participant connection status changes.
342
+ *
343
+ * @param attributes the attributes to attach to the event.
344
+ */
345
+export const createParticipantConnectionStatusEvent = ( attributes: object = {} ) => ( {
346
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
347
+    source: 'peer.conn.status',
348
+    action: 'duration',
349
+    attributes
350
+} );
351
+
352
+/**
353
+ * Creates an event related to remote track streaming status changes.
354
+ *
355
+ * @param attributes the attributes to attach to the event.
356
+ */
357
+export const createTrackStreamingStatusEvent = ( attributes: object = {} ) => ( {
358
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
359
+    source: 'track.streaming.status',
360
+    action: 'duration',
361
+    attributes
362
+} );
363
+
364
+/**
365
+ * Creates an event for a Jingle-related event.
366
+ * @param action the action of the event
367
+ * @param attributes attributes to add to the event.
368
+ */
369
+export const createJingleEvent = ( action: unknown, attributes: object = {} ) => ( {
370
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
371
+    action,
372
+    source: 'jingle',
373
+    attributes
374
+} );
375
+
376
+/**
377
+ * Creates an event which indicates that a local track was not able to read
378
+ * data from its source (a camera or a microphone).
379
+ *
380
+ * @param mediaType the media type of the local track ('audio' or
381
+ * 'video').
382
+ */
383
+export const createNoDataFromSourceEvent = ( mediaType: 'audio' | 'video' | string, value: unknown ) => ( {
384
+    attributes: {
385
+        'media_type': mediaType,
386
+        value
387
+    },
388
+    action: 'track.no.data.from.source',
389
+    type: AnalyticsEvents.TYPE_OPERATIONAL
390
+} );
391
+
392
+/**
393
+ * Creates an event for a p2p-related event.
394
+ * @param action the action of the event
395
+ * @param attributes attributes to add to the event.
396
+ */
397
+export const createP2PEvent = ( action: unknown, attributes: object = {} ) => ( {
398
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
399
+    action,
400
+    source: 'p2p',
401
+    attributes
402
+} )
403
+
404
+/**
405
+ * Indicates that we received a remote command to mute.
406
+ */
407
+export const createRemotelyMutedEvent = ( mediaType: unknown ) => ( {
408
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
409
+    action: 'remotely.muted',
410
+    mediaType
411
+} );
412
+
413
+/**
414
+ * Creates an event which contains RTP statistics such as RTT and packet loss.
415
+ *
416
+ * All average RTP stats are currently reported under 1 event name, but with
417
+ * different properties that allows to distinguish between a P2P call, a
418
+ * call relayed through TURN or the JVB, and multiparty vs 1:1.
419
+ *
420
+ * The structure of the event is:
421
+ *
422
+ * {
423
+ *      p2p: true,
424
+ *      conferenceSize: 2,
425
+ *      localCandidateType: "relay",
426
+ *      remoteCandidateType: "relay",
427
+ *      transportType: "udp",
428
+ *
429
+ *      // Average RTT of 200ms
430
+ *      "rtt.avg": 200,
431
+ *      "rtt.samples": "[100, 200, 300]",
432
+ *
433
+ *      // Average packet loss of 10%
434
+ *      "packet.loss.avg": 10,
435
+ *      "packet.loss.samples": '[5, 10, 15]'
436
+ *
437
+ *      // Difference in milliseconds in the end-to-end RTT between p2p and jvb.
438
+ *      // The e2e RTT through jvb is 15ms shorter:
439
+ *      "rtt.diff": 15,
440
+ *
441
+ *      // End-to-end RTT through JVB is ms.
442
+ *      "end2end.rtt.avg" = 100
443
+ * }
444
+ *
445
+ * Note that the value of the "samples" properties are (JSON encoded) strings,
446
+ * and not JSON arrays, as events' attributes can not be nested. The samples are
447
+ * currently included for debug purposes only and can be removed anytime soon
448
+ * from the structure.
449
+ *
450
+ * Also note that not all of values are present in each event, as values are
451
+ * obtained and calculated as part of different process/event pipe. For example
452
+ * {@link ConnectionAvgStats} instances are doing the reports for each
453
+ * {@link TraceablePeerConnection} and work independently from the main stats
454
+ * pipe.
455
+ */
456
+export const createRtpStatsEvent = ( attributes: object ) => ( {
457
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
458
+    action: 'rtp.stats',
459
+    attributes
460
+} );
461
+
462
+/**
463
+ * Creates an event which contains the round trip time (RTT) to a set of
464
+ * regions.
465
+ *
466
+ * @param attributes
467
+ */
468
+export const createRttByRegionEvent = ( attributes: object ) => ( {
469
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
470
+    action: 'rtt.by.region',
471
+    attributes
472
+} );
473
+
474
+/**
475
+ * Creates an event which contains the local and remote ICE candidate types
476
+ * for the transport that is currently selected.
477
+ *
478
+ * @param attributes
479
+ */
480
+export const createTransportStatsEvent = ( attributes: object ) => ( {
481
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
482
+    action: 'transport.stats',
483
+    attributes
484
+} );
485
+
486
+/**
487
+ * Creates an event which contains information about the audio output problem (the user id of the affected participant,
488
+ * the local audio levels and the remote audio levels that triggered the event).
489
+ *
490
+ * @param userID - The user id of the affected participant.
491
+ * @param localAudioLevels - The local audio levels.
492
+ * @param remoteAudioLevels - The audio levels received from the participant.
493
+ */
494
+export const createAudioOutputProblemEvent = ( userID: string, localAudioLevels: unknown, remoteAudioLevels: unknown ) => ( {
495
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
496
+    action: 'audio.output.problem',
497
+    attributes: {
498
+        userID,
499
+        localAudioLevels,
500
+        remoteAudioLevels
501
+    }
502
+} );
503
+
504
+/**
505
+ * Creates an event which contains an information related to the bridge channel close event.
506
+ *
507
+ * @param code - A code from {@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}
508
+ * @param reason - A string which describes the reason for closing the bridge channel.
509
+ */
510
+export const createBridgeChannelClosedEvent = ( code: string, reason: string ) => ( {
511
+    type: AnalyticsEvents.TYPE_OPERATIONAL,
512
+    action: 'bridge-channel.error',
513
+    attributes: {
514
+        code,
515
+        reason
516
+    }
517
+} );
518
+
519
+/**
520
+ * Creates an event which indicates the Time To First Media (TTFM).
521
+ * It is measured in milliseconds relative to the beginning of the document's
522
+ * lifetime (i.e. the origin used by window.performance.now()), and it excludes
523
+ * the following:
524
+ * 1. The delay due to getUserMedia()
525
+ * 2. The period between the MUC being joined and the reception of the Jingle
526
+ * session-initiate from jicofo. This is because jicofo will not start a Jingle
527
+ * session until there are at least 2 participants in the room.
528
+ *
529
+ * @param attributes the attributes to add to the event. Currently used fields:
530
+ *      mediaType: the media type of the local track ('audio' or 'video').
531
+ *      muted: whether the track has ever been muted (?)
532
+ *      value: the TTMF in milliseconds.
533
+ */
534
+export const createTtfmEvent = ( attributes: object ) => createConnectionStageReachedEvent( 'ttfm', attributes );

+ 416
- 258
types/auto/service/statistics/AnalyticsEvents.d.ts Visa fil

@@ -1,33 +1,3 @@
1
-/**
2
- * Creates a conference event.
3
- *
4
- * @param {string} action - The action of the event.
5
- * @param {Object} attributes - The attributes to be added to the event.
6
- * @returns {{type: string, source: string, action: string, attributes: object}}
7
- */
8
-export function createConferenceEvent(action: string, attributes: any): {
9
-    type: string;
10
-    source: string;
11
-    action: string;
12
-    attributes: object;
13
-};
14
-/**
15
- * Creates an event which contains information about the audio output problem (the user id of the affected participant,
16
- * the local audio levels and the remote audio levels that triggered the event).
17
- *
18
- * @param {string} userID - The user id of the affected participant.
19
- * @param {*} localAudioLevels - The local audio levels.
20
- * @param {*} remoteAudioLevels - The audio levels received from the participant.
21
- */
22
-export function createAudioOutputProblemEvent(userID: string, localAudioLevels: any, remoteAudioLevels: any): {
23
-    type: string;
24
-    action: string;
25
-    attributes: {
26
-        userID: string;
27
-        localAudioLevels: any;
28
-        remoteAudioLevels: any;
29
-    };
30
-};
31 1
 /**
32 2
  * This class exports constants and factory methods related to the analytics
33 3
  * API provided by AnalyticsAdapter. In order for entries in a database to be
@@ -51,287 +21,475 @@ export function createAudioOutputProblemEvent(userID: string, localAudioLevels:
51 21
  * should create new objects.
52 22
  *
53 23
  */
24
+export declare enum AnalyticsEvents {
25
+    /**
26
+     * The constant which identifies an event of type "operational".
27
+     */
28
+    TYPE_OPERATIONAL = "operational",
29
+    /**
30
+     * The constant which identifies an event of type "page".
31
+     */
32
+    TYPE_PAGE = "page",
33
+    /**
34
+     * The constant which identifies an event of type "track".
35
+     */
36
+    TYPE_TRACK = "track",
37
+    /**
38
+     * The constant which identifies an event of type "ui".
39
+     */
40
+    TYPE_UI = "ui",
41
+    /**
42
+     * The "action" value for Jingle events which indicates that the Jingle session
43
+     * was restarted (TODO: verify/fix the documentation)
44
+     */
45
+    ACTION_JINGLE_RESTART = "restart",
46
+    /**
47
+     * The "action" value for Jingle events which indicates that a session-accept
48
+     * timed out (TODO: verify/fix the documentation)
49
+     */
50
+    ACTION_JINGLE_SA_TIMEOUT = "session-accept.timeout",
51
+    /**
52
+     * The "action" value for Jingle events which indicates that a session-initiate
53
+     * was received.
54
+     */
55
+    ACTION_JINGLE_SI_RECEIVED = "session-initiate.received",
56
+    /**
57
+     * The "action" value for Jingle events which indicates that a session-initiate
58
+     * not arrived within a timeout (the value is specified in
59
+     * the {@link JingleSessionPC}.
60
+     */
61
+    ACTION_JINGLE_SI_TIMEOUT = "session-initiate.timeout",
62
+    /**
63
+     * A constant for the "terminate" action for Jingle events. TODO: verify/fix
64
+     * the documentation)
65
+     */
66
+    ACTION_JINGLE_TERMINATE = "terminate",
67
+    /**
68
+     * The "action" value for Jingle events which indicates that a transport-replace
69
+     * was received.
70
+     */
71
+    ACTION_JINGLE_TR_RECEIVED = "transport-replace.received",
72
+    /**
73
+     * The "action" value for Jingle events which indicates that a transport-replace
74
+     * succeeded (TODO: verify/fix the documentation)
75
+     */
76
+    ACTION_JINGLE_TR_SUCCESS = "transport-replace.success",
77
+    /**
78
+     * The "action" value for P2P events which indicates that P2P session initiate message has been rejected by the client
79
+     * because the mandatory requirements were not met.
80
+     */
81
+    ACTION_P2P_DECLINED = "decline",
82
+    /**
83
+     * The "action" value for P2P events which indicates that a connection was
84
+     * established (TODO: verify/fix the documentation)
85
+     */
86
+    ACTION_P2P_ESTABLISHED = "established",
87
+    /**
88
+     * The "action" value for P2P events which indicates that something failed.
89
+     */
90
+    ACTION_P2P_FAILED = "failed",
91
+    /**
92
+     * The "action" value for P2P events which indicates that a switch to
93
+     * jitsi-videobridge happened.
94
+     */
95
+    ACTION_P2P_SWITCH_TO_JVB = "switch.to.jvb",
96
+    /**
97
+     * The name of an event which indicates an available device. We send one such
98
+     * event per available device once when the available devices are first known,
99
+     * and every time that they change
100
+     *
101
+     * Properties:
102
+     *      audio_input_device_count: the number of audio input devices available at
103
+     *          the time the event was sent.
104
+     *      audio_output_device_count: the number of audio output devices available
105
+     *          at the time the event was sent.
106
+     *      video_input_device_count: the number of video input devices available at
107
+     *          the time the event was sent.
108
+     *      video_output_device_count: the number of video output devices available
109
+     *          at the time the event was sent.
110
+     *      device_id: an identifier of the device described in this event.
111
+     *      device_group_id:
112
+     *      device_kind: one of 'audioinput', 'audiooutput', 'videoinput' or
113
+     *          'videooutput'.
114
+     *      device_label: a string which describes the device.
115
+     */
116
+    AVAILABLE_DEVICE = "available.device",
117
+    /**
118
+     * This appears to be fired only in certain cases when the XMPP connection
119
+     * disconnects (and it was intentional?). It is currently never observed to
120
+     * fire in production.
121
+     *
122
+     * TODO: document
123
+     *
124
+     * Properties:
125
+     *      message: an error message
126
+     */
127
+    CONNECTION_DISCONNECTED = "connection.disconnected",
128
+    /**
129
+     * Indicates that the user of the application provided feedback in terms of a
130
+     * rating (an integer from 1 to 5) and an optional comment.
131
+     * Properties:
132
+     *      value: the user's rating (an integer from 1 to 5)
133
+     *      comment: the user's comment
134
+     */
135
+    FEEDBACK = "feedback",
136
+    /**
137
+     * Indicates the duration of a particular phase of the ICE connectivity
138
+     * establishment.
139
+     *
140
+     * Properties:
141
+     *      phase: the ICE phase (e.g. 'gathering', 'checking', 'establishment')
142
+     *      value: the duration in milliseconds.
143
+     *      p2p: whether the associated ICE connection is p2p or towards a
144
+     *          jitsi-videobridge
145
+     *      initiator: whether the local Jingle peer is the initiator or responder
146
+     *          in the Jingle session. XXX we probably actually care about the ICE
147
+     *          role (controlling vs controlled), and we assume that this correlates
148
+     *          with the Jingle initiator.
149
+     */
150
+    ICE_DURATION = "ice.duration",
151
+    /**
152
+     * Indicates the difference in milliseconds between the ICE establishment time
153
+     * for the P2P and JVB connections (e.g. a value of 10 would indicate that the
154
+     * P2P connection took 10ms more than JVB connection to establish).
155
+     *
156
+     * Properties:
157
+     *      value: the difference in establishment durations in milliseconds.
158
+     *
159
+     */
160
+    ICE_ESTABLISHMENT_DURATION_DIFF = "ice.establishment.duration.diff",
161
+    /**
162
+     * Indicates that the ICE state has changed.
163
+     *
164
+     * Properties:
165
+     *      state: the ICE state which was entered (e.g. 'checking', 'connected',
166
+     *          'completed', etc).
167
+     *      value: the time in milliseconds (as reported by
168
+     *          window.performance.now()) that the state change occurred.
169
+     *      p2p: whether the associated ICE connection is p2p or towards a
170
+     *          jitsi-videobridge
171
+     *      signalingState: The signaling state of the associated PeerConnection
172
+     *      reconnect: whether the associated Jingle session is in the process of
173
+     *          reconnecting (or is it ICE? TODO: verify/fix the documentation)
174
+     */
175
+    ICE_STATE_CHANGED = "ice.state.changed",
176
+    /**
177
+     * Indicates that no bytes have been sent for the track.
178
+     *
179
+     * Properties:
180
+     *      mediaType: the media type of the local track ('audio' or 'video').
181
+     */
182
+    NO_BYTES_SENT = "track.no-bytes-sent",
183
+    /**
184
+     * Indicates that a track was unmuted (?).
185
+     *
186
+     * Properties:
187
+     *      mediaType: the media type of the local track ('audio' or 'video').
188
+     *      trackType: the type of the track ('local' or 'remote').
189
+     *      value: TODO: document
190
+     */
191
+    TRACK_UNMUTED = "track.unmuted"
192
+}
193
+export declare const TYPE_OPERATIONAL = AnalyticsEvents.TYPE_OPERATIONAL;
194
+export declare const TYPE_PAGE = AnalyticsEvents.TYPE_PAGE;
195
+export declare const TYPE_TRACK = AnalyticsEvents.TYPE_TRACK;
196
+export declare const TYPE_UI = AnalyticsEvents.TYPE_UI;
197
+export declare const ACTION_JINGLE_RESTART = AnalyticsEvents.ACTION_JINGLE_RESTART;
198
+export declare const ACTION_JINGLE_SA_TIMEOUT = AnalyticsEvents.ACTION_JINGLE_SA_TIMEOUT;
199
+export declare const ACTION_JINGLE_SI_RECEIVED = AnalyticsEvents.ACTION_JINGLE_SI_RECEIVED;
200
+export declare const ACTION_JINGLE_SI_TIMEOUT = AnalyticsEvents.ACTION_JINGLE_SI_TIMEOUT;
201
+export declare const ACTION_JINGLE_TERMINATE = AnalyticsEvents.ACTION_JINGLE_TERMINATE;
202
+export declare const ACTION_JINGLE_TR_RECEIVED = AnalyticsEvents.ACTION_JINGLE_TR_RECEIVED;
203
+export declare const ACTION_JINGLE_TR_SUCCESS = AnalyticsEvents.ACTION_JINGLE_TR_SUCCESS;
204
+export declare const ACTION_P2P_DECLINED = AnalyticsEvents.ACTION_P2P_DECLINED;
205
+export declare const ACTION_P2P_ESTABLISHED = AnalyticsEvents.ACTION_P2P_ESTABLISHED;
206
+export declare const ACTION_P2P_FAILED = AnalyticsEvents.ACTION_P2P_FAILED;
207
+export declare const ACTION_P2P_SWITCH_TO_JVB = AnalyticsEvents.ACTION_P2P_SWITCH_TO_JVB;
208
+export declare const AVAILABLE_DEVICE = AnalyticsEvents.AVAILABLE_DEVICE;
209
+export declare const CONNECTION_DISCONNECTED = AnalyticsEvents.CONNECTION_DISCONNECTED;
210
+export declare const FEEDBACK = AnalyticsEvents.FEEDBACK;
211
+export declare const ICE_DURATION = AnalyticsEvents.ICE_DURATION;
212
+export declare const ICE_ESTABLISHMENT_DURATION_DIFF = AnalyticsEvents.ICE_ESTABLISHMENT_DURATION_DIFF;
213
+export declare const ICE_STATE_CHANGED = AnalyticsEvents.ICE_STATE_CHANGED;
214
+export declare const NO_BYTES_SENT = AnalyticsEvents.NO_BYTES_SENT;
215
+export declare const TRACK_UNMUTED = AnalyticsEvents.TRACK_UNMUTED;
54 216
 /**
55
- * The constant which identifies an event of type "operational".
56
- * @type {string}
217
+ * Creates an operational event which indicates that we have received a
218
+ * "bridge down" event from jicofo.
57 219
  */
58
-export const TYPE_OPERATIONAL: string;
59
-/**
60
- * The constant which identifies an event of type "page".
61
- * @type {string}
62
- */
63
-export const TYPE_PAGE: string;
64
-/**
65
- * The constant which identifies an event of type "track".
66
- * @type {string}
67
- */
68
-export const TYPE_TRACK: string;
220
+export declare const createBridgeDownEvent: () => {
221
+    action: string;
222
+    actionSubject: string;
223
+    type: AnalyticsEvents;
224
+};
69 225
 /**
70
- * The constant which identifies an event of type "ui".
71
- * @type {string}
226
+ * Creates an event which indicates that the XMPP connection failed
227
+ * @param errorType TODO
228
+ * @param errorMessage TODO
229
+ * @param detail connection failed details.
72 230
  */
73
-export const TYPE_UI: string;
231
+export declare const createConnectionFailedEvent: (errorType: unknown, errorMessage: unknown, details: object) => {
232
+    type: AnalyticsEvents;
233
+    action: string;
234
+    attributes: {
235
+        error_type: unknown;
236
+        error_message: unknown;
237
+    };
238
+};
74 239
 /**
75
- * The "action" value for Jingle events which indicates that the Jingle session
76
- * was restarted (TODO: verify/fix the documentation)
77
- * @type {string}
240
+ * Creates a conference event.
241
+ *
242
+ * @param action - The action of the event.
243
+ * @param attributes - The attributes to be added to the event.
78 244
  */
79
-export const ACTION_JINGLE_RESTART: string;
245
+export declare const createConferenceEvent: (action: string, attributes: object) => {
246
+    action: string;
247
+    attributes: object;
248
+    source: string;
249
+    type: AnalyticsEvents;
250
+};
80 251
 /**
81
- * The "action" value for Jingle events which indicates that a session-accept
82
- * timed out (TODO: verify/fix the documentation)
83
- * @type {string}
252
+ * Creates an operational event which indicates that a particular connection
253
+ * stage was reached (i.e. the XMPP connection transitioned to the "connected"
254
+ * state).
255
+ *
256
+ * @param stage the stage which was reached
257
+ * @param attributes additional attributes for the event. This should be an
258
+ * object with a "value" property indicating a timestamp in milliseconds
259
+ * relative to the beginning of the document's lifetime.
260
+ *
84 261
  */
85
-export const ACTION_JINGLE_SA_TIMEOUT: string;
262
+export declare const createConnectionStageReachedEvent: (stage: unknown, attributes: object) => {
263
+    action: string;
264
+    actionSubject: unknown;
265
+    attributes: object;
266
+    source: string;
267
+    type: AnalyticsEvents;
268
+};
86 269
 /**
87
- * The "action" value for Jingle events which indicates that a session-initiate
88
- * was received.
89
- * @type {string}
270
+ * Creates an operational event for the end-to-end round trip time to a
271
+ * specific remote participant.
272
+ * @param participantId the ID of the remote participant.
273
+ * @param region the region of the remote participant
274
+ * @param rtt the rtt
90 275
  */
91
-export const ACTION_JINGLE_SI_RECEIVED: string;
276
+export declare const createE2eRttEvent: (participantId: unknown, region: unknown, rtt: unknown) => {
277
+    attributes: {
278
+        participant_id: unknown;
279
+        region: unknown;
280
+        rtt: unknown;
281
+    };
282
+    name: string;
283
+    type: AnalyticsEvents;
284
+};
92 285
 /**
93
- * The "action" value for Jingle events which indicates that a session-initiate
94
- * not arrived within a timeout (the value is specified in
95
- * the {@link JingleSessionPC}.
96
- * @type {string}
286
+ * Creates an event which indicates that the focus has left the MUC.
97 287
  */
98
-export const ACTION_JINGLE_SI_TIMEOUT: string;
288
+export declare const createFocusLeftEvent: () => {
289
+    action: string;
290
+    actionSubject: string;
291
+    type: AnalyticsEvents;
292
+};
99 293
 /**
100
- * A constant for the "terminate" action for Jingle events. TODO: verify/fix
101
- * the documentation)
102
- * @type {string}
294
+ * Creates an event related to a getUserMedia call.
295
+ *
296
+ * @param action the type of the result that the event represents: 'error',
297
+ * 'success', 'warning', etc.
298
+ * @param attributes the attributes to attach to the event.
103 299
  */
104
-export const ACTION_JINGLE_TERMINATE: string;
300
+export declare const createGetUserMediaEvent: (action: 'error' | 'success' | 'warning' | string, attributes?: object) => {
301
+    type: AnalyticsEvents;
302
+    source: string;
303
+    action: string;
304
+    attributes: object;
305
+};
105 306
 /**
106
- * The "action" value for Jingle events which indicates that a transport-replace
107
- * was received.
108
- * @type {string}
307
+ * Creates an event related to remote participant connection status changes.
308
+ *
309
+ * @param attributes the attributes to attach to the event.
109 310
  */
110
-export const ACTION_JINGLE_TR_RECEIVED: string;
311
+export declare const createParticipantConnectionStatusEvent: (attributes?: object) => {
312
+    type: AnalyticsEvents;
313
+    source: string;
314
+    action: string;
315
+    attributes: object;
316
+};
111 317
 /**
112
- * The "action" value for Jingle events which indicates that a transport-replace
113
- * succeeded (TODO: verify/fix the documentation)
114
- * @type {string}
318
+ * Creates an event related to remote track streaming status changes.
319
+ *
320
+ * @param attributes the attributes to attach to the event.
115 321
  */
116
-export const ACTION_JINGLE_TR_SUCCESS: string;
322
+export declare const createTrackStreamingStatusEvent: (attributes?: object) => {
323
+    type: AnalyticsEvents;
324
+    source: string;
325
+    action: string;
326
+    attributes: object;
327
+};
117 328
 /**
118
- * The "action" value for P2P events which indicates that P2P session initiate message has been rejected by the client
119
- * because the mandatory requirements were not met.
120
- * @type {string}
329
+ * Creates an event for a Jingle-related event.
330
+ * @param action the action of the event
331
+ * @param attributes attributes to add to the event.
121 332
  */
122
-export const ACTION_P2P_DECLINED: string;
333
+export declare const createJingleEvent: (action: unknown, attributes?: object) => {
334
+    type: AnalyticsEvents;
335
+    action: unknown;
336
+    source: string;
337
+    attributes: object;
338
+};
123 339
 /**
124
- * The "action" value for P2P events which indicates that a connection was
125
- * established (TODO: verify/fix the documentation)
126
- * @type {string}
340
+ * Creates an event which indicates that a local track was not able to read
341
+ * data from its source (a camera or a microphone).
342
+ *
343
+ * @param mediaType the media type of the local track ('audio' or
344
+ * 'video').
127 345
  */
128
-export const ACTION_P2P_ESTABLISHED: string;
346
+export declare const createNoDataFromSourceEvent: (mediaType: 'audio' | 'video' | string, value: unknown) => {
347
+    attributes: {
348
+        media_type: string;
349
+        value: unknown;
350
+    };
351
+    action: string;
352
+    type: AnalyticsEvents;
353
+};
129 354
 /**
130
- * The "action" value for P2P events which indicates that something failed.
131
- * @type {string}
355
+ * Creates an event for a p2p-related event.
356
+ * @param action the action of the event
357
+ * @param attributes attributes to add to the event.
132 358
  */
133
-export const ACTION_P2P_FAILED: string;
359
+export declare const createP2PEvent: (action: unknown, attributes?: object) => {
360
+    type: AnalyticsEvents;
361
+    action: unknown;
362
+    source: string;
363
+    attributes: object;
364
+};
134 365
 /**
135
- * The "action" value for P2P events which indicates that a switch to
136
- * jitsi-videobridge happened.
137
- * @type {string}
366
+ * Indicates that we received a remote command to mute.
138 367
  */
139
-export const ACTION_P2P_SWITCH_TO_JVB: string;
368
+export declare const createRemotelyMutedEvent: (mediaType: unknown) => {
369
+    type: AnalyticsEvents;
370
+    action: string;
371
+    mediaType: unknown;
372
+};
140 373
 /**
141
- * The name of an event which indicates an available device. We send one such
142
- * event per available device once when the available devices are first known,
143
- * and every time that they change
144
- * @type {string}
374
+ * Creates an event which contains RTP statistics such as RTT and packet loss.
145 375
  *
146
- * Properties:
147
- *      audio_input_device_count: the number of audio input devices available at
148
- *          the time the event was sent.
149
- *      audio_output_device_count: the number of audio output devices available
150
- *          at the time the event was sent.
151
- *      video_input_device_count: the number of video input devices available at
152
- *          the time the event was sent.
153
- *      video_output_device_count: the number of video output devices available
154
- *          at the time the event was sent.
155
- *      device_id: an identifier of the device described in this event.
156
- *      device_group_id:
157
- *      device_kind: one of 'audioinput', 'audiooutput', 'videoinput' or
158
- *          'videooutput'.
159
- *      device_label: a string which describes the device.
160
- */
161
-export const AVAILABLE_DEVICE: string;
162
-/**
163
- * This appears to be fired only in certain cases when the XMPP connection
164
- * disconnects (and it was intentional?). It is currently never observed to
165
- * fire in production.
376
+ * All average RTP stats are currently reported under 1 event name, but with
377
+ * different properties that allows to distinguish between a P2P call, a
378
+ * call relayed through TURN or the JVB, and multiparty vs 1:1.
166 379
  *
167
- * TODO: document
380
+ * The structure of the event is:
168 381
  *
169
- * Properties:
170
- *      message: an error message
171
- */
172
-export const CONNECTION_DISCONNECTED: "connection.disconnected";
173
-/**
174
- * Indicates that the user of the application provided feedback in terms of a
175
- * rating (an integer from 1 to 5) and an optional comment.
176
- * Properties:
177
- *      value: the user's rating (an integer from 1 to 5)
178
- *      comment: the user's comment
179
- */
180
-export const FEEDBACK: "feedback";
181
-/**
182
- * Indicates the duration of a particular phase of the ICE connectivity
183
- * establishment.
382
+ * {
383
+ *      p2p: true,
384
+ *      conferenceSize: 2,
385
+ *      localCandidateType: "relay",
386
+ *      remoteCandidateType: "relay",
387
+ *      transportType: "udp",
184 388
  *
185
- * Properties:
186
- *      phase: the ICE phase (e.g. 'gathering', 'checking', 'establishment')
187
- *      value: the duration in milliseconds.
188
- *      p2p: whether the associated ICE connection is p2p or towards a
189
- *          jitsi-videobridge
190
- *      initiator: whether the local Jingle peer is the initiator or responder
191
- *          in the Jingle session. XXX we probably actually care about the ICE
192
- *          role (controlling vs controlled), and we assume that this correlates
193
- *          with the Jingle initiator.
194
- */
195
-export const ICE_DURATION: "ice.duration";
196
-/**
197
- * Indicates the difference in milliseconds between the ICE establishment time
198
- * for the P2P and JVB connections (e.g. a value of 10 would indicate that the
199
- * P2P connection took 10ms more than JVB connection to establish).
389
+ *      // Average RTT of 200ms
390
+ *      "rtt.avg": 200,
391
+ *      "rtt.samples": "[100, 200, 300]",
200 392
  *
201
- * Properties:
202
- *      value: the difference in establishment durations in milliseconds.
393
+ *      // Average packet loss of 10%
394
+ *      "packet.loss.avg": 10,
395
+ *      "packet.loss.samples": '[5, 10, 15]'
203 396
  *
204
- */
205
-export const ICE_ESTABLISHMENT_DURATION_DIFF: "ice.establishment.duration.diff";
206
-/**
207
- * Indicates that the ICE state has changed.
397
+ *      // Difference in milliseconds in the end-to-end RTT between p2p and jvb.
398
+ *      // The e2e RTT through jvb is 15ms shorter:
399
+ *      "rtt.diff": 15,
208 400
  *
209
- * Properties:
210
- *      state: the ICE state which was entered (e.g. 'checking', 'connected',
211
- *          'completed', etc).
212
- *      value: the time in milliseconds (as reported by
213
- *          window.performance.now()) that the state change occurred.
214
- *      p2p: whether the associated ICE connection is p2p or towards a
215
- *          jitsi-videobridge
216
- *      signalingState: The signaling state of the associated PeerConnection
217
- *      reconnect: whether the associated Jingle session is in the process of
218
- *          reconnecting (or is it ICE? TODO: verify/fix the documentation)
219
- */
220
-export const ICE_STATE_CHANGED: "ice.state.changed";
221
-/**
222
- * Indicates that no bytes have been sent for the track.
401
+ *      // End-to-end RTT through JVB is ms.
402
+ *      "end2end.rtt.avg" = 100
403
+ * }
223 404
  *
224
- * Properties:
225
- *      mediaType: the media type of the local track ('audio' or 'video').
226
- */
227
-export const NO_BYTES_SENT: "track.no-bytes-sent";
228
-/**
229
- * Indicates that a track was unmuted (?).
405
+ * Note that the value of the "samples" properties are (JSON encoded) strings,
406
+ * and not JSON arrays, as events' attributes can not be nested. The samples are
407
+ * currently included for debug purposes only and can be removed anytime soon
408
+ * from the structure.
230 409
  *
231
- * Properties:
232
- *      mediaType: the media type of the local track ('audio' or 'video').
233
- *      trackType: the type of the track ('local' or 'remote').
234
- *      value: TODO: document
410
+ * Also note that not all of values are present in each event, as values are
411
+ * obtained and calculated as part of different process/event pipe. For example
412
+ * {@link ConnectionAvgStats} instances are doing the reports for each
413
+ * {@link TraceablePeerConnection} and work independently from the main stats
414
+ * pipe.
235 415
  */
236
-export const TRACK_UNMUTED: "track.unmuted";
237
-export function createBridgeDownEvent(): {
416
+export declare const createRtpStatsEvent: (attributes: object) => {
417
+    type: AnalyticsEvents;
238 418
     action: string;
239
-    actionSubject: string;
240
-    type: string;
419
+    attributes: object;
241 420
 };
242
-export function createConnectionFailedEvent(errorType: any, errorMessage: any, details: any): {
243
-    type: string;
421
+/**
422
+ * Creates an event which contains the round trip time (RTT) to a set of
423
+ * regions.
424
+ *
425
+ * @param attributes
426
+ */
427
+export declare const createRttByRegionEvent: (attributes: object) => {
428
+    type: AnalyticsEvents;
244 429
     action: string;
245
-    attributes: any;
430
+    attributes: object;
246 431
 };
247
-export function createConnectionStageReachedEvent(stage: any, attributes: any): {
432
+/**
433
+ * Creates an event which contains the local and remote ICE candidate types
434
+ * for the transport that is currently selected.
435
+ *
436
+ * @param attributes
437
+ */
438
+export declare const createTransportStatsEvent: (attributes: object) => {
439
+    type: AnalyticsEvents;
248 440
     action: string;
249
-    actionSubject: any;
250
-    attributes: any;
251
-    source: string;
252
-    type: string;
253
-};
254
-export function createE2eRttEvent(participantId: any, region: any, rtt: any): {
255
-    attributes: {
256
-        participant_id: any;
257
-        region: any;
258
-        rtt: any;
259
-    };
260
-    name: string;
261
-    type: string;
441
+    attributes: object;
262 442
 };
263
-export function createFocusLeftEvent(): {
443
+/**
444
+ * Creates an event which contains information about the audio output problem (the user id of the affected participant,
445
+ * the local audio levels and the remote audio levels that triggered the event).
446
+ *
447
+ * @param userID - The user id of the affected participant.
448
+ * @param localAudioLevels - The local audio levels.
449
+ * @param remoteAudioLevels - The audio levels received from the participant.
450
+ */
451
+export declare const createAudioOutputProblemEvent: (userID: string, localAudioLevels: unknown, remoteAudioLevels: unknown) => {
452
+    type: AnalyticsEvents;
264 453
     action: string;
265
-    actionSubject: string;
266
-    type: string;
267
-};
268
-export function createGetUserMediaEvent(action: any, attributes?: {}): {
269
-    type: string;
270
-    source: string;
271
-    name: string;
272
-};
273
-export function createParticipantConnectionStatusEvent(attributes?: {}): {
274
-    type: string;
275
-    source: string;
276
-    name: string;
277
-};
278
-export function createTrackStreamingStatusEvent(attributes?: {}): {
279
-    type: string;
280
-    source: string;
281
-    name: string;
282
-};
283
-export function createJingleEvent(action: any, attributes?: {}): {
284
-    type: string;
285
-    action: any;
286
-    source: string;
287
-    attributes: {};
288
-};
289
-export function createNoDataFromSourceEvent(mediaType: string, value: any): {
290 454
     attributes: {
291
-        media_type: string;
292
-        value: any;
455
+        userID: string;
456
+        localAudioLevels: unknown;
457
+        remoteAudioLevels: unknown;
293 458
     };
294
-    action: string;
295
-    type: string;
296 459
 };
297
-export function createP2PEvent(action: any, attributes?: {}): {
298
-    type: string;
299
-    action: any;
300
-    source: string;
301
-    attributes: {};
302
-};
303
-export function createRemotelyMutedEvent(mediaType: any): {
304
-    type: string;
305
-    action: string;
306
-    mediaType: any;
307
-};
308
-export function createRtpStatsEvent(attributes: any): {
309
-    type: string;
310
-    action: string;
311
-    attributes: any;
312
-};
313
-export function createRttByRegionEvent(attributes: any): {
314
-    type: string;
315
-    action: string;
316
-    attributes: any;
317
-};
318
-export function createTransportStatsEvent(attributes: any): {
319
-    type: string;
320
-    action: string;
321
-    attributes: any;
322
-};
323
-export function createBridgeChannelClosedEvent(code: string, reason: string): {
324
-    type: string;
460
+/**
461
+ * Creates an event which contains an information related to the bridge channel close event.
462
+ *
463
+ * @param code - A code from {@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}
464
+ * @param reason - A string which describes the reason for closing the bridge channel.
465
+ */
466
+export declare const createBridgeChannelClosedEvent: (code: string, reason: string) => {
467
+    type: AnalyticsEvents;
325 468
     action: string;
326 469
     attributes: {
327 470
         code: string;
328 471
         reason: string;
329 472
     };
330 473
 };
331
-export function createTtfmEvent(attributes: any): {
474
+/**
475
+ * Creates an event which indicates the Time To First Media (TTFM).
476
+ * It is measured in milliseconds relative to the beginning of the document's
477
+ * lifetime (i.e. the origin used by window.performance.now()), and it excludes
478
+ * the following:
479
+ * 1. The delay due to getUserMedia()
480
+ * 2. The period between the MUC being joined and the reception of the Jingle
481
+ * session-initiate from jicofo. This is because jicofo will not start a Jingle
482
+ * session until there are at least 2 participants in the room.
483
+ *
484
+ * @param attributes the attributes to add to the event. Currently used fields:
485
+ *      mediaType: the media type of the local track ('audio' or 'video').
486
+ *      muted: whether the track has ever been muted (?)
487
+ *      value: the TTMF in milliseconds.
488
+ */
489
+export declare const createTtfmEvent: (attributes: object) => {
332 490
     action: string;
333
-    actionSubject: any;
334
-    attributes: any;
491
+    actionSubject: unknown;
492
+    attributes: object;
335 493
     source: string;
336
-    type: string;
494
+    type: AnalyticsEvents;
337 495
 };

Laddar…
Avbryt
Spara