Open faisvsqrl opened 10 months ago
Does it happen on iOS 17? Because I have the same problem in mobile safari.
It looks like the phone camera sends wrong video media stream size.
As a workaround for now, you can add style={{ objectFit: "cover" }}
. The underlying image is still in portrait but it at least it's displayed within the constraints.
For example:
<Webcam
ref={webcamRef}
audio={false}
width={720}
height={480}
screenshotQuality={1}
screenshotFormat="image/png"
className="scale-x-[-1] rounded-lg max-w-full aspect-[3/2]"
style={{ objectFit: 'cover' }}
videoConstraints={{ width: 720, height: 480 }}
onUserMedia={handleCameraLoaded}
/>
Video cam recording always record as horizontal even param pass for vertical
const videoConstraints = { audio: false, video: { deviceId: selectedCamera, width: { ideal: 720 }, height: { ideal: 1280}, }, }; const audioConstraints = { audio: true }; const audioStream = await navigator.mediaDevices.getUserMedia(audioConstraints); const videoStream = await navigator.mediaDevices.getUserMedia(videoConstraints); setPermission(true); const combinedStream = new MediaStream([...videoStream.getVideoTracks(), ...audioStream.getAudioTracks()]); setStream(combinedStream);