简体   繁体   中英

How can i fix 'navigator.mediaDevices.getUserMedia' for Safari?

I am using navigator.mediaDevices.getUserMedia in my javascript to call webcam. it is working for chrome but not for safari. I know, navigator.mediaDevices.getUserMedia is not supported for safari.

But, Is there any way to fix this issue for safari?

Thanks, Naresh.

As Safari 10 doesn't have support for WebRTC, so navigator.getUserMedia will not have any effect. Safari 11+ has support for WebRTC hence you can use navigator.getUserMedia by enabling 'Enable Legacy WebRTC API' on develop menu or navigator.mediaDevices.getUserMedia.

This is only supported in Safari 11: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia

You might be able to use navigator.getUserMedia (which is deprecated so be careful here): https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM