|
|
@@ -6,25 +6,27 @@ var RTCEvents = require('../../service/RTC/RTCEvents');
|
|
6
|
6
|
|
|
7
|
7
|
import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
|
|
8
|
8
|
import * as JitsiTrackEvents from '../../JitsiTrackEvents';
|
|
|
9
|
+import Statistics from '../statistics/statistics';
|
|
9
|
10
|
|
|
10
|
11
|
/**
|
|
11
|
|
- * How long we're going to wait after the RTC video track muted event for
|
|
12
|
|
- * the corresponding signalling mute event, before the connection interrupted
|
|
13
|
|
- * is fired.
|
|
|
12
|
+ * Default value of 2000 milliseconds for
|
|
|
13
|
+ * {@link ParticipantConnectionStatus.rtcMuteTimeout}.
|
|
14
|
14
|
*
|
|
15
|
|
- * @type {number} amount of time in milliseconds
|
|
|
15
|
+ * @type {number}
|
|
16
|
16
|
*/
|
|
17
|
|
-const RTC_MUTE_TIMEOUT = 1000;
|
|
|
17
|
+const DEFAULT_RTC_MUTE_TIMEOUT = 2000;
|
|
18
|
18
|
|
|
19
|
19
|
/**
|
|
20
|
20
|
* Class is responsible for emitting
|
|
21
|
21
|
* JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED events.
|
|
22
|
22
|
*
|
|
23
|
23
|
* @constructor
|
|
24
|
|
- * @param rtc {RTC} the RTC service instance
|
|
25
|
|
- * @param conference {JitsiConference} parent conference instance
|
|
|
24
|
+ * @param {RTC} rtc the RTC service instance
|
|
|
25
|
+ * @param {JitsiConference} conference parent conference instance
|
|
|
26
|
+ * @param {number} rtcMuteTimeout (optional) custom value for
|
|
|
27
|
+ * {@link ParticipantConnectionStatus.rtcMuteTimeout}.
|
|
26
|
28
|
*/
|
|
27
|
|
-function ParticipantConnectionStatus(rtc, conference) {
|
|
|
29
|
+function ParticipantConnectionStatus(rtc, conference, rtcMuteTimeout) {
|
|
28
|
30
|
this.rtc = rtc;
|
|
29
|
31
|
this.conference = conference;
|
|
30
|
32
|
/**
|
|
|
@@ -34,6 +36,18 @@ function ParticipantConnectionStatus(rtc, conference) {
|
|
34
|
36
|
* @type {Object.<string, number>}
|
|
35
|
37
|
*/
|
|
36
|
38
|
this.trackTimers = {};
|
|
|
39
|
+ /**
|
|
|
40
|
+ * How long we're going to wait after the RTC video track muted event for
|
|
|
41
|
+ * the corresponding signalling mute event, before the connection
|
|
|
42
|
+ * interrupted is fired. The default value is
|
|
|
43
|
+ * {@link DEFAULT_RTC_MUTE_TIMEOUT}.
|
|
|
44
|
+ *
|
|
|
45
|
+ * @type {number} amount of time in milliseconds
|
|
|
46
|
+ */
|
|
|
47
|
+ this.rtcMuteTimeout
|
|
|
48
|
+ = typeof rtcMuteTimeout === 'number'
|
|
|
49
|
+ ? rtcMuteTimeout : DEFAULT_RTC_MUTE_TIMEOUT;
|
|
|
50
|
+ logger.info("RtcMuteTimeout set to: " + this.rtcMuteTimeout);
|
|
37
|
51
|
}
|
|
38
|
52
|
|
|
39
|
53
|
/**
|
|
|
@@ -165,10 +179,24 @@ ParticipantConnectionStatus.prototype._changeConnectionStatus
|
|
165
|
179
|
return;
|
|
166
|
180
|
}
|
|
167
|
181
|
if (participant.isConnectionActive() !== newStatus) {
|
|
|
182
|
+
|
|
168
|
183
|
participant._setIsConnectionActive(newStatus);
|
|
|
184
|
+
|
|
169
|
185
|
logger.debug(
|
|
170
|
186
|
'Emit endpoint conn status(' + Date.now() + '): ',
|
|
171
|
187
|
endpointId, newStatus);
|
|
|
188
|
+
|
|
|
189
|
+ // Log the event on CallStats
|
|
|
190
|
+ Statistics.sendLog(
|
|
|
191
|
+ JSON.stringify({
|
|
|
192
|
+ id: 'peer.conn.status',
|
|
|
193
|
+ participant: endpointId,
|
|
|
194
|
+ status: newStatus
|
|
|
195
|
+ }));
|
|
|
196
|
+
|
|
|
197
|
+ // and analytics
|
|
|
198
|
+ Statistics.analytics.sendEvent('peer.conn.status', null, newStatus);
|
|
|
199
|
+
|
|
172
|
200
|
this.conference.eventEmitter.emit(
|
|
173
|
201
|
JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
|
|
174
|
202
|
endpointId, newStatus);
|
|
|
@@ -232,7 +260,7 @@ ParticipantConnectionStatus.prototype.onRemoteTrackRemoved
|
|
232
|
260
|
/**
|
|
233
|
261
|
* Handles RTC 'onmute' event for the video track.
|
|
234
|
262
|
*
|
|
235
|
|
- * @param track {JitsiRemoteTrack} the video track for which 'onmute' event will
|
|
|
263
|
+ * @param {JitsiRemoteTrack} track the video track for which 'onmute' event will
|
|
236
|
264
|
* be processed.
|
|
237
|
265
|
*/
|
|
238
|
266
|
ParticipantConnectionStatus.prototype.onTrackRtcMuted = function(track) {
|
|
|
@@ -254,14 +282,14 @@ ParticipantConnectionStatus.prototype.onTrackRtcMuted = function(track) {
|
|
254
|
282
|
this._changeConnectionStatus(participantId, false);
|
|
255
|
283
|
}
|
|
256
|
284
|
this.clearTimeout(participantId);
|
|
257
|
|
- }.bind(this), RTC_MUTE_TIMEOUT);
|
|
|
285
|
+ }.bind(this), this.rtcMuteTimeout);
|
|
258
|
286
|
}
|
|
259
|
287
|
};
|
|
260
|
288
|
|
|
261
|
289
|
/**
|
|
262
|
290
|
* Handles RTC 'onunmute' event for the video track.
|
|
263
|
291
|
*
|
|
264
|
|
- * @param track {JitsiRemoteTrack} the video track for which 'onunmute' event
|
|
|
292
|
+ * @param {JitsiRemoteTrack} track the video track for which 'onunmute' event
|
|
265
|
293
|
* will be processed.
|
|
266
|
294
|
*/
|
|
267
|
295
|
ParticipantConnectionStatus.prototype.onTrackRtcUnmuted = function(track) {
|
|
|
@@ -281,7 +309,7 @@ ParticipantConnectionStatus.prototype.onTrackRtcUnmuted = function(track) {
|
|
281
|
309
|
/**
|
|
282
|
310
|
* Here the signalling "mute"/"unmute" events are processed.
|
|
283
|
311
|
*
|
|
284
|
|
- * @param track {JitsiRemoteTrack} the remote video track for which
|
|
|
312
|
+ * @param {JitsiRemoteTrack} track the remote video track for which
|
|
285
|
313
|
* the signalling mute/unmute event will be processed.
|
|
286
|
314
|
*/
|
|
287
|
315
|
ParticipantConnectionStatus.prototype.onSignallingMuteChanged
|