question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Camera does not stop on Safari and sometimes on Chrome

See original GitHub issue

Describe 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:

  1. Go to the example to reproduce https://stackblitz.com/edit/angular-tyqjz9?file=src%2Fapp%2Fscanner%2Fscanner.component.ts
  2. Just navigate between home and scanner 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:open
  • Created 4 years ago
  • Reactions:10
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Grasscroppercommented, Aug 15, 2020

~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.

1reaction
alexthelioncommented, Mar 22, 2021

Hi, Any resolution to this problem?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found