Snap icon indicating copy to clipboard operation
Snap copied to clipboard

Snap! can't access the camera in the latest Chrome

Open ToonTalk opened this issue 2 years ago • 7 comments

image

Version 109.0.5414.75 (Official Build) (64-bit) Windows 10

Works fine in Edge and FireFox. And worked fine recently in Chrome (and yes it does have permission)

Just clicking the camera icon after opening Snap! 8.0 reproduces the problem.

ToonTalk avatar Jan 21 '23 17:01 ToonTalk

Also Chrome can access the camera and produce a costume using custom JavaScript.

ToonTalk avatar Jan 21 '23 18:01 ToonTalk

Mine works in Chrome (Win11) Version 109.0.5414.75 (Official Build) (64-bit)

On Sat, 21 Jan 2023 at 17:54, Ken Kahn @.***> wrote:

[image: image] https://user-images.githubusercontent.com/2138696/213880225-f8378080-0e4b-47f5-acf0-a72e5c66dd7b.png

Version 109.0.5414.75 (Official Build) (64-bit) Windows 10

Works fine in Edge and FireFox. And worked fine recently in Chrome (and yes it does have permission)

Just clicking the camera icon after opening Snap! 8.0 reproduces the problem.

— Reply to this email directly, view it on GitHub https://github.com/jmoenig/Snap/issues/3168, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR7RNC3FBFNQVS4DKULIR3WTQPD5ANCNFSM6AAAAAAUCQLFRI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

cymplecy avatar Jan 21 '23 20:01 cymplecy

Restarting Chrome fixed the problem. But note that Snap! is still doing something wrong here in that while Snap! couldn't access the camera using its normal JavaScript, custom JavaScript was able to access the camera.

ToonTalk avatar Jan 22 '23 09:01 ToonTalk

Hi Ken, I've also been noticing various issues on different browsers recently with accessing the camera, with varying degrees of reproducibility. Since I need to educate myself - again - on the nitty gritty details could you perhaps share with me the custom JS script that's able to access the camera? Maybe we can follow its pattern in Snap more closely to ensure more reliable access. Thank you!

jmoenig avatar Jan 22 '23 10:01 jmoenig

Here's a simplified version I what I'm using that worked when I tested it just now

let constraints = {video: true, audio: false}; let video = document.createElement('video'); document.body.appendChild(video); let stream = await navigator.mediaDevices.getUserMedia(constraints);
video.srcObject = stream; video.play(); video.setAttribute('autoplay', ''); video.setAttribute('playsinline', '');

ToonTalk avatar Jan 22 '23 10:01 ToonTalk

thanks, Ken, I appreciate it. Will try some experiments with this!

jmoenig avatar Jan 22 '23 11:01 jmoenig

Happy to help. I see that if navigator.mediaDevices is not defined there is a fallback to

navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.msGetUserMedia

No idea if that is still a concern.

ToonTalk avatar Jan 23 '23 09:01 ToonTalk