Skip to content

Camera active even on route change #332

Answered by rahuld109
rahuld109 asked this question in Q&A
Discussion options

You must be logged in to vote

The problem was caused by React 18's useEffect function triggering a double mount, which resulted in the getUserMedia function being called twice and creating separate streams. To fix this, I implemented a caching system for the streams and stopped them on each unmount. Feel free to check out the sandbox

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@rahuld109
Comment options

@vladmandic
Comment options

Comment options

You must be logged in to vote
2 replies
@vladmandic
Comment options

@rahuld109
Comment options

Answer selected by rahuld109
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants