Camera does not stop on Safari and sometimes on Chrome
See original GitHub issueDescribe the bug We were using scanner on one of our angular routes. After moving to another route camera sometimes remain working on Chrome and always on Safari
To Reproduce Steps to reproduce the behavior:
- Go to the example to reproduce https://stackblitz.com/edit/angular-tyqjz9?file=src%2Fapp%2Fscanner%2Fscanner.component.ts
- Just navigate between
home
andscanner
routes via links in the bottom.
Expected behavior Camera should be turned off after scanner component has been destroyed.
Desktop (please complete the following information):
- OS: macOS Mojave 10.14.4
- Browser [Safari 12.1]
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Chrome Browser unable to detect my MacBook in-built ...
- Let's test your camera. I know you've said that your camera can be "detected" in Safari, but I want to explicitly check...
Read more >If your built-in camera isn't working on your Mac - Apple Support
Choose Apple menu > System Preferences, then click Security & Privacy. · Click the Privacy tab, then click Camera in the sidebar. ·...
Read more >iPhone Continuity Camera Not Working? Here's How to Fix it!
Here's how to fix Continuity Camera in Google Chrome, Microsoft Edge, and Brave web browsers. After updating to macOS Ventura, ...
Read more >How To Fix Google Meet Camera Failed on Mac (2022)
Let's show you how to fix the error that Google Meet Camera has failed. In this video, I walk you through the steps...
Read more >Google Meet Camera Not Working in Chrome on Mac, Fix
Go to Apple menu > System Preferences, then click Security & Privacy. · Select the Privacy tab and then ensure that Google Chrome...
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
~Okay i found one not so ideal workaround, but is considerably a better user experience than what was happening (seeing the webcam light on and showing recording on the tab). It involves blocking for 2000ms route changes or any other events that causes the component to be destroyed while the scanner is just initializing. This gives it enough time to fetch the device (camera) completely as this issue only occurs (chrome) when you destroy the component in that time frame.~
Soooo instead of what I said above (silly me) I have a different workaround that is more in tune with the problem at hand.
The issue is that the reset method that is run in the ondestroy hook of this libs component has no effect at the moment its destroyed while still activating the camera. In my wrapping component I handle it in my on ondestroy hook by running scanner reset again for good measure in a setTimeout of 2000ms.
I still don’t understand if I can listen to some event telling me that the camera is completely active, allowing me to run reset at that moment, which would be better than some chosen hardcoded time delay.
Anyway, if the first reset (inside the ngOnDestroy of the lib component) works, then the camera is turned off immedetiately. Otherwise the backup one in my component will try again 2 seconds later.
Hi, Any resolution to this problem?