|
@@ -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
|
}
|
|
@@ -2191,7 +2195,14 @@ export default {
|
2191
|
2195
|
return stream;
|
2192
|
2196
|
})
|
2193
|
2197
|
.then(stream => {
|
2194
|
|
- this.useVideoStream(stream);
|
|
2198
|
+ // if we are screen sharing we do not want to stop it
|
|
2199
|
+ if (this.isSharingScreen) {
|
|
2200
|
+ return Promise.resolve();
|
|
2201
|
+ }
|
|
2202
|
+
|
|
2203
|
+ return this.useVideoStream(stream);
|
|
2204
|
+ })
|
|
2205
|
+ .then(() => {
|
2195
|
2206
|
logger.log('switched local video device');
|
2196
|
2207
|
APP.settings.setCameraDeviceId(cameraDeviceId, true);
|
2197
|
2208
|
})
|
|
@@ -2204,6 +2215,8 @@ export default {
|
2204
|
2215
|
APP.UI.addListener(
|
2205
|
2216
|
UIEvents.AUDIO_DEVICE_CHANGED,
|
2206
|
2217
|
micDeviceId => {
|
|
2218
|
+ const audioWasMuted = this.isLocalAudioMuted();
|
|
2219
|
+
|
2207
|
2220
|
sendAnalyticsEvent(
|
2208
|
2221
|
'settings.changeDevice.audioIn');
|
2209
|
2222
|
createLocalTracksF({
|
|
@@ -2212,6 +2225,16 @@ export default {
|
2212
|
2225
|
micDeviceId
|
2213
|
2226
|
})
|
2214
|
2227
|
.then(([ stream ]) => {
|
|
2228
|
+ // if audio was muted before changing the device, mute
|
|
2229
|
+ // with the new device
|
|
2230
|
+ if (audioWasMuted) {
|
|
2231
|
+ return stream.mute()
|
|
2232
|
+ .then(() => stream);
|
|
2233
|
+ }
|
|
2234
|
+
|
|
2235
|
+ return stream;
|
|
2236
|
+ })
|
|
2237
|
+ .then(stream => {
|
2215
|
2238
|
this.useAudioStream(stream);
|
2216
|
2239
|
logger.log('switched local audio device');
|
2217
|
2240
|
APP.settings.setMicDeviceId(micDeviceId, true);
|
|
@@ -2408,10 +2431,6 @@ export default {
|
2408
|
2431
|
const promises = [];
|
2409
|
2432
|
const audioWasMuted = this.isLocalAudioMuted();
|
2410
|
2433
|
const videoWasMuted = this.isLocalVideoMuted();
|
2411
|
|
- const availableAudioInputDevices
|
2412
|
|
- = mediaDeviceHelper.getDevicesFromListByKind(devices, 'audioinput');
|
2413
|
|
- const availableVideoInputDevices
|
2414
|
|
- = mediaDeviceHelper.getDevicesFromListByKind(devices, 'videoinput');
|
2415
|
2434
|
|
2416
|
2435
|
if (typeof newDevices.audiooutput !== 'undefined') {
|
2417
|
2436
|
// Just ignore any errors in catch block.
|
|
@@ -2430,9 +2449,7 @@ export default {
|
2430
|
2449
|
.then(() => {
|
2431
|
2450
|
// If audio was muted before, or we unplugged current device
|
2432
|
2451
|
// and selected new one, then mute new audio track.
|
2433
|
|
- if (audioWasMuted
|
2434
|
|
- || currentDevices.audioinput.length
|
2435
|
|
- > availableAudioInputDevices.length) {
|
|
2452
|
+ if (audioWasMuted) {
|
2436
|
2453
|
sendAnalyticsEvent('deviceListChanged.audio.muted');
|
2437
|
2454
|
logger.log('Audio mute: device list changed');
|
2438
|
2455
|
muteLocalAudio(true);
|
|
@@ -2440,10 +2457,7 @@ export default {
|
2440
|
2457
|
|
2441
|
2458
|
// If video was muted before, or we unplugged current device
|
2442
|
2459
|
// and selected new one, then mute new video track.
|
2443
|
|
- if (!this.isSharingScreen
|
2444
|
|
- && (videoWasMuted
|
2445
|
|
- || currentDevices.videoinput.length
|
2446
|
|
- > availableVideoInputDevices.length)) {
|
|
2460
|
+ if (!this.isSharingScreen && videoWasMuted) {
|
2447
|
2461
|
sendAnalyticsEvent('deviceListChanged.video.muted');
|
2448
|
2462
|
logger.log('Video mute: device list changed');
|
2449
|
2463
|
muteLocalVideo(true);
|