Reputation: 43
I have an .mp3
URL in S3 bucket and trying to play the song from my webpage using HTML <audio>
tag. The player gets disabled and not playing the song. All my song properly getting upload to S3 bucket, and I am able to play them locally.
My code is given below:
<audio controls="controls" preload="auto" id="audio_player">< source src='https://akiaiowmyt6vxaidogxa-lw-audio.s3.amazonaws.com/lw/1502872370049.mp3' type="audio/mpeg"></audio>
S3 URL - https://akiaiowmyt6vxaidogxa-lw-audio.s3.amazonaws.com/lw/1502872370049.mp3
How to play S3 URL MP3 songs on browser?
Upvotes: 2
Views: 4424
Reputation: 21
<audio controls src="https://akiaiowmyt6vxaidogxa-lw-audio.s3.amazonaws.com/lw/1502872370049.mp3" preload="auto" id="audio_player" type="audio/mp3">
</audio>
src must be in audio tags. This solution work for me. Hope it help.
Upvotes: 2
Reputation: 1
1) Check url in any desktop player
2) space after "<" ? in "< audio" and "< /audio"
3) should be
<audio controls="controls" preload="auto" id="audio_player">
<source src=" https://akiaiowmyt6vxaidogxa-lw-audio.s3.amazonaws.com/lw/1502872370049.mp3">
</audio>
Upvotes: 0
Reputation: 944438
The server is claiming that URL contains application/pdf
formatted data. The browser doesn't know how to treat a PDF as audio.
You need to configure the server to send the correct content-type.
You can do this by going to the Properties section of the S3 section of the Amazon AWS Console.
Upvotes: 2