2

i am integrating camera in my phonegap application to record a video and to capture an image. i am using Phonegap 1.5.0 for iPhone.

to capture an imge i am using this code:

  function capturePhoto() { 

   navigator.camera.getPicture(onPhotoDataSuccess, fail, { quality: 30 }); 
   }

On button click i am calling above function but it did nothing. can anybody help me in this?

Thanks.

1 Answer 1

2

I have tried it with Cordova latest and it's working fine. Please check the code -

<script type="text/javascript">

document.addEventListener("deviceready",onDeviceReady,false);

function onDeviceReady() {

console.log("CORDOVA IS WORKING:::");
}

        function capturePhoto()
{
navigator.camera.getPicture(onSuccess, onFail, { quality: 50, 
destinationType: Camera.DestinationType.FILE_URI }); 
}

function onSuccess(imageURI) {
var image = document.getElementById('myImage');
image.src = imageURI;
}

function onFail(message) {
alert('Failed because: ' + message);
}    
</script>
1
  • Hi there, is it possible to embed camera to div in ios phonegap? Jun 5, 2013 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.