Very new to Angular. I'm trying to play a hard-coded mp3 file with Angular
I have the mp3 file in the same path as my component, and I'm trying to use the tag like:
<audio controls src={{./name-of-file.mp3}}></audio>
However, this is not working. Is there a straightforward way to hardcode a brief mp3 file into my app?
Okay, actually it looks like Angular just didn't like the file location. Moving the audio file to another folder did the trick: <audio controls><source src="../../audio/name-of-file.mp3" type="audio/mpeg" /></audio>
any img/icon/music should be put in the assets folder
or you could configure in angular.json other assets folders paths
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With