Bläddra i källkod

fix(rtc) use exact deviceId constraints

webrtc-adapter transforms "deviceId": "foo" to "deviceId": { ideal:
"foo"}.

This makes the camera non-selectable if the resolution constraints are
not met.

Setting the constraint to exact will sidestep that adapter behavior, and
express stronger intent.
release-8443
Saúl Ibarra Corretgé 1 år sedan
förälder
incheckning
b59b8cb0f1
1 ändrade filer med 5 tillägg och 2 borttagningar
  1. 5
    2
      modules/RTC/RTCUtils.js

+ 5
- 2
modules/RTC/RTCUtils.js Visa fil

@@ -122,7 +122,7 @@ function getConstraints(um = [], options = {}) {
122 122
             }
123 123
         }
124 124
         if (options.cameraDeviceId) {
125
-            constraints.video.deviceId = options.cameraDeviceId;
125
+            constraints.video.deviceId = { exact: options.cameraDeviceId };
126 126
         } else {
127 127
             const facingMode = options.facingMode || CameraFacingMode.USER;
128 128
 
@@ -139,11 +139,14 @@ function getConstraints(um = [], options = {}) {
139 139
 
140 140
         constraints.audio = {
141 141
             autoGainControl: !disableAGC && !disableAP,
142
-            deviceId: options.micDeviceId,
143 142
             echoCancellation: !disableAEC && !disableAP,
144 143
             noiseSuppression: !disableNS && !disableAP
145 144
         };
146 145
 
146
+        if (options.micDeviceId) {
147
+            constraints.audio.deviceId = { exact: options.micDeviceId };
148
+        }
149
+
147 150
         if (stereo) {
148 151
             Object.assign(constraints.audio, { channelCount: 2 });
149 152
         }

Laddar…
Avbryt
Spara