简体   繁体   中英

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

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

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) { ... })

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

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

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!

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

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