Play sound in Angular 4
As per Robin's comment, i have checked that link we can use it using the audio() object in the ts file like this:
this.audio = new Audio();
this.audio.src = "../../../assets/sounds/button_1.mp3";
this.audio.load();
this.audio.play();
just did this in a project am working (angular 4) and it worked
playAudio(){
let audio = new Audio();
audio.src = "../../../assets/audio/alarm.wav";
audio.load();
audio.play();
}
this.playAudio();
make sure the path is correct and references an existing audio