Browse Source

Merge pull request #477 from virtuacoplenny/lenny/temasys-stats

fix(stats): Enable stats on temasys
dev1
Дамян Минков 8 years ago
parent
commit
5f43a63b61
2 changed files with 40 additions and 16 deletions
  1. 38
    15
      modules/RTC/JitsiRemoteTrack.js
  2. 2
    1
      modules/statistics/RTPStatsCollector.js

+ 38
- 15
modules/RTC/JitsiRemoteTrack.js View File

@@ -78,30 +78,53 @@ JitsiRemoteTrack.prototype = Object.create(JitsiTrack.prototype);
78 78
 JitsiRemoteTrack.prototype.constructor = JitsiRemoteTrack;
79 79
 
80 80
 JitsiRemoteTrack.prototype._bindMuteHandlers = function() {
81
-    // Bind 'onmute'
81
+    // Use feature detection for finding what event handling function is
82
+    // supported. On Internet Explorer, which uses uses temasys/firebreath, the
83
+    // track will have attachEvent instead of addEventListener.
84
+    //
82 85
     // FIXME it would be better to use recently added '_setHandler' method, but
83 86
     // 1. It does not allow to set more than one handler to the event
84 87
     // 2. It does mix MediaStream('inactive') with MediaStreamTrack events
85 88
     // 3. Allowing to bind more than one event handler requires too much
86 89
     //    refactoring around camera issues detection.
87
-    this.track.addEventListener('mute', () => {
88
-
89
-        logger.debug(
90
-            `"onmute" event(${Date.now()}): `,
91
-            this.getParticipantId(), this.getType(), this.getSSRC());
90
+    if (this.track.addEventListener) {
91
+        this.track.addEventListener('mute', () => this._onTrackMute());
92
+        this.track.addEventListener('unmute', () => this._onTrackUnmute());
93
+    } else if (this.track.attachEvent) {
94
+        // FIXME Internet Explorer is not emitting out mute/unmute events.
95
+        this.track.attachEvent('onmute', () => this._onTrackMute());
96
+        this.track.attachEvent('onunmute', () => this._onTrackUnmute());
97
+    }
98
+};
92 99
 
93
-        this.rtc.eventEmitter.emit(RTCEvents.REMOTE_TRACK_MUTE, this);
94
-    });
100
+/**
101
+ * Callback invoked when the track is muted. Emits an event notifying listeners
102
+ * of the mute event.
103
+ *
104
+ * @private
105
+ * @returns {void}
106
+ */
107
+JitsiRemoteTrack.prototype._onTrackMute = function() {
108
+    logger.debug(
109
+        `"onmute" event(${Date.now()}): `,
110
+        this.getParticipantId(), this.getType(), this.getSSRC());
95 111
 
96
-    // Bind 'onunmute'
97
-    this.track.addEventListener('unmute', () => {
112
+    this.rtc.eventEmitter.emit(RTCEvents.REMOTE_TRACK_MUTE, this);
113
+};
98 114
 
99
-        logger.debug(
100
-            `"onunmute" event(${Date.now()}): `,
101
-            this.getParticipantId(), this.getType(), this.getSSRC());
115
+/**
116
+ * Callback invoked when the track is unmuted. Emits an event notifying
117
+ * listeners of the mute event.
118
+ *
119
+ * @private
120
+ * @returns {void}
121
+ */
122
+JitsiRemoteTrack.prototype._onTrackUnmute = function() {
123
+    logger.debug(
124
+        `"onunmute" event(${Date.now()}): `,
125
+        this.getParticipantId(), this.getType(), this.getSSRC());
102 126
 
103
-        this.rtc.eventEmitter.emit(RTCEvents.REMOTE_TRACK_UNMUTE, this);
104
-    });
127
+    this.rtc.eventEmitter.emit(RTCEvents.REMOTE_TRACK_UNMUTE, this);
105 128
 };
106 129
 
107 130
 /**

+ 2
- 1
modules/statistics/RTPStatsCollector.js View File

@@ -7,7 +7,8 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);
7 7
 /* Whether we support the browser we are running into for logging statistics */
8 8
 const browserSupported = RTCBrowserType.isChrome()
9 9
         || RTCBrowserType.isOpera() || RTCBrowserType.isFirefox()
10
-        || RTCBrowserType.isNWJS() || RTCBrowserType.isElectron();
10
+        || RTCBrowserType.isNWJS() || RTCBrowserType.isElectron()
11
+        || RTCBrowserType.isTemasysPluginUsed();
11 12
 
12 13
 /**
13 14
  * The lib-jitsi-meet browser-agnostic names of the browser-specific keys

Loading…
Cancel
Save