Reputation: 638
I'm getting an error code 1000 with this following code...
According to other issues, this could be because of the preceding / in the path variable. I tried taking this out and wound up with error code 9.
If I just set the gotFS function to audioData[0].name, then the upload of the captured audio file goes through - but with an empty, corrupted file.
Did a few checks about that determining the path of the file, and determined this path here in the code below exists. But I'm getting error codes 1000 and 9. ?
var path = "/storage/emulated/0/Sounds/" + audioData[0].name;
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, gotFS, fail);
function gotFS(fileSystem) {
console.log("gotFS is called" + fileSystem);
fileSystem.root.getFile(path, {create: true}, gotFileEntry, fail);
}
function gotFileEntry(fileEntry) {
console.log("gotFileEntry:" + fileEntry);
fileEntry.file(gotFile, fail);
}
function gotFile(file){
console.log("gotFile");
//readBinaryString(file);
readArrayBuffer(file);
}
Upvotes: 2
Views: 5496
Reputation: 638
Big problem understood -
The parameter of the getFile object was set to {create: true}, which was causing an empty file to be created.
Be very careful with this!
Now we have a new problem - directing the file plugin of cordova to reach out to the directory of the android default voice recorder and select the recording to upload to Parse. So, reaching beyond the root file system up a couple directories then back down into /storage/emulated/0/Sounds/. The root directory being /storage/emulated/0/Android/data/ourproject/cache.
Upvotes: 1
Reputation: 5402
Which lines are executing? Success or Fail? Meaning, how far is executing getting, and which lines are throwing the exception? Maybe try using:
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
Also, the 0 is size (in bytes) the app will require for storage. Don't you have to have something there?
Upvotes: 0