A humble implementation of a real-time QR-code scanner using WebRTC
npm install react-webcam-qr-scannerbatch
npm install react-webcam-qr-scanner
`
Using Yarn:
`batch
yarn add react-webcam-qr-scanner
`
$3
Here is an example of a simple React component that utilizes `react-webcam-qr-scanner`
`javascript
import React from "react";
import Scanner from "react-webcam-qr-scanner";
const MyAwesomeComponent = (props) => {
const handleDecode = (result) => {
console.log(result);
}
const handleScannerLoad = (mode) => {
console.log(mode);
}
return (
className="some-classname"
onDecode={handleDecode}
onScannerLoad={handleScannerLoad}
constraints={{
audio: false,
video: {
facingMode: "environment"
}
}}
captureSize={{ width: 1280, height: 720 }}
/>
);
}
`
$3
Most of the props are identical to the React \`{ width: number, height: number }`` | Represents the size of the frame area sensitive for QR-detection