i am using the cordova media plugin to record .wav audio samples.
Actually i am able to record them but i can't find the way to get the already created file content.
If i do:
// Record audio
//
function recordAudio() {
var src = "myrecording.wav";
var mediaRec = new Media(src, onSuccess, onError);
// Record audio
mediaRec.startRecord();
// Stop recording after 10 sec
var recTime = 0;
var recInterval = setInterval(function() {
recTime = recTime + 1;
setAudioPosition(recTime + " sec");
if (recTime >= 3) {
clearInterval(recInterval);
mediaRec.stopRecord();
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, function(fs){
fs.root.getFile("myrecording.wav", {create: true, exclusive: false},
function(entry){
console.log("console loggin file");
console.log(entry);
}, function(){
alert("file create error");
});
}, null);
}
}, 1000);
}
i get entry this in console:
{"isFile":true,"isDirectory":false,"name":"myrecording.wav","fullPath":"/myrecording.wav","filesystem":"<FileSystem: temporary>","nativeURL":"file:///Users/iamuser/Library/Developer/CoreSimulator/Devices/FC61A8C0-CF4B-4A1C-B22C-D8511B1B1707/data/Containers/Data/Application/716F442C-5076-4C69-9CA9-A1A8C2827898/tmp/myrecording.wav"}
but this is not the file content, how to retrieve the file as text from documents:// directory?
The file is recorded using the media plugin into documents://audio.wav path which seems to be a temporary file
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…