我正在尝试创建一个
Android应用程序,到目前为止,使用本机录音机录制音频.
其路径是/ storage / emulated / 0 / Sounds中的Sounds文件
现在该应用程序正在使用File Transfer cordova插件.它的根是/ data / data / thisAppDirectory,requestFileSystem使用它作为路径.
解决方法
是的,我们走吧!您必须使用cordova文件传输插件,如下所示:
window.requestFileSystem(LocalFileSystem.TEMPORARY,function(fs){ fs.root.getFile("'"+audioData[0].name+"'",{create: true,exclusive: false},function(entry){ var fileTransfer = new FileTransfer(); fileTransfer.download( "file:///storage/emulated/0/Sounds/" + audioData[0].name,// the filesystem uri you mentioned "cdvfile://localhost/temporary/" + audioData[0].name,function(entry) { // do what you want with the entry here console.log("download complete: " + entry.fullPath); window.requestFileSystem(LocalFileSystem.TEMPORARY,1000000000,gotFS,fail); },function(error) { console.log("error source " + error.source); console.log("error target " + error.target); console.log("error code " + error.code + "Cheeeese"); },false,null ); },function(){ alert("file create error"); }); },null);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。