instascan
instascan copied to clipboard
TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
Hi, this error happen when i try to access the camera, my code file was same like the example. I'm still beginner, so i hope you guys can help me. Thanks
Yes me 2
i have this problem too
me too
https://github.com/zxing-js/library I found this library, great library for QR code and barcode scanner
It seems that this project is stopped. I fixed bug at my fork and published with new package name on npm.
npm install --save instascan-new
For React projects, I did fix these packages: My fork: https://github.com/fabionaspolini/react-instascan
To install new packages: npm install react-instascan-new instascan-umd-new --save
Fix:
Attach your stream directly to srcObject property instead of using URL.createObjectURL function. recomendation: https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL#Using_object_URLs_for_media_streams
const instascan = require('instascan');
const args = { video: document.getElementById('preview') };
window.URL.createObjectURL = (stream) => {
args.video.srcObject = stream;
return stream;
};
const scanner = new instascan.Scanner(args);
...