Browse Source

Remove resizeMode due to possible loss of performance

customisations
alemart 3 months ago
parent
commit
2b21c3eeab
2 changed files with 3 additions and 5 deletions
  1. 1
    1
      docs/api/camera-source.md
  2. 2
    4
      src/sources/camera-source.ts

+ 1
- 1
docs/api/camera-source.md View File

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 View File

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,

Loading…
Cancel
Save