Video Error , error = Error getting userMedia, error = NotReadableError:Could not start video source on low end Android devices
See original GitHub issueDescribe the bug When you press request permission button. It will run navigator.mediaDevices.getUserMedia({ audio: false, video: true }).then(_ => from static getCameras() method
- which causes the browser to already start accessing the video input. Causing NotReadableError when pressing start scanning after selecting the REAR CAMERA (Front camera has no issues)
- But do note that ONLY slow phones will be affected. Any phones that are slow enough can reproduce this issue in the demo website.
To Reproduce Steps to reproduce the behavior:
- Go to the demo website https://blog.minhazav.dev/research/html5-qrcode.html
- Click on Request Permission and scroll down your notification bar. You will see chrome is already accessing your video input. If your phone is slow enough. Quickly go to point 3
- Select REAR camera and Press Start scanning while chrome still accessing your video input
- See error Video Error , error = Error getting userMedia, error = NotReadableError:Could not start video source
To avoid the NonReadableError
- You have to wait chrome browser to stop accessing the video input after pressing the (request permission button) for around 5 seconds or even more for the notification of chrome accessing your video input is gone at the notification bar! the range of time depends the phone’s performance
- Then you press start scanning after selecting the REAR CAMERA
Expected behavior See error Video Error , error = Error getting userMedia, error = NotReadableError:Could not start video source
The Fix
Just comment the code shown in the screenshot.
//navigator.mediaDevices.getUserMedia({ audio: false, video: true })
// .then(_ => {
**content
//.catch(err => {
// reject(${err.name} : ${err.message}
);
//})
Screenshots
Desktop (please complete the following information): Desktop basically have no issue because PCs are too fast
Smartphone (please complete the following information):
- Device: Huawei Nova 3i, Huawei Honor 10
- OS: EMUI 9.1 for both phones
- Browser [Chrome- 81.0.4044.117 (latest version)]
Additional context I’m sorry if I raised a wrong issue.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
Top GitHub Comments
hi @mebjas
It is fixed! nice one !
Thanks! This is my first time raising an issue on github. Glad it was fruitful!
Regards, Ken
Thanks @kenfookchoong for raising the issue and suggesting the fix!
@OneDivZero thanks again for validating the issue and fix - this has been super helpful in getting the issue to be fixed.
@keanwalker Thanks for validating the issue resolution!
This kind of open source collaboration is really fun 😃 Closing this issue!