Open lokeshsinghal opened 3 years ago
@lokeshsinghal could you create a demo on CodePen - it will make it easier to help you.
Seeing something similar in iOS 15 Safari. For this code:
const track = this.webcamRef.current.stream.getVideoTracks()[0];
const width = track.getSettings().width; // 1080
const height = track.getSettings().height; // 1920
const camCanvas = this.webcamRef.current.getCanvas({width: width, height: height});
console.log(width, height, camCanvas)
I'm getting this log (note the canvas width="1920"
)
1080 – 1920
<canvas width="1920" height="1080">
Same issue on v6.0.0 and v5.2.4 FWIW
Ok for my issue, it turns out that the first time I called getCanvas
the video wasn't ready yet. So I added a check above my call to getCanvas and it solved my issue. I wonder if @lokeshsinghal's issue is similar.
if (this.webcamRef.current.video.readyState == 0) {
return null;
}
Perhaps we should add a similar check here. @mozmorris want me to submit a PR?
Please follow the general troubleshooting steps first:
Bug reports:
videoConstraints is not working in firefox. I am trying to pass videoConstraint dynamically and works fine in chrome but not in the firefox. I know this issue has been already raised but I tried that solution to pass objectfit cover in style but the result is not expected. I am passing this videoConstraints = { width: 480, height: 720 } but getting the snapshot result of 640 480 instead of 480 720 in firefox.