简体   繁体   English

我可以在Android / IOS Webview中使用navigator.mediaDevices.getUserMedia吗?

[英]Can I use navigator.mediaDevices.getUserMedia In Android/IOS Webview?

I have some problem in using web-api in Android/IOS's native apps 我在Android / IOS的​​原生应用程序中使用web-api时遇到了一些问题

In webview, I render a html, and I want use camera for taking photos, I search for web api and found a method, that is 在webview中,我渲染一个html,我想使用相机拍照,我搜索web api并找到一个方法,即

navigator.mediaDevices.getUserMedia(constraints)
  .then(function(mediaStream) { ... })
  .catch(function(error) { ... })

This api works well in PC browers, but in webview, it doesn't work, why? 这个api适用于PC浏览器,但在webview中,它不起作用,为什么?

Is there any other way to use camera by JS in webview(not by Android/IOS native apis) 在webview中有没有其他方法可以通过JS使用相机(不是由Android / IOS原生apis)

My understanding is that currently on iOS you cannot use getUserMedia in a WebView . 我的理解是,目前在iOS上你不能在WebView使用getUserMedia I believe it does work on Android OS. 我相信它适用于Android操作系统。

This may change in the future, though! 不过,这可能会在未来发生变化!

See also: https://github.com/BasqueVoIPMafia/cordova-plugin-iosrtc/issues/250#issuecomment-336240953 另见: https//github.com/BasqueVoIPMafia/cordova-plugin-iosrtc/issues/250#issuecomment-336240953

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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