Access camera or webcam without webRTC

后端 未结 1 1302
滥情空心
滥情空心 2021-01-06 09:06

In my website, it needs to access camera or webcam. But webRTC is not supported yet on ios webview based on https://forums.developer.apple.com/thread/88052 (please cmiiw). S

相关标签:
1条回答
  • 2021-01-06 09:39

    The Bad News:

    iOS WebViews don't support getUserMedia, which means you won't be able to access the user's camera at all. There is no workaround as of Jan 2019. I'm also waiting for getUserMedia to be supported on iOS WebViews, so I feel your pain.

    Whenever I have questions about browser features like this, I find it very helpful to check out caniuse.com. In this case, it shows that the latest version of Safari & Chrome for iOS (released Sep 2018) supports getUserMedia, but that it...

    Does not work in standalone running ("installed") PWAs, getUserMedia returns no video input devices in UIWebView or WKWebView, but only directly in Safari.

    The Good News:

    If you are just interested in having your website work on iOS devices, then you are in luck. You don't need to use a WebView unless you are making an app for the App Store. getUserMedia will work for users who visit your website using Safari on iOS! And if it helps, your users can even add a link to your website onto their home screen on iOS, which makes it seem very much like an app.

    The Other News:

    getUserMedia controls access to a user's camera and microphone, whereas WebRTC helps you send that audio/video to another client, like in a video chat. Here you're stuck on getting the video in the first place so you don't need to worry about WebRTC yet, but when you do, I recommend you check out This article that helped me.

    And if you want to test getUserMedia or WebRTC functions yourself, try using These provided samples, so that you can be sure that it is not the fault of your own code :)

    0 讨论(0)
提交回复
热议问题