{"_id":"instascan","_rev":"12-091481ff5a4ad5da62c1c2ee3d1fb304","name":"instascan","time":{"modified":"2022-06-19T01:38:24.433Z","created":"2016-07-12T13:05:33.075Z","0.0.1":"2016-07-12T13:05:33.075Z","0.0.2":"2016-07-12T13:07:14.485Z","0.0.3":"2016-07-18T04:39:43.149Z","1.0.0":"2017-01-26T01:06:36.858Z","2.0.0":"2017-04-19T06:26:06.712Z","2.0.0-rc.2":"2017-04-19T06:34:04.881Z","2.0.0-rc.3":"2017-04-19T06:51:39.525Z","2.0.0-rc.4":"2017-04-26T03:37:50.129Z"},"maintainers":[{"name":"schmich","email":"schmch@gmail.com"}],"dist-tags":{"latest":"1.0.0","test":"2.0.0-rc.3","next":"2.0.0-rc.4"},"description":"Webcam-driven QR code scanner.","readme":"# ![Instascan](https://raw.githubusercontent.com/schmich/instascan/master/assets/qr.png) Instascan\nReal-time webcam-driven HTML5 QR code scanner.\n\n## Installing\n\n*Note:* Chrome requires HTTPS when using the WebRTC API. Any pages using this library should be served over HTTPS.\n\n### NPM\n\n`npm install --save instascan`\n\n```javascript\nvar Instascan = require('instascan');\n```\n\n### Bower\n\nPending. [Drop a note](https://github.com/schmich/instascan/issues/31) if you need Bower support.\n\n### Minified\n\nCopy `instascan.min.js` from the [releases](https://github.com/schmich/instascan/releases) page and load with:\n\n```html\n<script type=\"text/javascript\" src=\"instascan.min.js\"></script>\n```\n\n## Example\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <title>Instascan</title>\n    <script type=\"text/javascript\" src=\"instascan.min.js\"></script>\n  </head>\n  <body>\n    <video id=\"preview\"></video>\n    <script type=\"text/javascript\">\n      var scanner = new Instascan.Scanner({ video: document.getElementById('preview') });\n      scanner.addListener('scan', function (content, image) {\n        console.log(content);\n      });\n\n      Instascan.Camera.getCameras().then(function (cameras) {\n        if (cameras.length > 0) {\n          scanner.start(cameras[0]);\n        }\n      });\n    </script>\n  </body>\n</html>\n```\n\n## API\n\n### var scanner = new Instascan.Scanner(opts)\n\n- Create a new scanner with options.\n- `opts.continuous`: Whether to scan continuously for QR codes. If `false`, use [`scanner.scan`](#var-result--scannerscan) to manually scan. Default `true`.\n- `opts.video`: The HTML element to use for the camera's video preview. Must be a `<video>` element. When the camera is active, this element will have the `active` CSS class, otherwise, it will have the `inactive` class. By default, an invisible element will be created to host the video.\n- `opts.mirror`: Whether to horizontally mirror the video preview. This is helpful when trying to scan a QR code with a user-facing camera. Default `true`.\n- `opts.captureImage`: Whether to include the scanned image data as part of the scan result. See the `scan` event for format details. Default `false`.\n- `opts.backgroundScan`: Only applies to continuous mode. Whether to actively scan when the tab is not active. When `false`, this reduces CPU usage when the tab is not active. Default `false`.\n- `opts.refractoryPeriod`: Only applies to continuous mode. The period, in milliseconds, before the same QR code will be recognized in succession. Default `5000`.\n- `opts.scanPeriod`: Only applies to continuous mode. The period, in rendered frames, between scans. A lower scan period increases CPU usage but makes scan response faster. Default `1` (i.e. analyze every frame).\n\n### scanner.start(camera)\n\n- Activate `camera` and start scanning using it as the source. Returns promise.\n- This must be called in order to use [`scanner.scan`](#var-result--scannerscan) or receive [`scan`](#scanneraddlistenerscan-callback) events.\n- `camera`: Instance of `Instascan.Camera` from [`Instascan.Camera.getCameras`](#instascancameragetcameras).\n- Continuation: `function ()`, called when camera is active and scanning has started.\n\n### scanner.stop()\n\n- Stop scanning and deactivate the camera. Returns promise.\n- Continuation: `function ()`, called when camera and scanning have stopped.\n\n### var result = scanner.scan()\n\n- Scan video immediately for a QR code.\n- QR codes recognized with this method are not raised via the `scan` event.\n- If no QR code is detected, `result` is `null`.\n- `result.content`: Scanned content decoded from the QR code.\n- `result.image`: Undefined if [`scanner.captureImage`](#var-scanner--new-instascanscanneropts) is `false`, otherwise, see the [`scan`](#scanneraddlistenerscan-callback) event for format.\n\n### scanner.addListener('scan', callback)\n\n- Raised when a QR code is scanned using the camera in continuous mode (see [`scanner.continuous`](#var-scanner--new-instascanscanneropts)).\n- `callback`: `function (content, image)`\n- `content`: Scanned content decoded from the QR code.\n- `image`: `null` if [`scanner.captureImage`](#var-scanner--new-instascanscanneropts) is `false`, otherwise, a base64-encoded [WebP](https://en.wikipedia.org/wiki/WebP)-compressed data URI of the camera frame used to decode the QR code.\n\n### scanner.addListener('active', callback)\n\n- Raised when the scanner becomes active as the result of [`scanner.start`](#scannerstartcamera) or the tab gaining focus.\n- If `opts.video` element was specified, it will have the `active` CSS class.\n- `callback`: `function ()`\n\n### scanner.addListener('inactive', callback)\n\n- Raised when the scanner becomes inactive as the result of [`scanner.stop`](#scannerstop) or the tab losing focus.\n- If `opts.video` element was specified, it will have the `inactive` CSS class.\n- `callback`: `function ()`\n\n### Instascan.Camera.getCameras()\n\n- Enumerate available video devices. Returns promise.\n- Continuation: `function (cameras)`, called when cameras are available.\n- `cameras`: Array of `Instascan.Camera` instances available for use.\n\n### camera.id\n\n- Unique camera ID provided by the browser.\n- These IDs are stable and can be persisted across instances of your application (e.g. in localStorage).\n\n### camera.name\n\n- Camera name, including manufacturer and model, e.g. \"Microsoft LifeCam HD-3000\".\n- Can be `null` if the user has not yet allowed camera access, e.g. on first launch of the app.\n\n## Compatibility\n\nInstascan works with [any browser that supports the getUserMedia API](http://caniuse.com/#feat=stream), which currently includes Chome, Firefox, Opera, and Edge. IE and Safari are not supported.\n\n## Performance\n\nMany factors affect how quickly and reliably Instascan can detect QR codes.\n\nIf you control creation of the QR code, consider the following:\n\n- A larger physical code is better. A 2\" square code is better than a 1\" square code.\n- Flat, smooth, matte surfaces are better than curved, rough, glossy surfaces.\n- Include a sufficient quiet zone, the white border surrounding QR code. The quiet zone should be at least four times the width of an individual element in your QR code.\n- A simpler code is better. You can use [this QR code generator](https://www.the-qrcode-generator.com/) to see how your input affects complexity.\n- For the same length, numeric content is simpler than ASCII content, which is simpler than Unicode content.\n- Shorter content is simpler. If you're encoding a URL, consider using a shortener such as [goo.gl](https://goo.gl/) or [bit.ly](https://bitly.com/).\n\nWhen scanning, consider the following:\n\n- QR code orientation doesn't matter.\n- Higher resolution video is better, but is more CPU intensive.\n- Direct, orthogonal scanning is better than scanning at an angle.\n- Blurry video greatly reduces scanner performance.\n- Auto-focus can cause lags in detection as the camera adjusts focus. Consider disabling it or using a fixed-focus camera with the subject positioned at the focal point.\n- Exposure adjustment on cameras can cause lags in detection. Consider disabling it or having a fixed white backdrop.\n\n## Example Setup\n\n- Purpose: To scan QR code stickers on paper cards and plastic bags.\n- Camera: [Microsoft LifeCam HD-3000](http://www.newegg.com/Product/Product.aspx?Item=9SIA4RE40S4991), 720p, fixed focus, around $30 USD.\n- Small support to ensure camera is focused on subject.\n- White paper backdrop to mitigate exposure adjustment.\n\n![Setup](https://raw.githubusercontent.com/schmich/instascan/master/assets/setup.jpg)\n\n## Credits\n\nPowered by the [Emscripten JavaScript build](https://github.com/kig/zxing-cpp-emscripten) of the [C++ port](https://github.com/glassechidna/zxing-cpp) of the [ZXing Java library](https://github.com/zxing/zxing).\n\n## License\n\nCopyright &copy; 2016 Chris Schmich\n<br />\nMIT License. See [LICENSE](LICENSE) for details.\n","versions":{"0.0.2":{"name":"instascan","version":"0.0.2","description":"Webcam-driven QR code scanner.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"files":["src/","index.js"],"repository":{"type":"git","url":"git+https://github.com/schmich/instascan.git"},"keywords":["qr","code","quick","response","scan","scanner","webcam"],"author":{"name":"Chris Schmich","email":"schmch@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/schmich/instascan/issues"},"homepage":"https://github.com/schmich/instascan","devDependencies":{"babel-preset-es2015":"^6.9.0","babelify":"^7.3.0","browserify":"^13.0.1","gulp":"^3.9.1","gulp-rename":"^1.2.2","gulp-uglify":"^1.5.4","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"visibilityjs":"^1.2.3"},"gitHead":"5b9bab8e59cab10a32b0fa8a3101c21ef1d7af7a","_id":"instascan@0.0.2","_shasum":"21b9402e5e193f46bc41775b6cf188a3ff16ce23","_from":".","_npmVersion":"2.15.5","_nodeVersion":"4.4.6","_npmUser":{"name":"schmich","email":"schmch@gmail.com"},"dist":{"shasum":"21b9402e5e193f46bc41775b6cf188a3ff16ce23","tarball":"https://registry.npmjs.org/instascan/-/instascan-0.0.2.tgz","integrity":"sha512-WpdhCjtaaGG7tFwxdE8N6lXFvyfD/zrR3Nd22ROCO13b2VrIxzJQ1/IZIPvqPpM5WfstyejRT4tgU+JzWZmR5Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCezfw4CR8LY/BddOrfdoy0qbdYSK6X4hYKgvAZgjS0wIgedsarll9RDvFyP8HZdVcBYSKvwO/kN/JJyp8XSxqNt4="}]},"maintainers":[{"name":"schmich","email":"schmch@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/instascan-0.0.2.tgz_1468328833969_0.7332196226343513"}},"0.0.3":{"name":"instascan","version":"0.0.3","description":"Webcam-driven QR code scanner.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"files":["src/","index.js"],"repository":{"type":"git","url":"git+https://github.com/schmich/instascan.git"},"keywords":["qr","code","quick","response","scan","scanner","webcam"],"author":{"name":"Chris Schmich","email":"schmch@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/schmich/instascan/issues"},"homepage":"https://github.com/schmich/instascan","devDependencies":{"babel-plugin-syntax-async-functions":"^6.8.0","babel-plugin-transform-regenerator":"^6.9.0","babel-preset-es2015":"^6.9.0","babelify":"^7.3.0","browserify":"^13.0.1","gulp":"^3.9.1","gulp-rename":"^1.2.2","gulp-uglify":"^1.5.4","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"babel-polyfill":"^6.9.1","fsm-as-promised":"^0.13.0","visibilityjs":"^1.2.3","webrtc-adapter":"^1.4.0"},"gitHead":"eaf6918451f3831a47eeaa4d8e6eb021d49eda8a","_id":"instascan@0.0.3","_shasum":"3fb3d7b8536a6603afdc342524163b03d058f374","_from":".","_npmVersion":"3.7.3","_nodeVersion":"5.8.0","_npmUser":{"name":"schmich","email":"schmch@gmail.com"},"maintainers":[{"name":"schmich","email":"schmch@gmail.com"}],"dist":{"shasum":"3fb3d7b8536a6603afdc342524163b03d058f374","tarball":"https://registry.npmjs.org/instascan/-/instascan-0.0.3.tgz","integrity":"sha512-R7WPsUSePUgQr8ucdJDTJ/Ics8KJhZXXOxw/g2xR1quiPr62Pxud3NSK+zpX2sYATNGjqWg0QuXBKIGgfqfuBg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEXFmuyTsC9Puri/jg2gt3c46vPsWyPimR8pJv1T7CcFAiBk55YcyvSwj+Ol0W0aVx0iaTU+msPh/c2Gf1KnkpOVfQ=="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/instascan-0.0.3.tgz_1468816782038_0.9079776396974921"}},"1.0.0":{"name":"instascan","version":"1.0.0","description":"Webcam-driven QR code scanner.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"files":["src/","index.js"],"repository":{"type":"git","url":"git+https://github.com/schmich/instascan.git"},"keywords":["qr","code","quick","response","scan","scanner","webcam","realtime"],"author":{"name":"Chris Schmich","email":"schmch@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/schmich/instascan/issues"},"homepage":"https://github.com/schmich/instascan","devDependencies":{"babel-plugin-syntax-async-functions":"^6.8.0","babel-plugin-transform-regenerator":"^6.9.0","babel-preset-es2015":"^6.9.0","babelify":"^7.3.0","browserify":"^13.0.1","gulp":"^3.9.1","gulp-rename":"^1.2.2","gulp-uglify":"^1.5.4","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"babel-polyfill":"^6.9.1","fsm-as-promised":"^0.13.0","visibilityjs":"^1.2.3","webrtc-adapter":"^1.4.0"},"gitHead":"8146532642ca5750190d3cebb3fca0e6f5863363","_id":"instascan@1.0.0","_shasum":"de5949f73f698f8dff68df0a7bcf6942a799ee44","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"schmich","email":"schmch@gmail.com"},"maintainers":[{"name":"schmich","email":"schmch@gmail.com"}],"dist":{"shasum":"de5949f73f698f8dff68df0a7bcf6942a799ee44","tarball":"https://registry.npmjs.org/instascan/-/instascan-1.0.0.tgz","integrity":"sha512-u9US1kM0IhVPUoozJ3EuxLFff6v/kuE3wwGiKPbH4NEyzxPXNDWEUb4s8z6i30KhjMC84pXSGAt5eLC3wY4Fxw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCMj2jLD6diJDR4/E5uInOQ7D/LfJlpRnQq789Bw6MuTAIgA1lYdlhx6D0cKZrD9nXLhZiNq2xMw5ZOZ5rJdp8pdEA="}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/instascan-1.0.0.tgz_1485392796217_0.36884205928072333"}},"2.0.0-rc.2":{"name":"instascan","version":"2.0.0-rc.2","description":"Webcam-driven QR code scanner.","main":"dist/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"files":["dist/index.js"],"repository":{"type":"git","url":"git+https://github.com/schmich/instascan.git"},"keywords":["qr","code","quick","response","scan","scanner","webcam","realtime"],"author":{"name":"Chris Schmich","email":"schmch@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/schmich/instascan/issues"},"homepage":"https://github.com/schmich/instascan","devDependencies":{"babel-plugin-syntax-async-functions":"^6.8.0","babel-plugin-transform-regenerator":"^6.9.0","babel-preset-es2015":"^6.9.0","babelify":"^7.3.0","browserify":"^13.0.1","gulp":"^3.9.1","gulp-rename":"^1.2.2","gulp-uglify":"^1.5.4","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"babel-polyfill":"^6.9.1","fsm-as-promised":"^0.13.0","visibilityjs":"^1.2.3","webrtc-adapter":"^1.4.0"},"gitHead":"0b2ddd50267809dd2522320144d1e0992c7a615f","_id":"instascan@2.0.0-rc.2","_shasum":"677d8afcb817957c28540c479433aa59bea3b3d8","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"schmich","email":"schmch@gmail.com"},"dist":{"shasum":"677d8afcb817957c28540c479433aa59bea3b3d8","tarball":"https://registry.npmjs.org/instascan/-/instascan-2.0.0-rc.2.tgz","integrity":"sha512-EHlRVXtrHI1xD8r+9cKRv9/ARscM0PZfFJ0Zv8oCq3aIjUbr/QTsoz7ARh+cPpZbXrLfTfqB4u9hZqbkG2i7ZQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBY747Q6Z0UVzkNum1W/Lj4RvUnfK5AQADzz0JQ6C2OaAiEAr0aogm2pFtbxcvmQ/f8WoTyak6JVkjNeUy7RNWY/mmM="}]},"maintainers":[{"name":"schmich","email":"schmch@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/instascan-2.0.0-rc.2.tgz_1492583644082_0.12256462452933192"}},"2.0.0-rc.3":{"name":"instascan","version":"2.0.0-rc.3","description":"Webcam-driven QR code scanner.","main":"dist/index.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"files":["dist/index.min.js","src/","index.js"],"repository":{"type":"git","url":"git+https://github.com/schmich/instascan.git"},"keywords":["qr","code","quick","response","scan","scanner","webcam","realtime"],"author":{"name":"Chris Schmich","email":"schmch@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/schmich/instascan/issues"},"homepage":"https://github.com/schmich/instascan","devDependencies":{"babel-plugin-syntax-async-functions":"^6.8.0","babel-plugin-transform-regenerator":"^6.9.0","babel-preset-es2015":"^6.9.0","babelify":"^7.3.0","browserify":"^13.0.1","gulp":"^3.9.1","gulp-rename":"^1.2.2","gulp-uglify":"^1.5.4","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"babel-polyfill":"^6.9.1","fsm-as-promised":"^0.13.0","visibilityjs":"^1.2.3","webrtc-adapter":"^1.4.0"},"gitHead":"0b2ddd50267809dd2522320144d1e0992c7a615f","_id":"instascan@2.0.0-rc.3","_shasum":"0708af460e9d6e1b4b2c8e5be781dcd31e8a0849","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"schmich","email":"schmch@gmail.com"},"dist":{"shasum":"0708af460e9d6e1b4b2c8e5be781dcd31e8a0849","tarball":"https://registry.npmjs.org/instascan/-/instascan-2.0.0-rc.3.tgz","integrity":"sha512-m3bfhOP/eFJpJArYl/udvVMChx+/1ccHEGPKLTn6kTCLmOVRBYInRFa6iGHm02iptaoD2H8xypAiUGATtbiZZA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGqOGJe5lWmGkQrnEMbOYb1EcwJxYcCLam6ljApJhSiRAiBxdesfRID+eGogsTKzcsoiuuzU66I6pAVsZWrnh+eVyg=="}]},"maintainers":[{"name":"schmich","email":"schmch@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/instascan-2.0.0-rc.3.tgz_1492584698674_0.03438490116968751"}},"2.0.0-rc.4":{"name":"instascan","version":"2.0.0-rc.4","description":"Webcam-driven QR code scanner.","main":"instascan.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"files":["instascan.min.js"],"repository":{"type":"git","url":"git+https://github.com/schmich/instascan.git"},"keywords":["qr","code","quick","response","scan","scanner","webcam","realtime"],"author":{"name":"Chris Schmich","email":"schmch@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/schmich/instascan/issues"},"homepage":"https://github.com/schmich/instascan","devDependencies":{"babel-plugin-syntax-async-functions":"^6.8.0","babel-plugin-transform-regenerator":"^6.9.0","babel-preset-es2015":"^6.9.0","babelify":"^7.3.0","browserify":"^13.0.1","gulp":"^3.9.1","gulp-rename":"^1.2.2","gulp-uglify":"^1.5.4","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"},"dependencies":{"babel-polyfill":"^6.9.1","fsm-as-promised":"^0.13.0","visibilityjs":"^1.2.3","webrtc-adapter":"^1.4.0"},"gitHead":"0b2ddd50267809dd2522320144d1e0992c7a615f","_id":"instascan@2.0.0-rc.4","_shasum":"b6b41166e58209f8913afdef0f7416c6273b1928","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"schmich","email":"schmch@gmail.com"},"dist":{"shasum":"b6b41166e58209f8913afdef0f7416c6273b1928","tarball":"https://registry.npmjs.org/instascan/-/instascan-2.0.0-rc.4.tgz","integrity":"sha512-YGYJXQpObHzb8/04Bgna8nV2y7HmPY/l2Y4p4MLqbOTejoG0baZbGcaYB3K3BkNNlON+7FWmG7PSY+03ueII+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE1mrxL/jD489iH+XaBj6bQ2XFH1i60BxuY4FbtzA1glAiBg97Ht7LrzF9cvZ63Gts0JWnTUQ4ak5e00fbzCP96Tsw=="}]},"maintainers":[{"name":"schmich","email":"schmch@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/instascan-2.0.0-rc.4.tgz_1493177867913_0.8174936783034354"}}},"homepage":"https://github.com/schmich/instascan","keywords":["qr","code","quick","response","scan","scanner","webcam","realtime"],"repository":{"type":"git","url":"git+https://github.com/schmich/instascan.git"},"author":{"name":"Chris Schmich","email":"schmch@gmail.com"},"bugs":{"url":"https://github.com/schmich/instascan/issues"},"license":"MIT","readmeFilename":"README.md"}