尝试以下 Android 版。
var path = "Android/data/"+YOUR_APP_ID+"/files/"+FILENAME+".wav";
var myMedia = new Media(path, success, error);
myMedia.startRecord();
完成录制后访问文件
var path = cordova.file.externalApplicationStorageDirectory+"files/"+FILENAME+".wav";
var myMedia1 = new Media(path, success, error);
myMedia1.play();
YOUR_APP_ID 将是 com.test.app
iOS,请参阅下文
var fileName = "myrec.wav";
var myMedia = new Media(path, success, error);
myMedia.startRecord();
访问文件
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, function (fileSystem){
fileSystem.root.getFile(fileName, null, function (fileEntry){
fileEntry.file(function OnFileEntry(file){
// file is actual recorded file, get the path and play or get base64 string
var reader = new FileReader();
reader.onloadend = function(evt) {
evt.target.result; // this is base64 string
};
reader.readAsDataURL(file);
}, error);
}, error);
}, error);