0

When I run my ionic app with crosswalk, and try open the camera through the getUserMedia api. I get the PermissionDenied error

getUserMedia permissionDenied

How to allow the access to camera?

itsme
  • 48,972
  • 96
  • 224
  • 345
Marcelo Dolce
  • 69
  • 2
  • 7

2 Answers2

1

I managed to solve as follows:

Simply using pure cordova, without ionic or CCA.

Adding the crosswalk plugin:

cordova plugin add cordova-plugin-crosswalk-webview

Repository page: https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview

And in the AndroidManifest.xml add the line:

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

See more permissions at: https://crosswalk-project.org/documentation/manifest/permissions.html

The importance of the CSP rules still remain, as QuickFix said.

:media-src: 'self' mediastream:

Marcelo Dolce
  • 69
  • 2
  • 7
0

Have you configured content secutity policy in your html file? (please discard this answer if you're not using cordova 5 with plugin cordova-plugin-whitelist)

I think that in order to use getUserMedia in cordova, you have to add the following string in your CSP meta tag :

media-src: 'self' mediastream:

(csp configuration borrowed from this page)

More info about the cordova-plugin-whitelist there and CSP doc there.

QuickFix
  • 11,661
  • 2
  • 38
  • 50
  • Unfortunately, it didn't work. It seems that in the ionic, It is locked in another way. But with pure cordova, this 'CSP' directive is right. – Marcelo Dolce Jul 03 '15 at 18:39
  • As ionic is based on angular, have you tried adding angular-csp.css ? ( https://docs.angularjs.org/api/ng/directive/ngCsp ) – QuickFix Jul 07 '15 at 12:15