instascan icon indicating copy to clipboard operation
instascan copied to clipboard

TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.

Open mchmdarvan opened this issue 4 years ago • 6 comments

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

mchmdarvan avatar Jun 10 '20 11:06 mchmdarvan

Yes me 2

ghost avatar Jun 17 '20 10:06 ghost

i have this problem too

mehran-akb avatar Jun 19 '20 11:06 mehran-akb

me too

notshekhar avatar Jun 25 '20 13:06 notshekhar

https://github.com/zxing-js/library I found this library, great library for QR code and barcode scanner

notshekhar avatar Jun 26 '20 02:06 notshekhar

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

fabionaspolini avatar Jul 02 '20 01:07 fabionaspolini

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);

...

oscarmartins avatar Nov 22 '20 15:11 oscarmartins