Home > database >  How can I play the file uploaded to an Amazon S3 bucket in html?
How can I play the file uploaded to an Amazon S3 bucket in html?

Time:12-04

I want to play audio file in Website.

I've tried inputting the S3 URL to the src attribute, but it's not working.

<audio
  controls
  autoplay
  id="audio"
  src="s3://bucektname/speech2.mp3">
</audio>

CodePudding user response:

I solved this, and my app now plays an MP3 audio file located in an Amazon S3 bucket.

app screenshot

I used the aws s3 screenshot

  • Then, add to the URL to the following line of code in the JavaScript file:

    $(this).jPlayer("setMedia", {
        title: "Bubble",
        mp3: "https://<BUCKETNAME>.s3.amazonaws.com/<MP3 FILE NAME>"
    });
    
  • Now your app will play an MP3 file located in an Amazon S3 bucket. Enjoy!

    • Related