dashboardphilippines / react-webcam-barcode-scanner

[UNMAINTAINED -- PLEASE USE https://github.com/jamenamcinteer/react-qr-barcode-scanner INSTEAD] A simple React Component using the client's webcam to read barcodes.
45 stars 32 forks source link

Remove Microphone access request #7

Open jeremyjs opened 3 years ago

jeremyjs commented 3 years ago

Is the microphone access necessary for some reason? Causes weird audio issues for me on MacOS Chrome in addition to being an unnecessary security vector.

I can take a look at making a PR if this is an approved improvement.

reenan commented 3 years ago

any update on this request? please let's remove this :(

glenkleidon commented 3 years ago

Yes, Can I please ad my vote. There should be no need to enable the microphone. It probably a switch in the zxing library

glenkleidon commented 3 years ago

I believe I have it.

https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#parameters

Video constraints can have the additional to properties { audio: false, video: true }

 return (
    <Webcam
      width={width}
      height={height}
      ref={webcamRef}
      screenshotFormat="image/png"
      videoConstraints={{
        facingMode: 'environment'
      }}
    />
  )

Becomes...

 return (
    <Webcam
      width={width}
      height={height}
      ref={webcamRef}
      screenshotFormat="image/png"
      videoConstraints={{
        facingMode: 'environment',
        audio: false, 
        video: true 
      }}
    />
  )
glenkleidon commented 3 years ago

submitted pull request. #12