Преглед изворни кода

Skips setting output to element when there is no user selection.

dev1
damencho пре 9 година
родитељ
комит
b9fe4a83dd
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6
    1
      modules/RTC/RTCUtils.js

+ 6
- 1
modules/RTC/RTCUtils.js Прегледај датотеку

@@ -32,6 +32,8 @@ var devices = {
32 32
 // Currently audio output device change is supported only in Chrome and
33 33
 // default output always has 'default' device ID
34 34
 var audioOutputDeviceId = 'default'; // default device
35
+// whether user has explicitly set a device to use
36
+var audioOutputChanged = false;
35 37
 // Disables Acoustic Echo Cancellation
36 38
 var disableAEC = false;
37 39
 // Disables Noise Suppression
@@ -650,7 +652,9 @@ function wrapAttachMediaStream(origAttachMediaStream) {
650 652
         if (stream
651 653
                 && RTCUtils.isDeviceChangeAvailable('output')
652 654
                 && stream.getAudioTracks
653
-                && stream.getAudioTracks().length) {
655
+                && stream.getAudioTracks().length
656
+                // we skip setting audio output if there was no explicit change
657
+                && audioOutputChanged) {
654 658
             element.setSinkId(RTCUtils.getAudioOutputDevice())
655 659
                 .catch(function (ex) {
656 660
                     var err = new JitsiTrackError(ex, null, ['audiooutput']);
@@ -1228,6 +1232,7 @@ var RTCUtils = {
1228 1232
         return featureDetectionAudioEl.setSinkId(deviceId)
1229 1233
             .then(function() {
1230 1234
                 audioOutputDeviceId = deviceId;
1235
+                audioOutputChanged = true;
1231 1236
 
1232 1237
                 logger.log('Audio output device set to ' + deviceId);
1233 1238
 

Loading…
Откажи
Сачувај