Fixes unplugging unused device mutes local audio and video.

This commit is contained in:
damencho 2017-10-17 13:02:41 -05:00
parent cd68a97b95
commit beffdb1e9b
1 changed files with 2 additions and 11 deletions

View File

@ -2408,10 +2408,6 @@ export default {
const promises = []; const promises = [];
const audioWasMuted = this.isLocalAudioMuted(); const audioWasMuted = this.isLocalAudioMuted();
const videoWasMuted = this.isLocalVideoMuted(); const videoWasMuted = this.isLocalVideoMuted();
const availableAudioInputDevices
= mediaDeviceHelper.getDevicesFromListByKind(devices, 'audioinput');
const availableVideoInputDevices
= mediaDeviceHelper.getDevicesFromListByKind(devices, 'videoinput');
if (typeof newDevices.audiooutput !== 'undefined') { if (typeof newDevices.audiooutput !== 'undefined') {
// Just ignore any errors in catch block. // Just ignore any errors in catch block.
@ -2430,9 +2426,7 @@ export default {
.then(() => { .then(() => {
// If audio was muted before, or we unplugged current device // If audio was muted before, or we unplugged current device
// and selected new one, then mute new audio track. // and selected new one, then mute new audio track.
if (audioWasMuted if (audioWasMuted) {
|| currentDevices.audioinput.length
> availableAudioInputDevices.length) {
sendAnalyticsEvent('deviceListChanged.audio.muted'); sendAnalyticsEvent('deviceListChanged.audio.muted');
logger.log('Audio mute: device list changed'); logger.log('Audio mute: device list changed');
muteLocalAudio(true); muteLocalAudio(true);
@ -2440,10 +2434,7 @@ export default {
// If video was muted before, or we unplugged current device // If video was muted before, or we unplugged current device
// and selected new one, then mute new video track. // and selected new one, then mute new video track.
if (!this.isSharingScreen if (!this.isSharingScreen && videoWasMuted) {
&& (videoWasMuted
|| currentDevices.videoinput.length
> availableVideoInputDevices.length)) {
sendAnalyticsEvent('deviceListChanged.video.muted'); sendAnalyticsEvent('deviceListChanged.video.muted');
logger.log('Video mute: device list changed'); logger.log('Video mute: device list changed');
muteLocalVideo(true); muteLocalVideo(true);