diff options
Diffstat (limited to 'src/utils/webrtc/simplewebrtc/localmedia.js')
-rw-r--r-- | src/utils/webrtc/simplewebrtc/localmedia.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/utils/webrtc/simplewebrtc/localmedia.js b/src/utils/webrtc/simplewebrtc/localmedia.js index 890961dd4..a7a008923 100644 --- a/src/utils/webrtc/simplewebrtc/localmedia.js +++ b/src/utils/webrtc/simplewebrtc/localmedia.js @@ -634,18 +634,26 @@ LocalMedia.prototype.resume = function() { LocalMedia.prototype._setAudioEnabled = function(bool) { this._audioEnabled = bool - this.localStreams.forEach(function(stream) { - stream.getAudioTracks().forEach(function(track) { + this.localStreams.forEach(stream => { + stream.getAudioTracks().forEach(track => { track.enabled = !!bool + + // MediaStreamTrack does not emit an event when the enabled property + // changes, so it needs to be explicitly notified. + this.emit('localTrackEnabledChanged', track, stream) }) }) } LocalMedia.prototype._setVideoEnabled = function(bool) { this._videoEnabled = bool - this.localStreams.forEach(function(stream) { - stream.getVideoTracks().forEach(function(track) { + this.localStreams.forEach(stream => { + stream.getVideoTracks().forEach(track => { track.enabled = !!bool + + // MediaStreamTrack does not emit an event when the enabled property + // changes, so it needs to be explicitly notified. + this.emit('localTrackEnabledChanged', track, stream) }) }) } |