|
|
@@ -2375,11 +2375,24 @@ export default {
|
|
2375
|
2375
|
createLocalTracksF,
|
|
2376
|
2376
|
newDevices.videoinput,
|
|
2377
|
2377
|
newDevices.audioinput)
|
|
2378
|
|
- .then(tracks =>
|
|
2379
|
|
- Promise.all(this._setLocalAudioVideoStreams(tracks)))
|
|
|
2378
|
+ .then(tracks => {
|
|
|
2379
|
+ // If audio or video muted before, or we unplugged current
|
|
|
2380
|
+ // device and selected new one, then mute new track.
|
|
|
2381
|
+ const muteSyncPromises = tracks.map(track => {
|
|
|
2382
|
+ if ((track.isVideoTrack() && videoWasMuted)
|
|
|
2383
|
+ || (track.isAudioTrack() && audioWasMuted)) {
|
|
|
2384
|
+ return track.mute();
|
|
|
2385
|
+ }
|
|
|
2386
|
+
|
|
|
2387
|
+ return Promise.resolve();
|
|
|
2388
|
+ });
|
|
|
2389
|
+
|
|
|
2390
|
+ return Promise.all(muteSyncPromises)
|
|
|
2391
|
+ .then(() => Promise.all(
|
|
|
2392
|
+ this._setLocalAudioVideoStreams(tracks)));
|
|
|
2393
|
+ })
|
|
2380
|
2394
|
.then(() => {
|
|
2381
|
|
- // If audio was muted before, or we unplugged current device
|
|
2382
|
|
- // and selected new one, then mute new audio track.
|
|
|
2395
|
+ // Log and sync known mute state.
|
|
2383
|
2396
|
if (audioWasMuted) {
|
|
2384
|
2397
|
sendAnalytics(createTrackMutedEvent(
|
|
2385
|
2398
|
'audio',
|
|
|
@@ -2388,8 +2401,6 @@ export default {
|
|
2388
|
2401
|
muteLocalAudio(true);
|
|
2389
|
2402
|
}
|
|
2390
|
2403
|
|
|
2391
|
|
- // If video was muted before, or we unplugged current device
|
|
2392
|
|
- // and selected new one, then mute new video track.
|
|
2393
|
2404
|
if (!this.isSharingScreen && videoWasMuted) {
|
|
2394
|
2405
|
sendAnalytics(createTrackMutedEvent(
|
|
2395
|
2406
|
'video',
|