Browse Source

@uppy/webcam: remove `facingMode` option (#5200)

Mikael Finstad 11 months ago
parent
commit
c7c59b0d07
1 changed files with 4 additions and 10 deletions
  1. 4 10
      packages/@uppy/webcam/src/Webcam.tsx

+ 4 - 10
packages/@uppy/webcam/src/Webcam.tsx

@@ -67,8 +67,6 @@ export interface WebcamOptions<M extends Meta, B extends Body>
   modes?: Array<'video-audio' | 'video-only' | 'audio-only' | 'picture'>
   mirror?: boolean
   showVideoSourceDropdown?: boolean
-  /** @deprecated */
-  facingMode?: MediaTrackConstraints['facingMode'] // @TODO: remove in the next major
   videoConstraints?: MediaTrackConstraints
   showRecordingLength?: boolean
   preferredImageMimeType?: string | null
@@ -94,7 +92,6 @@ const defaultOptions = {
   modes: ['video-audio', 'video-only', 'audio-only', 'picture'] as any,
   mirror: true,
   showVideoSourceDropdown: false,
-  facingMode: 'user', // @TODO: remove in the next major
   preferredImageMimeType: null,
   preferredVideoMimeType: null,
   showRecordingLength: false,
@@ -241,10 +238,8 @@ export default class Webcam<M extends Meta, B extends Body> extends UIPlugin<
         this.opts.modes.indexOf('picture') !== -1)
 
     const videoConstraints = {
-      ...(this.opts.videoConstraints || { facingMode: this.opts.facingMode }),
-      // facingMode takes precedence over deviceId, and not needed
-      // when specific device is selected
-      ...(deviceId ? { deviceId, facingMode: null as any as undefined } : {}),
+      ...(this.opts.videoConstraints || {}),
+      ...(deviceId != null && { deviceId }),
     }
 
     return {
@@ -710,8 +705,7 @@ export default class Webcam<M extends Meta, B extends Body> extends UIPlugin<
   }
 
   install(): void {
-    const { mobileNativeCamera, modes, facingMode, videoConstraints } =
-      this.opts
+    const { mobileNativeCamera, modes, videoConstraints } = this.opts
 
     const { target } = this.opts
     if (mobileNativeCamera && target) {
@@ -720,7 +714,7 @@ export default class Webcam<M extends Meta, B extends Body> extends UIPlugin<
           isModeAvailable(modes, 'video-only') ||
           isModeAvailable(modes, 'video-audio'),
         showNativePhotoCameraButton: isModeAvailable(modes, 'picture'),
-        nativeCameraFacingMode: videoConstraints?.facingMode || facingMode,
+        nativeCameraFacingMode: videoConstraints?.facingMode,
       })
       return
     }