I'm capturing a video using the capture API. When the user cancels the
capture (back on android) it calls the error callback but with the
string "Canceled" and not an with an error code like
CaptureError.CAPTURE_NO_MEDIA_FILES.
Here is the code:
function(captureOptions) {
var captureSuccess = function(mediaFiles) {
var filesPathToUpload = [];
for ( var i = 0, len = mediaFiles.length; i < len; i += 1) {
filesPathToUpload.push(mediaFiles[i].fullPath);
}
captureOptions.callback(filesPathToUpload);
};
// Called if something bad happens.
var captureError = function(error) {
console.log('An error occurred during capture: ' +
JSON.stringify(error));
if(error.code === CaptureError.CAPTURE_NO_MEDIA_FILES) {
alert('User left the application before capture');
}
};
navigator.device.capture.captureVideo(captureSuccess, captureError,
{
limit : 1
});
}
What could be the cause?
Using PhoneGap 1.1.0 with Samsung Galaxy S2.
Thanks,
Daniel