Hatem Frere
Hatem Frere

Reputation: 75

How i can play audio in html?

<audio controls="controls" preload="auto"> 
 <source src="src/audio/blog_audio/music_file.ogg"  type="audio/ogg" /> 
 Your browser does not support the audio element. 
 <source src="src/audio/blog_audio/music_file.mp3"  type="audio/mp3" /> 
 Your browser does not support the audio element. 
 <source src="src/audio/blog_audio/music_file.aac"  type="audio/aac" /> 
 Your browser does not support the audio element. 
</audio>

I searched a lot here for a solution to the problem of playing the audio in the html5 file not working, and I did not find a solution to my problem, so I want to repeat the question in another form: the audio file works on the device or local host, but after uploading to the server it does not work. I think the code is written correctly and I don't know how to solve it I modified the mp3 audio file type to type="audio/mpeg"

This is the console error

https://i.sstatic.net/47Sot.jpg

Please help to solve the problem

Thank you all

Upvotes: 1

Views: 343

Answers (1)

Wengou
Wengou

Reputation: 26

This is not from your code. The problem appear because you don't set the correct permissions for the file, this is why you get a 403 error and you can't play audio files on your page.

(I know my answer is a little bit blur, hope someone else could help you better ...)

Upvotes: 1

Related Questions