GetUserMedia Android Webview Ionic

I am trying to do some basic things by getting the camera stream of an Android device using getUserMedia. As far as I understand, this should be supported on Android Lollipop, which I run, but even with permissions allowed for video and audio, my request for a media stream is automatically rejected.

So I tried using Crosswalk with Ionic, and I can get the media stream. The data is just empty. As far as I understand, this needs to be supported. Does anyone else have experience acquiring camera video data using Cordova / Ionic?

+4
source share
3 answers

, RECORD_AUDIO CAMERA /Android AndroidManifest.xml:

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />

API Cordova , API HTML5.

+8

Android. (, , , ), Android Permissions, .

, , :

var permissions = cordova.plugins.permissions;

var permList = [
  permissions.CAMERA,
  permissions.RECORD_AUDIO
];

permissions.requestPermissions(permList, permCallBackSuccess, permCallBackError);

, - , !

+4

The problem has been fixed using https://github.com/MobileChromeApps/cordova-plugin-chrome-apps-audioCapture

$ cordova plugin add cordova-plugin-chrome-apps-audiocapture --save
$ cordova build
$ cordova run android

Now the microphone stream can be processed with audioContext.createScriptProcessor.

ps. It seems that for this function to work, just permission is RECORD_AUDIOnot enough, the plugin also usesMODIFY_AUDIO_SETTINGS

+1
source

All Articles