Closed rjworks closed 2 years ago
@cupof2 can you provide some code? or perhaps a link to your application?
import React from 'react';
import Webcam from 'react-webcam';
const videoConstraints = {
facingMode: 'environment',
width: 1080,
height: 720,
};
const Camera = () => {
const webcamRef = React.useRef(null);
const capture = async () => {
const image = webcamRef.current.getScreenshot();
console.log(image);
};
return (
<div>
<Webcam
audio={false}
ref={webcamRef}
screenshotFormat="image/jpeg"
screenshotQuality={1}
videoConstraints={videoConstraints}
/>
<button onClick={capture}>Capture</button>
</div>
);
};
export default Camera;
When this component is rendered, it asks for camera permission on desktop but not on mobile
Does the demo work for you? codepen.io/mozmorris/pen/jlzdop
Does the demo work for you? codepen.io/mozmorris/pen/jlzdop
Demo works for me on iPad iOS 15
@cupof2 have you got a link to your application? Did you read the issue guide before posting? For example, is you application being served over https?
The code supplied looks like one of the demo's created on Codepen, which leads me to think you're hosting this locally and probably not using https.
Yes, I am hosting locally. Could that be the reason why?
I do not have a production link at the moment.
@cupof2 yes - this is stated when you open a new issue and at the top of the README. I don't know if this is exactly your problem but it usually is for most people.
Taking time to read the guide and the contributing instructions takes a couple of minutes. Unfortunately in my experience a lot of developers are far too quick to open an issue. I can usually spot these types as their issues only contain a single sentence with no other information.
Please don't take this personally, you're not alone.
doesnt ask permission on mobile (safari, ios 15)