Why do the height and width settings in react-webcam become reversed?

Viewed 56

I am using react-webcam configured as follows.

<Webcam
          audio={false}
          screenshotFormat="image/jpeg"
          videoConstraints={{
            facingMode: "environment",
            width: cameraSize.width,
            height: cameraSize.height,
          }}
          width={props.width + "px"}
          height={props.height + "px"}
  />

In chrome on desktop (regardless of screen aspect ratio), the size is set in videoConstraints, but in Android and iOS, the cameraSize.width and cameraSize.height values are set reversed when the camera is in portrait orientation. (It's okay if it's in landscape orientation.)

Example: cameraSize.width=768px, cameraSize.height=1920px, but actually width=1920px, height=768px.

What is the cause of this?

0 Answers
Related