Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to serve audio files in sping boot

I have audio tag in html, I need to know the src attribute, where should I put the audio folder to be able to reference it as src="audio/audio_name" ?

I tried to put it in resources folder, but when put src="http://localhost:9191/resources/audios/audio_name" it returned 404 not found

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You’d need to put your audio file into of the following directories:

  • /META-INF/resources/
  • /resources/
  • /static/
  • /public/

You can then reference a file /static/audio/file.mp3 from HTML with /audio/file.mp3.

See Serving Static Web Content with Spring Boot.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading