So, I’ve developed an App that records an Audio then display it to the user on a list. The audio has 2 buttons, play and remove, somehow the function removeAudio isn’t working. Am I doing something wrong?
playAudio(file,idx) {
if (this.platform.is('ios')) {
this.filePath = this.file.documentsDirectory.replace(/file:\/\//g, '') + file;
this.audio = this.media.create(this.filePath);
} else if (this.platform.is('android')) {
this.filePath = this.file.externalDataDirectory.replace(/file:\/\//g, '') + file;
this.audio = this.media.create(this.filePath);
}
this.audio.play();
this.audio.setVolume(0.8);
}
deleteAudio(){
if (this.platform.is('ios')) {
this.audio = this.file.removeFile(this.filePath, this.fileName);
} else if (this.platform.is('android')) {
this.audio = this.file.removeFile(this.filePath, this.fileName);
}
}