Closed pawan-khade closed 2 years ago
Instead of imperatively stopping the camera, would it not be easier to unmount the component:
const [isActive, setIsActive] = useState(true)
return (
<div>
{isActive && <Webcam />}
<button onClick={() => setIsActive(prev => !prev)} >Toggle Camera</button>
</div>
)
dear sir,
I have stopped my webcam using code suggested on your codepen
Now without refreshing the page I want to start stopped webcam with its video on clicking start button. How to do that?