0
我試圖創建一個.wav文件並將其與cordova media-plugin合併,並且它一直說資源未知。這是代碼:ionic2創建.wav文件並獲取cordova media-plugin的路徑
private startRecording() {
let filename = "myRecord.wav";
File.createFile(cordova.file.documentsDirectory, filename, true).then((result)=>{
console.log(result);
this._fileRecord = new MediaPlugin(cordova.file.documentsDirectory + 'myRecord.wav');
this._fileRecord.startRecord();
},
(error)=>{
console.log("error");
});
}
謝謝,它的工作原理。我只需在cordova.file.dataDirectory中將「file:///」替換爲「cdvfile://」(讓path = cordova.file.dataDirectory; path = path.replace(「file:/// 「,」cdvfile://「)); –