我收到以下代码的错误代码 1000...
根据其他问题,这可能是由于路径变量中前面的/造成的。我尝试将其取出,结果出现错误代码 9。
如果我只是将gotFS 函数设置为audioData[0].name,那么捕获的音频文件就会上传 - 但文件为空且已损坏。
对确定文件路径进行了一些检查,并确定下面代码中的该路径存在。但我收到错误代码 1000 和 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);
}
最佳答案
理解大问题 -
getFile 对象的参数设置为 {create: true},这导致创建空文件。
对此要非常小心!
现在我们遇到了一个新问题 - 指示cordova的文件插件访问android默认录音机的目录并选择录音上传到Parse。因此,超出根文件系统的几个目录,然后返回到/storage/emulated/0/Sounds/。根目录为/storage/emulated/0/Android/data/ourproject/cache。
关于javascript - cordova 中 fileSystem.root.getFile 的错误代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29994453/