Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)

like image 224
Lain.lee Avatar asked Oct 30 '22 00:10

Lain.lee


1 Answers

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

like image 67
Dobes Vandermeer Avatar answered Nov 15 '22 05:11

Dobes Vandermeer