how to open camera without user permission in react-webcam and when the user turn it off close the page
function Quiz1page1() {
const webRef=useRef(null);
const webStyle={
position:'relative',left:'600px',top:'300px'
}
return (
<div className='Content'>
<fieldset className='bg-light '>
<p className='question p-2' > What is the capital of England?</p>
<input className='answers' type="text" id="text" name="fav_language" />
</fieldset>
<Link to="/Quiz1page2">
<button id='SubmitBtn' className='Next btn btn-dark mt-3 btn'>Next</button>
</Link>
<Webcam style={webStyle} audio={false} width={350} refs={webRef} />
<br/>
</div>
)
}
CodePudding user response:
This is not possible on most of the devices configuration. Fortunately because that is an privacy violation act
CodePudding user response:
Modern browsers ask for permissions to access to the camera. You cannot access camera without permission under normal circumstantial.