1
我正在通过PhoneGap Desktop在ios 9.2上运行应用程序。PhoneGap /科尔多瓦CanvasCamera插件无法正常工作
我刚开始使用PhoneGap,我正在尝试构建一个简单的应用程序,允许您拍摄照片并将其显示给您。我已经能够使用在设备上启动相机应用程序的cordova相机插件来执行此操作。不过,我希望在设备准备就绪后即可实施启动全屏相机的应用程序,就像snapchat一样。
我一直在试图通过唐纳德·佩做到这一点使用CanvasCamera插件https://github.com/donaldp24/CanvasCameraPlugin
但我仍不得不在让相机预览没有成功。
我已经安装使用gitbash
通过NPM插件我已经加入了插件的config.xml文件
<gap:plugin name="com.keith.cordova.plugin.canvascamera" version="1.0.1" />
这是我使用的尝试,并得到一个摄像头预览代码
HTML
<canvas id="camera" width="352" height="288" style="border:2px solid black"></canvas>
index.js 在绑定事件功能
document.addEventListener("deviceready", function() {
canvasMain = document.getElementById("camera");
window.plugin.CanvasCamera.initialize(canvasMain);
// define options
var opt = {
quality: 75,
destinationType: CanvasCamera.DestinationType.DATA_URL,
encodingType: CanvasCamera.EncodingType.JPEG,
saveToPhotoAlbum:true,
correctOrientation:true,
width:640,
height:480
};
window.plugin.CanvasCamera.start(opt);
});
我真的很感谢你的帮助。
谢谢
iOS 9.2还不支持。见科尔多瓦博客。 – JesseMonroy650
你能解决这个问题吗?该插件不再被维护。 – olanchuy