bensonruan / webcam-easy

javascript access webcam stream and take photo
https://bensonruan.com/how-to-access-webcam-and-take-photo-with-javascript
MIT License
241 stars 110 forks source link

Calling webcam functions results in multiple browser prompts for access in chrome #17

Open DanielKoohmarey opened 3 years ago

DanielKoohmarey commented 3 years ago

Calling webcam.start with default args of stream = true, the stream call results in two separate prompts to the user to allow access to the webcam in Chrome. Is there a way to request permissions from the user only once for the lifetime of the webcam object? This is the result of the navigator.mediaDevices.getUserMedia(this.getMediaConstraints()) call in both functions. In the stream function the this._streamList should be checked, and if not empty, simply use the existing stream object.