get TypeError: callbackFn is not a function when using decodeFromVideoDevice()
See original GitHub issueI’m on version 0.18.2 of the library, trying to use this library according to the code in this example, https://github.com/zxing-js/library/blob/master/docs/examples/multi-camera/index.html
. Somehow, got the following error in the console.
TypeError: callbackFn is not a function
However, when replacing decodeFromVideoDevice()
with decodeOnceFromVideoDevice()
, everything is working fine.
Desktop (please complete the following information):
- OS: iOS 10.15.7
- Browser: Firefox
- Version: 81.0.1 (64-bit)
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Callback is not a function - Stack Overflow
I am trying to retrieve a json object to use it in another module, but I have a problem with callback ...
Read more >TypeError: "x" is not a function - JavaScript
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >Uncaught TypeError | Is Not A Function | Solution - YouTube
Have you encountered an error like:- Uncaught TypeError - Some selector is not a function - jQuery is not a function - owlCarousel...
Read more >How to fix "Uncaught TypeError: x is not a function" in JavaScript
JS Casts 01 - How to fix "Uncaught TypeError : x is not a function " in JavaScript.Visit https://javascriptcasts.com/episodes/01 for a summary ...
Read more >TypeError: callback is not a function in JavaScript | bobbyhadz
The "callback is not a function" error occurs when we define a callback parameter to a function, but invoke the function without passing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, sorry. That was my bad. I didn’t notice the API difference between
decodeOnceFromVideoDevice()
anddecodeFromVideoDevice()
.After calling
decodeFromVideoDevice()
with the callback function in the 3rd parameter, it is now working as expected.Sorry for the trouble and really thank you for pointing me out.
Cheers,
Please make sure you are correctly using the method:
If you do not pass the third argument you will indeed get the
callbackFn
error.ImageCapture
is used to check if torch is available, I think it’s better to surround that block with a try-catch and ignore this error, because browsers that doesn’t support full webrtc will throw this error and probably break code execution.