fileURI and filePath : phonegap plugin capture and camera

1.217 weergaven
Naar het eerste ongelezen bericht

Amit Battan Ror

ongelezen,
12 okt 2011, 06:43:1412-10-2011
aan 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

ongelezen,
12 okt 2011, 14:25:5912-10-2011
aan 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
Allen beantwoorden
Auteur beantwoorden
Doorsturen
0 nieuwe berichten