Parcourir la source

Adds event for active device list.

master
damencho il y a 9 ans
Parent
révision
5aba0ac3a6
2 fichiers modifiés avec 38 ajouts et 5 suppressions
  1. 24
    5
      modules/statistics/CallStats.js
  2. 14
    0
      modules/statistics/statistics.js

+ 24
- 5
modules/statistics/CallStats.js Voir le fichier

41
     fabricTerminated:"fabricTerminated",
41
     fabricTerminated:"fabricTerminated",
42
     screenShareStart:"screenShareStart",
42
     screenShareStart:"screenShareStart",
43
     screenShareStop:"screenShareStop",
43
     screenShareStop:"screenShareStop",
44
-    dominantSpeaker:"dominantSpeaker"
44
+    dominantSpeaker:"dominantSpeaker",
45
+    activeDeviceList:"activeDeviceList"
45
 };
46
 };
46
 
47
 
47
 var callStats = null;
48
 var callStats = null;
66
             {
67
             {
67
                 var data = report.data;
68
                 var data = report.data;
68
                 callStats.sendFabricEvent(
69
                 callStats.sendFabricEvent(
69
-                    this.peerconnection, data.event, this.confID);
70
+                    this.peerconnection,
71
+                    data.event,
72
+                    this.confID,
73
+                    data.eventData);
70
             }
74
             }
71
         }, this);
75
         }, this);
72
         CallStats.reportsQueue.length = 0;
76
         CallStats.reportsQueue.length = 0;
206
  * Notifies CallStats for mute events
210
  * Notifies CallStats for mute events
207
  * @param mute {boolean} true for muted and false for not muted
211
  * @param mute {boolean} true for muted and false for not muted
208
  * @param type {String} "audio"/"video"
212
  * @param type {String} "audio"/"video"
213
+ * @param {CallStats} cs callstats instance related to the event
209
  */
214
  */
210
 CallStats.sendMuteEvent = _try_catch(function (mute, type, cs) {
215
 CallStats.sendMuteEvent = _try_catch(function (mute, type, cs) {
211
 
216
 
224
  * Notifies CallStats for screen sharing events
229
  * Notifies CallStats for screen sharing events
225
  * @param start {boolean} true for starting screen sharing and
230
  * @param start {boolean} true for starting screen sharing and
226
  * false for not stopping
231
  * false for not stopping
232
+ * @param {CallStats} cs callstats instance related to the event
227
  */
233
  */
228
 CallStats.sendScreenSharingEvent = _try_catch(function (start, cs) {
234
 CallStats.sendScreenSharingEvent = _try_catch(function (start, cs) {
229
 
235
 
233
 
239
 
234
 /**
240
 /**
235
  * Notifies CallStats that we are the new dominant speaker in the conference.
241
  * Notifies CallStats that we are the new dominant speaker in the conference.
242
+ * @param {CallStats} cs callstats instance related to the event
236
  */
243
  */
237
 CallStats.sendDominantSpeakerEvent = _try_catch(function (cs) {
244
 CallStats.sendDominantSpeakerEvent = _try_catch(function (cs) {
238
 
245
 
240
         fabricEvent.dominantSpeaker);
247
         fabricEvent.dominantSpeaker);
241
 });
248
 });
242
 
249
 
250
+/**
251
+ * Notifies CallStats about active device.
252
+ * @param {{deviceList: {String:String}}} list of devices with their data
253
+ * @param {CallStats} cs callstats instance related to the event
254
+ */
255
+CallStats.sendАctiveDeviceListEvent = _try_catch(function (devicesData, cs) {
256
+
257
+    CallStats._reportEvent.call(cs, fabricEvent.activeDeviceList, devicesData);
258
+});
259
+
243
 /**
260
 /**
244
  * Reports an error to callstats.
261
  * Reports an error to callstats.
245
  *
262
  *
246
  * @param type the type of the error, which will be one of the wrtcFuncNames
263
  * @param type the type of the error, which will be one of the wrtcFuncNames
247
  * @param e the error
264
  * @param e the error
248
  * @param pc the peerconnection
265
  * @param pc the peerconnection
266
+ * @param eventData additional data to pass to event
249
  * @private
267
  * @private
250
  */
268
  */
251
-CallStats._reportEvent = function (event) {
269
+CallStats._reportEvent = function (event, eventData) {
252
     if (callStats) {
270
     if (callStats) {
253
-        callStats.sendFabricEvent(this.peerconnection, event, this.confID);
271
+        callStats.sendFabricEvent(
272
+            this.peerconnection, event, this.confID, eventData);
254
     } else {
273
     } else {
255
         CallStats.reportsQueue.push({
274
         CallStats.reportsQueue.push({
256
                 type: reportType.EVENT,
275
                 type: reportType.EVENT,
257
-                data: {event: event}
276
+                data: {event: event, eventData: eventData}
258
             });
277
             });
259
     }
278
     }
260
 };
279
 };

+ 14
- 0
modules/statistics/statistics.js Voir le fichier

251
         CallStats.sendDominantSpeakerEvent(this.callstats);
251
         CallStats.sendDominantSpeakerEvent(this.callstats);
252
 };
252
 };
253
 
253
 
254
+/**
255
+ * Notifies about active device.
256
+ * @param {{deviceList: {String:String}}} list of devices with their data
257
+ */
258
+Statistics.sendАctiveDeviceListEvent = function (devicesData) {
259
+    if (Statistics.callsStatsInstances.length) {
260
+        Statistics.callsStatsInstances.forEach(function (cs) {
261
+            CallStats.sendАctiveDeviceListEvent(devicesData, cs);
262
+        });
263
+    } else {
264
+        CallStats.sendАctiveDeviceListEvent(devicesData, null);
265
+    }
266
+};
267
+
254
 /**
268
 /**
255
  * Lets the underlying statistics module know where is given SSRC rendered by
269
  * Lets the underlying statistics module know where is given SSRC rendered by
256
  * providing renderer tag ID.
270
  * providing renderer tag ID.

Chargement…
Annuler
Enregistrer