Closed bububear closed 9 months ago
This looks like a WebRTC issue in WKWebView on early iOS devices:
On the basis of iOS 14.3 and later, the camera still cannot be turned on.
I just remembered I have an iPhone SE 1st generation and I successfully reproduced this problem.
Upload three videos for demonstration:
https://github.com/gruhn/vue-qrcode-reader/assets/10386119/a1054054-23f9-48ae-977e-383d7bffac2d
https://github.com/gruhn/vue-qrcode-reader/assets/10386119/460b98be-b24d-493e-9015-9b8b86732593
https://github.com/gruhn/vue-qrcode-reader/assets/10386119/55bf92ce-de07-4a5b-882b-7bd9556db16a
iOS 15.5, Safari 15.5, WebKit 6613.2.7
I may do some debugging when I have time. Though it's not easy because I don't have a mac.
A relevant link (maybe): http://www.zhigushu.com/a/12389
Translated to English with AI:
When calling navigator.mediaDevices.getUserMedia to access the camera for facial recognition, it works on both Android's WeChat and browsers. However, on iOS, it only works in the browser, as the WeChat app displays a white screen.
During testing, getUserMedia is effective, but it was discovered that due to the lack of support for the onloadedmetadata event, the video cannot be played(). Therefore, an alternative approach was implemented by adding an event listener, canplay, where the video capture operation is executed. In this case, video.play() is called directly within the getUserMedia event.
Adding this line of code
videoEl.play()
before awaiting Promise.race
seems to fix this problem:
https://github.com/gruhn/vue-qrcode-reader/assets/10386119/b56a5454-50d0-47eb-a743-bd5b594de248
:tada: This issue has been resolved in version 5.3.6 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Describe the bug Can't open the camera in Wechat browser ,iOS system reproduce this issue with one of the demos
To Reproduce One of the demos : https://vue-qrcode-reader.netlify.app/demos/ScanSameQrcodeMoreThanOnce.html
Screenshots![4a6a73dbb853bce91bee3f227f19255](https://github.com/gruhn/vue-qrcode-reader/assets/35417310/9f14fa08-0d55-442a-95d2-a06f40a82ed9)
Smartphone (please complete the following information):