This repository has been archived by the owner on Aug 19, 2023. It is now read-only.
forked from jitsi/lib-jitsi-meet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JitsiConferenceEventManager.js
661 lines (548 loc) · 22.7 KB
/
JitsiConferenceEventManager.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
/* global __filename */
import { Strophe } from 'strophe.js';
import {
ACTION_JINGLE_SA_TIMEOUT,
createBridgeDownEvent,
createConnectionStageReachedEvent,
createFocusLeftEvent,
createJingleEvent,
createRemotelyMutedEvent
} from './service/statistics/AnalyticsEvents';
import AuthenticationEvents
from './service/authentication/AuthenticationEvents';
import EventEmitterForwarder from './modules/util/EventEmitterForwarder';
import { getLogger } from 'jitsi-meet-logger';
import * as JitsiConferenceErrors from './JitsiConferenceErrors';
import * as JitsiConferenceEvents from './JitsiConferenceEvents';
import * as MediaType from './service/RTC/MediaType';
import RTCEvents from './service/RTC/RTCEvents';
import VideoType from './service/RTC/VideoType';
import Statistics from './modules/statistics/statistics';
import XMPPEvents from './service/xmpp/XMPPEvents';
const logger = getLogger(__filename);
/**
* Setups all event listeners related to conference
* @param conference {JitsiConference} the conference
*/
export default function JitsiConferenceEventManager(conference) {
this.conference = conference;
// Listeners related to the conference only
conference.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED,
track => {
if (!track.isLocal() || !conference.statistics) {
return;
}
const session
= track.isP2P
? conference.p2pJingleSession : conference.jvbJingleSession;
// TPC will be null, before the conference starts, but the event
// still should be queued
const tpc = (session && session.peerconnection) || null;
conference.statistics.sendMuteEvent(
tpc,
track.isMuted(),
track.getType());
});
}
/**
* Setups event listeners related to conference.chatRoom
*/
JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
const conference = this.conference;
const chatRoom = conference.room;
this.chatRoomForwarder = new EventEmitterForwarder(chatRoom,
this.conference.eventEmitter);
chatRoom.addListener(XMPPEvents.ICE_RESTARTING, jingleSession => {
if (!jingleSession.isP2P) {
// If using DataChannel as bridge channel, it must be closed
// before ICE restart, otherwise Chrome will not trigger "opened"
// event for the channel established with the new bridge.
// TODO: This may be bypassed when using a WebSocket as bridge
// channel.
conference.rtc.closeBridgeChannel();
}
// else: there are no DataChannels in P2P session (at least for now)
});
chatRoom.addListener(XMPPEvents.AUDIO_MUTED_BY_FOCUS,
() => {
// TODO: Add a way to differentiate between commands which caused
// us to mute and those that did not change our state (i.e. we were
// already muted).
Statistics.sendAnalytics(createRemotelyMutedEvent());
// set isMutedByFocus when setAudioMute Promise ends
conference.rtc.setAudioMute(true).then(
() => {
conference.isMutedByFocus = true;
},
() =>
logger.warn(
'Error while audio muting due to focus request'));
}
);
this.chatRoomForwarder.forward(XMPPEvents.SUBJECT_CHANGED,
JitsiConferenceEvents.SUBJECT_CHANGED);
this.chatRoomForwarder.forward(XMPPEvents.MUC_JOINED,
JitsiConferenceEvents.CONFERENCE_JOINED);
// send some analytics events
chatRoom.addListener(XMPPEvents.MUC_JOINED,
() => {
this.conference.isJvbConnectionInterrupted = false;
// TODO: Move all of the 'connectionTimes' logic to its own module.
Object.keys(chatRoom.connectionTimes).forEach(key => {
const event
= createConnectionStageReachedEvent(
`conference_${key}`,
{ value: chatRoom.connectionTimes[key] });
Statistics.sendAnalytics(event);
});
// TODO: Move all of the 'connectionTimes' logic to its own module.
Object.keys(chatRoom.xmpp.connectionTimes).forEach(key => {
const event
= createConnectionStageReachedEvent(
`xmpp_${key}`,
{ value: chatRoom.xmpp.connectionTimes[key] });
Statistics.sendAnalytics(event);
});
});
this.chatRoomForwarder.forward(XMPPEvents.ROOM_JOIN_ERROR,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.CONNECTION_ERROR);
this.chatRoomForwarder.forward(XMPPEvents.ROOM_CONNECT_ERROR,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.CONNECTION_ERROR);
this.chatRoomForwarder.forward(XMPPEvents.ROOM_CONNECT_NOT_ALLOWED_ERROR,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.NOT_ALLOWED_ERROR);
this.chatRoomForwarder.forward(XMPPEvents.ROOM_MAX_USERS_ERROR,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.CONFERENCE_MAX_USERS);
this.chatRoomForwarder.forward(XMPPEvents.PASSWORD_REQUIRED,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.PASSWORD_REQUIRED);
this.chatRoomForwarder.forward(XMPPEvents.AUTHENTICATION_REQUIRED,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.AUTHENTICATION_REQUIRED);
this.chatRoomForwarder.forward(XMPPEvents.BRIDGE_DOWN,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE);
chatRoom.addListener(
XMPPEvents.BRIDGE_DOWN,
() => Statistics.sendAnalytics(createBridgeDownEvent()));
this.chatRoomForwarder.forward(XMPPEvents.RESERVATION_ERROR,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.RESERVATION_ERROR);
this.chatRoomForwarder.forward(XMPPEvents.GRACEFUL_SHUTDOWN,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.GRACEFUL_SHUTDOWN);
chatRoom.addListener(XMPPEvents.JINGLE_FATAL_ERROR,
(session, error) => {
if (!session.isP2P) {
conference.eventEmitter.emit(
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.JINGLE_FATAL_ERROR, error);
}
});
chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
jingleSession => {
conference._onIceConnectionFailed(jingleSession);
});
this.chatRoomForwarder.forward(XMPPEvents.MUC_DESTROYED,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.CONFERENCE_DESTROYED);
this.chatRoomForwarder.forward(XMPPEvents.CHAT_ERROR_RECEIVED,
JitsiConferenceEvents.CONFERENCE_ERROR,
JitsiConferenceErrors.CHAT_ERROR);
this.chatRoomForwarder.forward(XMPPEvents.FOCUS_DISCONNECTED,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.FOCUS_DISCONNECTED);
chatRoom.addListener(XMPPEvents.FOCUS_LEFT,
() => {
Statistics.sendAnalytics(createFocusLeftEvent());
conference.eventEmitter.emit(
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.FOCUS_LEFT);
});
chatRoom.addListener(XMPPEvents.SESSION_ACCEPT_TIMEOUT,
jingleSession => {
Statistics.sendAnalyticsAndLog(
createJingleEvent(
ACTION_JINGLE_SA_TIMEOUT,
{ p2p: jingleSession.isP2P }));
});
this.chatRoomForwarder.forward(XMPPEvents.RECORDER_STATE_CHANGED,
JitsiConferenceEvents.RECORDER_STATE_CHANGED);
this.chatRoomForwarder.forward(XMPPEvents.TRANSCRIPTION_STATUS_CHANGED,
JitsiConferenceEvents.TRANSCRIPTION_STATUS_CHANGED);
this.chatRoomForwarder.forward(XMPPEvents.VIDEO_SIP_GW_AVAILABILITY_CHANGED,
JitsiConferenceEvents.VIDEO_SIP_GW_AVAILABILITY_CHANGED);
this.chatRoomForwarder.forward(
XMPPEvents.VIDEO_SIP_GW_SESSION_STATE_CHANGED,
JitsiConferenceEvents.VIDEO_SIP_GW_SESSION_STATE_CHANGED);
this.chatRoomForwarder.forward(XMPPEvents.PHONE_NUMBER_CHANGED,
JitsiConferenceEvents.PHONE_NUMBER_CHANGED);
chatRoom.addListener(
XMPPEvents.CONFERENCE_SETUP_FAILED,
(jingleSession, error) => {
if (!jingleSession.isP2P) {
conference.eventEmitter.emit(
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.SETUP_FAILED,
error);
}
});
chatRoom.setParticipantPropertyListener((node, from) => {
const participant = conference.getParticipantById(from);
if (!participant) {
return;
}
participant.setProperty(
node.tagName.substring('jitsi_participant_'.length),
node.value);
});
this.chatRoomForwarder.forward(XMPPEvents.KICKED,
JitsiConferenceEvents.KICKED);
chatRoom.addListener(XMPPEvents.KICKED,
() => {
conference.room = null;
conference.leave();
});
chatRoom.addListener(XMPPEvents.SUSPEND_DETECTED,
conference.onSuspendDetected.bind(conference));
this.chatRoomForwarder.forward(XMPPEvents.MUC_LOCK_CHANGED,
JitsiConferenceEvents.LOCK_STATE_CHANGED);
chatRoom.addListener(XMPPEvents.MUC_MEMBER_JOINED,
conference.onMemberJoined.bind(conference));
chatRoom.addListener(XMPPEvents.MUC_MEMBER_LEFT,
conference.onMemberLeft.bind(conference));
this.chatRoomForwarder.forward(XMPPEvents.MUC_LEFT,
JitsiConferenceEvents.CONFERENCE_LEFT);
chatRoom.addListener(XMPPEvents.DISPLAY_NAME_CHANGED,
conference.onDisplayNameChanged.bind(conference));
chatRoom.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, role => {
conference.onLocalRoleChanged(role);
// log all events for the recorder operated by the moderator
if (conference.statistics && conference.isModerator()) {
conference.on(JitsiConferenceEvents.RECORDER_STATE_CHANGED,
(status, error) => {
const logObject = {
id: 'recorder_status',
status
};
if (error) {
logObject.error = error;
}
Statistics.sendLog(JSON.stringify(logObject));
});
}
});
chatRoom.addListener(XMPPEvents.MUC_ROLE_CHANGED,
conference.onUserRoleChanged.bind(conference));
chatRoom.addListener(AuthenticationEvents.IDENTITY_UPDATED,
(authEnabled, authIdentity) => {
conference.authEnabled = authEnabled;
conference.authIdentity = authIdentity;
conference.eventEmitter.emit(
JitsiConferenceEvents.AUTH_STATUS_CHANGED, authEnabled,
authIdentity);
});
chatRoom.addListener(
XMPPEvents.MESSAGE_RECEIVED,
// eslint-disable-next-line max-params
(jid, displayName, txt, myJid, ts) => {
const id = Strophe.getResourceFromJid(jid);
conference.eventEmitter.emit(
JitsiConferenceEvents.MESSAGE_RECEIVED,
id, txt, ts);
});
chatRoom.addListener(
XMPPEvents.PRIVATE_MESSAGE_RECEIVED,
// eslint-disable-next-line max-params
(jid, displayName, txt, myJid, ts) => {
const id = Strophe.getResourceFromJid(jid);
conference.eventEmitter.emit(
JitsiConferenceEvents.PRIVATE_MESSAGE_RECEIVED,
id, txt, ts);
});
chatRoom.addListener(XMPPEvents.PRESENCE_STATUS,
(jid, status) => {
const id = Strophe.getResourceFromJid(jid);
const participant = conference.getParticipantById(id);
if (!participant || participant._status === status) {
return;
}
participant._status = status;
conference.eventEmitter.emit(
JitsiConferenceEvents.USER_STATUS_CHANGED, id, status);
});
chatRoom.addListener(XMPPEvents.JSON_MESSAGE_RECEIVED,
(from, payload) => {
const id = Strophe.getResourceFromJid(from);
const participant = conference.getParticipantById(id);
if (participant) {
conference.eventEmitter.emit(
JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
participant, payload);
} else {
logger.warn(
'Ignored XMPPEvents.JSON_MESSAGE_RECEIVED for not existing '
+ `participant: ${from}`,
payload);
}
});
chatRoom.addPresenceListener('startmuted', (data, from) => {
let isModerator = false;
if (conference.myUserId() === from && conference.isModerator()) {
isModerator = true;
} else {
const participant = conference.getParticipantById(from);
if (participant && participant.isModerator()) {
isModerator = true;
}
}
if (!isModerator) {
return;
}
const startAudioMuted = data.attributes.audio === 'true';
const startVideoMuted = data.attributes.video === 'true';
let updated = false;
if (startAudioMuted !== conference.startMutedPolicy.audio) {
conference.startMutedPolicy.audio = startAudioMuted;
updated = true;
}
if (startVideoMuted !== conference.startMutedPolicy.video) {
conference.startMutedPolicy.video = startVideoMuted;
updated = true;
}
if (updated) {
conference.eventEmitter.emit(
JitsiConferenceEvents.START_MUTED_POLICY_CHANGED,
conference.startMutedPolicy
);
}
});
chatRoom.addPresenceListener('devices', (data, from) => {
let isAudioAvailable = false;
let isVideoAvailable = false;
data.children.forEach(config => {
if (config.tagName === 'audio') {
isAudioAvailable = config.value === 'true';
}
if (config.tagName === 'video') {
isVideoAvailable = config.value === 'true';
}
});
let availableDevices;
if (conference.myUserId() === from) {
availableDevices = conference.availableDevices;
} else {
const participant = conference.getParticipantById(from);
if (!participant) {
return;
}
availableDevices = participant._availableDevices;
}
let updated = false;
if (availableDevices.audio !== isAudioAvailable) {
updated = true;
availableDevices.audio = isAudioAvailable;
}
if (availableDevices.video !== isVideoAvailable) {
updated = true;
availableDevices.video = isVideoAvailable;
}
if (updated) {
conference.eventEmitter.emit(
JitsiConferenceEvents.AVAILABLE_DEVICES_CHANGED,
from, availableDevices);
}
});
if (conference.statistics) {
// FIXME ICE related events should end up in RTCEvents eventually
chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
session => {
conference.statistics.sendIceConnectionFailedEvent(
session.peerconnection);
});
// FIXME XMPPEvents.ADD_ICE_CANDIDATE_FAILED is never emitted
chatRoom.addListener(XMPPEvents.ADD_ICE_CANDIDATE_FAILED,
(e, pc) => {
conference.statistics.sendAddIceCandidateFailed(e, pc);
});
}
};
/**
* Setups event listeners related to conference.rtc
*/
JitsiConferenceEventManager.prototype.setupRTCListeners = function() {
const conference = this.conference;
const rtc = conference.rtc;
rtc.addListener(
RTCEvents.REMOTE_TRACK_ADDED,
conference.onRemoteTrackAdded.bind(conference));
rtc.addListener(
RTCEvents.REMOTE_TRACK_REMOVED,
conference.onRemoteTrackRemoved.bind(conference));
rtc.addListener(RTCEvents.DOMINANT_SPEAKER_CHANGED,
id => {
if (conference.lastDominantSpeaker !== id && conference.room) {
conference.lastDominantSpeaker = id;
conference.eventEmitter.emit(
JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, id);
}
if (conference.statistics && conference.myUserId() === id) {
// We are the new dominant speaker.
conference.statistics.sendDominantSpeakerEvent();
}
});
rtc.addListener(RTCEvents.DATA_CHANNEL_OPEN, () => {
const now = window.performance.now();
const key = 'data.channel.opened';
// TODO: Move all of the 'connectionTimes' logic to its own module.
logger.log(`(TIME) ${key}`, now);
conference.room.connectionTimes[key] = now;
Statistics.sendAnalytics(
createConnectionStageReachedEvent(key, { value: now }));
conference.eventEmitter.emit(JitsiConferenceEvents.DATA_CHANNEL_OPENED);
});
rtc.addListener(
RTCEvents.AVAILABLE_DEVICES_CHANGED,
devices => conference.room.updateDeviceAvailability(devices));
rtc.addListener(RTCEvents.ENDPOINT_MESSAGE_RECEIVED,
(from, payload) => {
const participant = conference.getParticipantById(from);
if (participant) {
conference.eventEmitter.emit(
JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
participant, payload);
} else {
logger.warn(
'Ignored ENDPOINT_MESSAGE_RECEIVED for not existing '
+ `participant: ${from}`,
payload);
}
});
rtc.addListener(RTCEvents.LOCAL_UFRAG_CHANGED,
(tpc, ufrag) => {
if (!tpc.isP2P) {
Statistics.sendLog(
JSON.stringify({
id: 'local_ufrag',
value: ufrag
}));
}
});
rtc.addListener(RTCEvents.REMOTE_UFRAG_CHANGED,
(tpc, ufrag) => {
if (!tpc.isP2P) {
Statistics.sendLog(
JSON.stringify({
id: 'remote_ufrag',
value: ufrag
}));
}
});
rtc.addListener(RTCEvents.CREATE_ANSWER_FAILED,
(e, tpc) => {
conference.statistics.sendCreateAnswerFailed(e, tpc);
});
rtc.addListener(RTCEvents.CREATE_OFFER_FAILED,
(e, tpc) => {
conference.statistics.sendCreateOfferFailed(e, tpc);
});
rtc.addListener(RTCEvents.SET_LOCAL_DESCRIPTION_FAILED,
(e, tpc) => {
conference.statistics.sendSetLocalDescFailed(e, tpc);
});
rtc.addListener(RTCEvents.SET_REMOTE_DESCRIPTION_FAILED,
(e, tpc) => {
conference.statistics.sendSetRemoteDescFailed(e, tpc);
});
rtc.addListener(RTCEvents.LOCAL_TRACK_SSRC_UPDATED,
(track, ssrc) => {
// when starting screen sharing, the track is created and when
// we do set local description and we process the ssrc we
// will be notified for it and we will report it with the event
// for screen sharing
if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP) {
conference.statistics.sendScreenSharingEvent(true, ssrc);
}
});
};
/**
* Setups event listeners related to conference.xmpp
*/
JitsiConferenceEventManager.prototype.setupXMPPListeners = function() {
const conference = this.conference;
conference.xmpp.caps.addListener(XMPPEvents.PARTCIPANT_FEATURES_CHANGED,
from => {
const participant
= conference.getParticipantById(
Strophe.getResourceFromJid(from));
if (participant) {
conference.eventEmitter.emit(
JitsiConferenceEvents.PARTCIPANT_FEATURES_CHANGED,
participant);
}
});
conference.xmpp.addListener(
XMPPEvents.CALL_INCOMING,
conference.onIncomingCall.bind(conference));
conference.xmpp.addListener(
XMPPEvents.CALL_ACCEPTED,
conference.onCallAccepted.bind(conference));
conference.xmpp.addListener(
XMPPEvents.TRANSPORT_INFO,
conference.onTransportInfo.bind(conference));
conference.xmpp.addListener(
XMPPEvents.CALL_ENDED,
conference.onCallEnded.bind(conference));
conference.xmpp.addListener(XMPPEvents.START_MUTED_FROM_FOCUS,
(audioMuted, videoMuted) => {
if (conference.options.config.ignoreStartMuted) {
return;
}
conference.startAudioMuted = audioMuted;
conference.startVideoMuted = videoMuted;
// mute existing local tracks because this is initial mute from
// Jicofo
conference.getLocalTracks().forEach(track => {
switch (track.getType()) {
case MediaType.AUDIO:
conference.startAudioMuted && track.mute();
break;
case MediaType.VIDEO:
conference.startVideoMuted && track.mute();
break;
}
});
conference.eventEmitter.emit(JitsiConferenceEvents.STARTED_MUTED);
});
};
/**
* Setups event listeners related to conference.statistics
*/
JitsiConferenceEventManager.prototype.setupStatisticsListeners = function() {
const conference = this.conference;
if (!conference.statistics) {
return;
}
/* eslint-disable max-params */
conference.statistics.addAudioLevelListener((tpc, ssrc, level, isLocal) => {
conference.rtc.setAudioLevel(tpc, ssrc, level, isLocal);
});
/* eslint-enable max-params */
// Forward the "before stats disposed" event
conference.statistics.addBeforeDisposedListener(() => {
conference.eventEmitter.emit(
JitsiConferenceEvents.BEFORE_STATISTICS_DISPOSED);
});
conference.statistics.addByteSentStatsListener((tpc, stats) => {
conference.getLocalTracks(MediaType.AUDIO).forEach(track => {
const ssrc = tpc.getLocalSSRC(track);
if (!ssrc || !stats.hasOwnProperty(ssrc)) {
return;
}
track._onByteSentStatsReceived(tpc, stats[ssrc]);
});
});
};