fileURI and filePath : phonegap plugin capture and camera

1,217 views
Skip to first unread message

Amit Battan Ror

unread,
Oct 12, 2011, 6:43:14 AM10/12/11
to phonegap
Hi

I am using capture plugin for video recording
and using camera plugin for the images (from gallery and camera)

But as response from both I am getting different format result.
As in Video Case(Capture) I am getting image path as fullPath
/private/var/mobile/Applications/3736F94E-F57B-4537-A352-1B746B1D67FF/
tmp/capture/capturedvideo.MOV

and in Image Case(Camera) I am getting the fileURI
file://localhost/var/mobile/Applications/3736F94E-F57B-4537-A352-1B746B1D67FF/tmp/photo_002.jpg


Can anybody tell me the reason for that. Why not it returns the same
format for both.

As I am using phonegap with iOS
so for converting the image/video into NSData I have to use
initWithContentsOfURL, initWithContentsOfFile respectively.





Becka11y

unread,
Oct 12, 2011, 2:25:59 PM10/12/11
to phonegap
The capture API conforms to the W3C capture spec and that dictates
returning a file path. The Camera functionality was written before
the Capture api was available and returns a URI. You can get the file
entry for the image URI with the following:

window.resolveLocalFileSystemURI(imageURI, gotFileEntry, fsFail);

function gotFileEntry(fileEntry) {
console.log("got image file entry: " + fileEntry.fullPath);
}
function fsFail(error) {
console.log("failed with error code: " + error.code);
}

You may even be able to just strip off the file:/localhost from your
imageURI in order to get the path but I didn't test to confirm.

-becky
Reply all
Reply to author
Forward
0 new messages