打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
How to allow getUserMedia on a ionic project with crosswalk
When I run my ionic app with crosswalk, and try open the camera through the getUserMedia api. I get the PermissionDenied error
How to allow the access to camera?
0down vote
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.
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 3 '15 at 18:39
As ionic is based on angular, have you tried adding angular-csp.css ? (docs.angularjs.org/api/ng/directive/ngCsp ) – QuickFix Jul 7 '15 at 12:15
I managed to solve as follows:
1o Simply using pure cordova, without ionic or CCA.
2o Adding the crosswalk plugin:
cordova plugin add cordova-plugin-crosswalk-webview
Repository page: https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview
3o 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:
Adding 'blob:' to the Content-Security-Policy media-src works in Chrome: media-src * blob: –
http://stackoverflow.com/questions/31186176/how-to-allow-getusermedia-on-a-ionic-project-with-crosswalk
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
ionic调试插件开发 | 皓眸IT
ionic 整合 Crosswalk | GSGUNDAM砍柴工
ionic 2减少载入app时间设置
cordova学习笔记1(创建和打包)
ionic4+angular7+cordova上传图片
ionic2混合app开发系列1
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服