basst314 / ngx-webcam

A simple Angular webcam component / pure & minimal, no flash-fallback
https://basst314.github.io/ngx-webcam/?
MIT License
231 stars 104 forks source link

Switching the camera will freeze the Chrome app on Android phone in the live demo. #114

Open angroPowel opened 3 years ago

angroPowel commented 3 years ago

Hi,

Device: Samsung s20 Android 11 Chome 89.0.4389.105. Angular 10

I have implemented ngx-webcam into my project. It works fine on PC, but on the phone the entire chrome app freezes if you try the "flip" camera button. Sometimes it works to flip the camera 2 or 3 times before it freezes, sometimes it freezes on the first try. Same issue if you use the "next webcam" button or the "flip" camera found on the image.

To recreate the issue simply try the live-demo on android phone using chrome.

I tested it in Edge and it worked fine there, but I need it to work in chrome as well.

Anyone have any suggestions for solving this?

EdithBirrer1 commented 3 years ago

There is a possible connection to a Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1183362 Has to do with camera ID - seemingly chromium code assumes the camera ID is identical to a 0-based index, but newer cameras use other numbers / strings as camera ID.

The above problem description does not give enough details to verify that really the Chromium bug is causing the freezing, but it seems possible and plausible. Maybe @angroPowel you want to check/confirm?

angroPowel commented 3 years ago

@EdithBirrer1 is camera ID any different from Device ID? I checked on my Samsung s20, and I have 4 available video devices. Each of them have a device ID with a long string with 60+ characters of both letters and numbers. The entire browser freezes, so I don't get any error message.

Dravere commented 3 years ago

The camera id is different from the device id. The camera id is the one used internally in Android. The developers have pushed a fix that is available in Chrome Canary. Feel free to try it out in Chrome Canary, here it fixed the problem. Apparently there is still an issue if the camera is connected externally. The pushed fix in Canary only works with internal cameras.

angroPowel commented 3 years ago

Thank you for the tip. I tested it on Chrome Canary on my Android Phone and it worked. Do you have any idea of when this will be released in "normal" Chrome?

Dravere commented 3 years ago

Sadly I don't have this information. I'd love to know that too.

basst314 commented 2 years ago

Hi @angroPowel, Does this issue still happen with the latest version of this library (0.4.1)?

shivangguptaa commented 1 year ago

Is this error not resolved yet??