浏览代码

Remove resizeMode due to possible loss of performance

customisations
alemart 2 个月前
父节点
当前提交
2b21c3eeab
共有 2 个文件被更改,包括 3 次插入5 次删除
  1. 1
    1
      docs/api/camera-source.md
  2. 2
    4
      src/sources/camera-source.ts

+ 1
- 1
docs/api/camera-source.md 查看文件

19
 
19
 
20
 !!! tip "Landscape × Portrait"
20
 !!! tip "Landscape × Portrait"
21
 
21
 
22
-    You generally do not need to specify an `aspectRatio`, as encantar.js uses a suitable default. When customizing this setting, pick standard values for landscape mode such as `16/9` or `4/3`. Pick such values even if mobile devices are expected to be in portrait mode. Using arbitrary numbers is discouraged and may produce unexpected results in different devices.
22
+    You generally do not need to specify an `aspectRatio`, as encantar.js uses a suitable default. When customizing this setting, pick standard values for landscape mode such as `16/9` or `4/3`. Pick such values even if mobile devices are expected to be in portrait mode. Using arbitrary numbers is discouraged and may produce unexpected results in different devices and browsers.
23
 
23
 
24
 **Returns**
24
 **Returns**
25
 
25
 

+ 2
- 4
src/sources/camera-source.ts 查看文件

116
         // set up media constraints
116
         // set up media constraints
117
         const idealSize = Utils.resolution(options.resolution, options.aspectRatio);
117
         const idealSize = Utils.resolution(options.resolution, options.aspectRatio);
118
         const userConstraints = options.constraints;
118
         const userConstraints = options.constraints;
119
-        const ourConstraints/*: MediaTrackConstraints*/ = {
119
+        const ourConstraints: MediaTrackConstraints = {
120
             width: { ideal: idealSize.width },
120
             width: { ideal: idealSize.width },
121
-            height: { ideal: idealSize.height },
122
-            resizeMode: 'none' // request native resolution to encourage usage of standard resolutions
123
-                               // users can opt-in to 'crop-and-scale' if they so desire
121
+            height: { ideal: idealSize.height }
124
         };
122
         };
125
         const constraints: MediaStreamConstraints = {
123
         const constraints: MediaStreamConstraints = {
126
             audio: false,
124
             audio: false,

正在加载...
取消
保存