jhuckaby / webcamjs

HTML5 Webcam Image Capture Library with Flash Fallback
MIT License
2.5k stars 1.11k forks source link

Webcam fails in Safari #255

Closed splicebison closed 6 years ago

splicebison commented 7 years ago

Webcam fails in Safari. This is due to line 319:

video.src = window.URL.createObjectURL( stream ) || stream;

This can be replaced with:

video.srcObject = stream;

Please note, this isn't tested across all browsers.

splicebison commented 7 years ago

To follow up on this, I'd recommend possibly something like this (untested):

try { video.srcObject = stream; } catch ( error ) { video.src = URL.createObjectURL( stream ); }

mesqueeb commented 7 years ago

I have the same error. It won't work in Safari.