瀏覽代碼

getUserMedia: prefer the "user" camera if we have not specified the exact device id for mobile devices

dev1
tsareg 9 年之前
父節點
當前提交
740f152958
共有 1 個檔案被更改,包括 7 行新增1 行删除
  1. 7
    1
      modules/RTC/RTCUtils.js

+ 7
- 1
modules/RTC/RTCUtils.js 查看文件

@@ -119,6 +119,12 @@ function getConstraints(um, options) {
119 119
             constraints.video.optional.push({
120 120
                 sourceId: options.cameraDeviceId
121 121
             });
122
+        } else {
123
+            // by default prefer the "user" camera if we have not specified the
124
+            // exact device id for mobile devices
125
+            if (RTCBrowserType.isReactNative() || RTCBrowserType.isAndroid()) {
126
+                constraints.video.facingMode = "user";
127
+            }
122 128
         }
123 129
 
124 130
         constraints.video.optional.push({ googLeakyBucket: true });
@@ -603,7 +609,7 @@ var RTCUtils = {
603 609
             disableNS = options.disableNS;
604 610
             logger.info("Disable NS: " + disableNS);
605 611
         }
606
-        
612
+
607 613
         return new Promise(function(resolve, reject) {
608 614
             if (RTCBrowserType.isFirefox()) {
609 615
                 var FFversion = RTCBrowserType.getFirefoxVersion();

Loading…
取消
儲存