Bläddra i källkod

Remove resizeMode due to possible loss of performance

customisations
alemart 2 månader sedan
förälder
incheckning
2b21c3eeab
2 ändrade filer med 3 tillägg och 5 borttagningar
  1. 1
    1
      docs/api/camera-source.md
  2. 2
    4
      src/sources/camera-source.ts

+ 1
- 1
docs/api/camera-source.md Visa fil

@@ -19,7 +19,7 @@ Create a new webcam-based source of data with the specified `settings`.
19 19
 
20 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 24
 **Returns**
25 25
 

+ 2
- 4
src/sources/camera-source.ts Visa fil

@@ -116,11 +116,9 @@ export class CameraSource extends VideoSource
116 116
         // set up media constraints
117 117
         const idealSize = Utils.resolution(options.resolution, options.aspectRatio);
118 118
         const userConstraints = options.constraints;
119
-        const ourConstraints/*: MediaTrackConstraints*/ = {
119
+        const ourConstraints: MediaTrackConstraints = {
120 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 123
         const constraints: MediaStreamConstraints = {
126 124
             audio: false,

Laddar…
Avbryt
Spara