我可以在Android / IOS Webview中使用navigator.mediaDevices.getUserMedia吗? [英] Can I use navigator.mediaDevices.getUserMedia In Android/IOS Webview?

查看:2070
本文介绍了我可以在Android / IOS Webview中使用navigator.mediaDevices.getUserMedia吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android / IOS的​​原生应用中使用web-api时遇到一些问题

I have some problem in using web-api in Android/IOS's native apps

在webview中,我渲染一个html,我想用相机拍照,我搜索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

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

这个api适用于PC浏览器,但是在webview中,它不起作用,为什么?

This api works well in PC browers, but in webview, it doesn't work, why?

有没有其他方法可以使用相机通过JS在webview中(不是由Android / IOS本机apis)

Is there any other way to use camera by JS in webview(not by Android/IOS native apis)

推荐答案

我的理解是目前在iOS上你不能使用 getUserMedia WebView 中。我相信它适用于Android操作系统。

My understanding is that currently on iOS you cannot use getUserMedia in a WebView. I believe it does work on Android OS.

这可能会在未来发生变化!

This may change in the future, though!

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

这篇关于我可以在Android / IOS Webview中使用navigator.mediaDevices.getUserMedia吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆