I am struggling with media plugin for playing recorded audio in android kit kat. I can record and save file in my application directory but its not playing audio. Its working fine in marshmallow. Below is the code that i am using.
startRecord(){
this.filename= ‘demo.amr’;
this.file.createFile(this.file.externalDataDirectory+this.filename,true).then((fileEntry)=>{
this.fileUrl = fileEntry.toInternalURL();
this.myMedia = this.media.create(this.fileUrl,this.statusupdate, this.onSuccess, this.onError);
this.myMedia.startRecord();
let timer = 120;
this.mediaTimer = setInterval(()=> {
timer = timer - 1;
if (timer <= 0) {
clearInterval(this.mediaTimer);
this.myMedia.stopRecord();
}
}, 1000);
});
}
playRecord(){
this.myMedia = this.media.create(this.fileUrl,this.statusupdate, this.onSuccess, this.onError);
this.myMedia.play();
}