react-qr-scanner icon indicating copy to clipboard operation
react-qr-scanner copied to clipboard

Turn on/off camera

Open drigos opened this issue 4 years ago • 5 comments

Is there a way to turn camera off and on?

drigos avatar May 11 '20 06:05 drigos

Same question - how to turn off/on camera?

yeungma avatar Sep 05 '20 08:09 yeungma

@drigos @yeungma What do you mean by that? Do you want to stops video stream? OR phyisycally turn camera off?

kybarg avatar Nov 03 '20 17:11 kybarg

Hi, I don't know how to turn off camera by code. Just can do that by closing the app or browser tab.

On Wed, Nov 4, 2020, 01:40 Ruslan Kyba [email protected] wrote:

@drigos https://github.com/drigos @yeungma https://github.com/yeungma What do you mean by that? Do you want to stops video stream? OR phyisycally turn camera off?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kybarg/react-qr-scanner/issues/21#issuecomment-721277943, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQJNB3LGNFANDJ7KIIFX7LSOA6CFANCNFSM4M5T7MTQ .

yeungma avatar Nov 05 '20 00:11 yeungma

The cam turn off when you unmount component

piiok avatar Dec 02 '20 14:12 piiok

this works for me in my react project

set a hook eg. const [camera, setCamear] = useState(false);

assign a button to toggle this hook, then use this hook to control 《QrReader》 in the render section {camera && 《QrReader》 }

kevin-ping avatar Mar 20 '21 14:03 kevin-ping