Reputation: 599
I am building a cordova app. it supports two platform (ios and Android). In this i have to show a camera in given frame of the app. Below the frame of camera, there will be a button named "Click". When i click this button, the currently showing things in camera should be captured and saved to gallery. Also there should be a slide bar on the left of camera. using this slider, one can zoom in or zoom out the camera.
Currently i have tried "org.apache.cordova.camera" http://plugins.cordova.io/#/package/org.apache.cordova.camera. But, i don't know how to present camera in a given frame. It is invoking the default camera app and the camera is opening in full screen. Please suggest me some another plugin or any Method.
Thanks.
Upvotes: 0
Views: 1543
Reputation: 11721
The camera plugin only starts the native camera app and gets the picture.
If you want something specific like what you describe, I'm affraid you may have to develop a native plugin for each platform.
Or you can try with HTML5 (for android it will work only for recent devices, maybe >4.2?) Raymond Camden made a blog entry about this : http://www.raymondcamden.com/2013/5/20/Capturing-camerapicture-data-without-PhoneGap Or you can check the page on HTML5Rocks : http://www.html5rocks.com/en/tutorials/getusermedia/intro/ But I don't think you'll be able to zoom using HTML5.
Upvotes: 1
Reputation: 81
I'm not sure about displaying in a frame, but typically when you use the camera plugin it fires into the native camera effectively leaving you're app until the user either exits or takes a picture. It is at that stage you can handle the response data.
So for example, you would have a button, link or whatever when clicked you call something like the code below. You can then on the onSuccess callback load the image into a dynamically created canvas or something like that.
navigator.camera.getPicture(onSuccess, onFail, {
quality : 40,
destinationType : Camera.DestinationType.DATA_URL,
encodingType : Camera.EncodingType.JPEG,
targetWidth : 1600,
targetHeight : 1200,
sourceType : Camera.PictureSourceType.CAMERA,
correctOrientation : true
});
Upvotes: 1