Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve camera access error handling and permission checks #28

Merged

Conversation

Sembauke
Copy link
Member

@Sembauke Sembauke commented Mar 13, 2025

onsuspend event fires on media elements (like <video> or <audio>) when the browser intentionally pauses loading more data because it has enough buffered, or the browser chooses to suspend further data fetching temporarily.

I can't test this well because my camera is built-in. I don't think we really have to worry about permissions being revoked during the exam. I suspect/assume that when revoking permissions during the exam will cause them to take effect after re-launching the environment.

The first permission check (when you start up the environment) only checks if the access wasn't granted. Thus giving a "denied" message. But on MacOS the camera permission state will start with "prompt". Although the permission already has been granted in development. If we want to change this behaviour I suspect that we need to reset those permissions when starting a new dev session.

Copy link
Member

@ShaunSHamilton ShaunSHamilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works well on my end.

Only suggestion is to use the .on<method> assignment pattern, because any event listener needs to be removed on clean up. This gets around needing to do that, because once the track is garbaged, there is nothing for us to clean.

@ShaunSHamilton ShaunSHamilton merged commit db1e202 into freeCodeCamp:main Mar 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants