Переглянути джерело

Adds event for active device list.

dev1
damencho 9 роки тому
джерело
коміт
5aba0ac3a6
2 змінених файлів з 38 додано та 5 видалено
  1. 24
    5
      modules/statistics/CallStats.js
  2. 14
    0
      modules/statistics/statistics.js

+ 24
- 5
modules/statistics/CallStats.js Переглянути файл

@@ -41,7 +41,8 @@ var fabricEvent = {
41 41
     fabricTerminated:"fabricTerminated",
42 42
     screenShareStart:"screenShareStart",
43 43
     screenShareStop:"screenShareStop",
44
-    dominantSpeaker:"dominantSpeaker"
44
+    dominantSpeaker:"dominantSpeaker",
45
+    activeDeviceList:"activeDeviceList"
45 46
 };
46 47
 
47 48
 var callStats = null;
@@ -66,7 +67,10 @@ function initCallback (err, msg) {
66 67
             {
67 68
                 var data = report.data;
68 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 75
         }, this);
72 76
         CallStats.reportsQueue.length = 0;
@@ -206,6 +210,7 @@ function (ssrc, isLocal, usageLabel, containerId) {
206 210
  * Notifies CallStats for mute events
207 211
  * @param mute {boolean} true for muted and false for not muted
208 212
  * @param type {String} "audio"/"video"
213
+ * @param {CallStats} cs callstats instance related to the event
209 214
  */
210 215
 CallStats.sendMuteEvent = _try_catch(function (mute, type, cs) {
211 216
 
@@ -224,6 +229,7 @@ CallStats.sendMuteEvent = _try_catch(function (mute, type, cs) {
224 229
  * Notifies CallStats for screen sharing events
225 230
  * @param start {boolean} true for starting screen sharing and
226 231
  * false for not stopping
232
+ * @param {CallStats} cs callstats instance related to the event
227 233
  */
228 234
 CallStats.sendScreenSharingEvent = _try_catch(function (start, cs) {
229 235
 
@@ -233,6 +239,7 @@ CallStats.sendScreenSharingEvent = _try_catch(function (start, cs) {
233 239
 
234 240
 /**
235 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 244
 CallStats.sendDominantSpeakerEvent = _try_catch(function (cs) {
238 245
 
@@ -240,21 +247,33 @@ CallStats.sendDominantSpeakerEvent = _try_catch(function (cs) {
240 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 261
  * Reports an error to callstats.
245 262
  *
246 263
  * @param type the type of the error, which will be one of the wrtcFuncNames
247 264
  * @param e the error
248 265
  * @param pc the peerconnection
266
+ * @param eventData additional data to pass to event
249 267
  * @private
250 268
  */
251
-CallStats._reportEvent = function (event) {
269
+CallStats._reportEvent = function (event, eventData) {
252 270
     if (callStats) {
253
-        callStats.sendFabricEvent(this.peerconnection, event, this.confID);
271
+        callStats.sendFabricEvent(
272
+            this.peerconnection, event, this.confID, eventData);
254 273
     } else {
255 274
         CallStats.reportsQueue.push({
256 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 Переглянути файл

@@ -251,6 +251,20 @@ Statistics.prototype.sendDominantSpeakerEvent = function () {
251 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 269
  * Lets the underlying statistics module know where is given SSRC rendered by
256 270
  * providing renderer tag ID.

Завантаження…
Відмінити
Зберегти