basst314 / ngx-webcam

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

Can't open camera #96

Closed MrHOY closed 3 years ago

MrHOY commented 3 years ago

I copy code from live demo and can't not open camera on my phone, browser show popup but I can't press Allow or Block image

Android: 10 Chrome: 86.0.4240.114

fmipsylone commented 3 years ago

Same issue on Chrome Android 86.0.4240.110 and Chrome Desktop 86.0.4240.183. No errors in DevTools. It is the same issue as #95.

MrHOY commented 3 years ago

@fmipsylone But it works well with Chrome: 86.0.4240.114 on Android 7. That's strange when I can't press any button on popup with Android 10

JaquesGF commented 3 years ago

I have the same problem on my Mi A2, the camera is not displayed. Chrome version: 86.0.4240.198

I installed firefox to work around the problem

fmipsylone commented 3 years ago

At the conceptual phase I was looking for an easy solution, simple to adapt to some needs to not have to reinvent the wheel. As sample I needed ImageData of the picture, not a blob neither an ObjectDataUrl, and it seemed to give it. So, I thought that I could use ngx-webcam as a third party dependency to take the picture and adapt it to my needs. But more than the issue we pointed here, there was another issue in the implementation that did not back the ImageData. It was very simple to obtain by a workaround without forking. And it is also very easy to fix it in the code if you estimate that it could be interesting to purpose a pull request for this package.

But this package seems not actively maintained. No reactivity whereas the main feature is not working. I do not fault the main developer and contributors. I understand that it takes time and thanks very much to the main developer for taking the initiative to open and sharing his code.

I spent some time to look up the code, how to adapt it to our needs, check if the issue was simple to test and resolve. And In the meantime to understand the implementation I looked for MDN getUserMedia and MediaStreamTrack documentation.

It appeared to me that it was very simple to implement from scratch, and finally not a good idea to rely on a non actively maintained package for a third dependency in my app.

So finally, I implemented my own camera based on MDN documentation. It's quite easy to do and that perfectly meets my needs.

My advice, check out getUserMedia, MediaStreamTrack and MediaStreamConstraints on MDN and do not add a dependency for take a picture.

basst314 commented 3 years ago

@MrHOY does the live demo here work for you? https://basst314.github.io/ngx-webcam/?

Can you also try this demo to see if it works? https://webrtc.github.io/samples/src/content/getusermedia/canvas/

basst314 commented 3 years ago

@fmipsylone thanks for the information that you were able to fix it. What exactly was the issue and how did you fix it? Mind sharing the fix so that it can be added to this package?

Thanks!

MrHOY commented 3 years ago

@basst314 I tried it. It work well on Android: 7 Chrome: 86.0.4240.114, but same problem on Android 10 as i said

basst314 commented 3 years ago

@MrHOY is it the same issue with this demo? https://webrtc.github.io/samples/src/content/getusermedia/canvas/

Same issue that you cannot click allow?

MrHOY commented 3 years ago

@MrHOY is it the same issue with this demo? https://webrtc.github.io/samples/src/content/getusermedia/canvas/

Yes

Same issue that you cannot click allow?

Yes @basst314

basst314 commented 3 years ago

Thanks for confirming @MrHOY This seems to be an issue with this particular phone os and browser combination and is not specific to this library.

I‘m not sure at this point whether it is related to the OS behaving weirdly and not taking clicks for the Allow button or whether it‘s an issue with Chrome.

You could try with Firefox to see if it makes a difference.

Please let me know if that works.

Apart from that, as this is not an issue with this library, there‘s nothing else I could do.

MrHOY commented 3 years ago

@basst314 Firefox works well,

It's strange, but there is nothing more we can do about it. Thank you for your support.