Browse Source

Fixes changing device unmutes you in a conference.

j8
damencho 8 years ago
parent
commit
ade5290013
2 changed files with 18 additions and 2 deletions
  1. 17
    1
      conference.js
  2. 1
    1
      react/features/base/tracks/actions.js

+ 17
- 1
conference.js View File

2176
         APP.UI.addListener(
2176
         APP.UI.addListener(
2177
             UIEvents.VIDEO_DEVICE_CHANGED,
2177
             UIEvents.VIDEO_DEVICE_CHANGED,
2178
             cameraDeviceId => {
2178
             cameraDeviceId => {
2179
+                const videoWasMuted = this.isLocalVideoMuted();
2180
+
2179
                 sendAnalyticsEvent('settings.changeDevice.video');
2181
                 sendAnalyticsEvent('settings.changeDevice.video');
2180
                 createLocalTracksF({
2182
                 createLocalTracksF({
2181
                     devices: [ 'video' ],
2183
                     devices: [ 'video' ],
2183
                     micDeviceId: null
2185
                     micDeviceId: null
2184
                 })
2186
                 })
2185
                 .then(([ stream ]) => {
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
                         return stream.mute()
2191
                         return stream.mute()
2188
                             .then(() => stream);
2192
                             .then(() => stream);
2189
                     }
2193
                     }
2204
         APP.UI.addListener(
2208
         APP.UI.addListener(
2205
             UIEvents.AUDIO_DEVICE_CHANGED,
2209
             UIEvents.AUDIO_DEVICE_CHANGED,
2206
             micDeviceId => {
2210
             micDeviceId => {
2211
+                const audioWasMuted = this.isLocalAudioMuted();
2212
+
2207
                 sendAnalyticsEvent(
2213
                 sendAnalyticsEvent(
2208
                     'settings.changeDevice.audioIn');
2214
                     'settings.changeDevice.audioIn');
2209
                 createLocalTracksF({
2215
                 createLocalTracksF({
2212
                     micDeviceId
2218
                     micDeviceId
2213
                 })
2219
                 })
2214
                 .then(([ stream ]) => {
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
                     this.useAudioStream(stream);
2231
                     this.useAudioStream(stream);
2216
                     logger.log('switched local audio device');
2232
                     logger.log('switched local audio device');
2217
                     APP.settings.setMicDeviceId(micDeviceId, true);
2233
                     APP.settings.setMicDeviceId(micDeviceId, true);

+ 1
- 1
react/features/base/tracks/actions.js View File

165
                             logger.log(`Replace ${newTrack.getType()} track - ${
165
                             logger.log(`Replace ${newTrack.getType()} track - ${
166
                                 isMuted ? 'muted' : 'unmuted'}`);
166
                                 isMuted ? 'muted' : 'unmuted'}`);
167
 
167
 
168
-                            return dispatch(setMuted());
168
+                            return dispatch(setMuted(isMuted));
169
                         }
169
                         }
170
                     })
170
                     })
171
                     .then(() => {
171
                     .then(() => {

Loading…
Cancel
Save