|
@@ -2176,6 +2176,8 @@ export default {
|
2176
|
2176
|
APP.UI.addListener(
|
2177
|
2177
|
UIEvents.VIDEO_DEVICE_CHANGED,
|
2178
|
2178
|
cameraDeviceId => {
|
|
2179
|
+ const videoWasMuted = this.isLocalVideoMuted();
|
|
2180
|
+
|
2179
|
2181
|
sendAnalyticsEvent('settings.changeDevice.video');
|
2180
|
2182
|
createLocalTracksF({
|
2181
|
2183
|
devices: [ 'video' ],
|
|
@@ -2183,7 +2185,9 @@ export default {
|
2183
|
2185
|
micDeviceId: null
|
2184
|
2186
|
})
|
2185
|
2187
|
.then(([ stream ]) => {
|
2186
|
|
- if (this.isAudioOnly()) {
|
|
2188
|
+ // if we are in audio only mode or video was muted before
|
|
2189
|
+ // changing device, then mute
|
|
2190
|
+ if (this.isAudioOnly() || videoWasMuted) {
|
2187
|
2191
|
return stream.mute()
|
2188
|
2192
|
.then(() => stream);
|
2189
|
2193
|
}
|
|
@@ -2204,6 +2208,8 @@ export default {
|
2204
|
2208
|
APP.UI.addListener(
|
2205
|
2209
|
UIEvents.AUDIO_DEVICE_CHANGED,
|
2206
|
2210
|
micDeviceId => {
|
|
2211
|
+ const audioWasMuted = this.isLocalAudioMuted();
|
|
2212
|
+
|
2207
|
2213
|
sendAnalyticsEvent(
|
2208
|
2214
|
'settings.changeDevice.audioIn');
|
2209
|
2215
|
createLocalTracksF({
|
|
@@ -2212,6 +2218,16 @@ export default {
|
2212
|
2218
|
micDeviceId
|
2213
|
2219
|
})
|
2214
|
2220
|
.then(([ stream ]) => {
|
|
2221
|
+ // if audio was muted before changing the device, mute
|
|
2222
|
+ // with the new device
|
|
2223
|
+ if (audioWasMuted) {
|
|
2224
|
+ return stream.mute()
|
|
2225
|
+ .then(() => stream);
|
|
2226
|
+ }
|
|
2227
|
+
|
|
2228
|
+ return stream;
|
|
2229
|
+ })
|
|
2230
|
+ .then(stream => {
|
2215
|
2231
|
this.useAudioStream(stream);
|
2216
|
2232
|
logger.log('switched local audio device');
|
2217
|
2233
|
APP.settings.setMicDeviceId(micDeviceId, true);
|