|
@@ -44,29 +44,27 @@ LocalStream.prototype.isAudioStream = function () {
|
44
|
44
|
return this.type === "audio";
|
45
|
45
|
};
|
46
|
46
|
|
47
|
|
-LocalStream.prototype.setMute = function(mute)
|
|
47
|
+LocalStream.prototype.setMute = function (mute)
|
48
|
48
|
{
|
|
49
|
+ var isAudio = this.isAudioStream();
|
|
50
|
+ var eventType = isAudio ? RTCEvents.AUDIO_MUTE : RTCEvents.VIDEO_MUTE;
|
49
|
51
|
|
50
|
|
- if((window.location.protocol != "https:" && this.isGUMStream) ||
|
51
|
|
- (this.isAudioStream() && this.isGUMStream) || this.videoType === "screen")
|
|
52
|
+ if ((window.location.protocol != "https:" && this.isGUMStream) ||
|
|
53
|
+ (isAudio && this.isGUMStream) || this.videoType === "screen")
|
52
|
54
|
{
|
53
|
55
|
var tracks = this.getTracks();
|
54
|
56
|
|
55
|
57
|
for (var idx = 0; idx < tracks.length; idx++) {
|
56
|
|
- tracks[idx].enabled = mute;
|
|
58
|
+ tracks[idx].enabled = !mute;
|
57
|
59
|
}
|
58
|
|
- this.eventEmitter.emit(
|
59
|
|
- (this.type == "audio"? RTCEvents.AUDIO_MUTE : RTCEvents.VIDEO_MUTE),
|
60
|
|
- !mute);
|
|
60
|
+ this.eventEmitter.emit(eventType, mute);
|
61
|
61
|
}
|
62
|
62
|
else
|
63
|
63
|
{
|
64
|
|
- if(mute === false) {
|
|
64
|
+ if (mute) {
|
65
|
65
|
APP.xmpp.removeStream(this.stream);
|
66
|
66
|
this.stream.stop();
|
67
|
|
- this.eventEmitter.emit(
|
68
|
|
- (this.type == "audio"? RTCEvents.AUDIO_MUTE : RTCEvents.VIDEO_MUTE),
|
69
|
|
- true);
|
|
67
|
+ this.eventEmitter.emit(eventType, true);
|
70
|
68
|
}
|
71
|
69
|
else
|
72
|
70
|
{
|
|
@@ -74,22 +72,18 @@ LocalStream.prototype.setMute = function(mute)
|
74
|
72
|
APP.RTC.rtcUtils.obtainAudioAndVideoPermissions(
|
75
|
73
|
(this.isAudioStream() ? ["audio"] : ["video"]),
|
76
|
74
|
function (stream) {
|
77
|
|
- if(self.isAudioStream())
|
|
75
|
+ if (isAudio)
|
78
|
76
|
{
|
79
|
77
|
APP.RTC.changeLocalAudio(stream,
|
80
|
78
|
function () {
|
81
|
|
- self.eventEmitter.emit(
|
82
|
|
- (self.type == "audio"? RTCEvents.AUDIO_MUTE : RTCEvents.VIDEO_MUTE),
|
83
|
|
- true);
|
|
79
|
+ self.eventEmitter.emit(eventType, false);
|
84
|
80
|
});
|
85
|
81
|
}
|
86
|
82
|
else
|
87
|
83
|
{
|
88
|
84
|
APP.RTC.changeLocalVideo(stream, false,
|
89
|
85
|
function () {
|
90
|
|
- self.eventEmitter.emit(
|
91
|
|
- (self.type == "audio"? RTCEvents.AUDIO_MUTE : RTCEvents.VIDEO_MUTE),
|
92
|
|
- true);
|
|
86
|
+ self.eventEmitter.emit(eventType, false);
|
93
|
87
|
});
|
94
|
88
|
}
|
95
|
89
|
});
|