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