Audio player form url in html 5, hugo and netlify

22 Views Asked by At

I'm trying add an audio player that stream audio from an url. My site was created using hugo, it's running on netlify.

Here's the code.

<audio controls="controls">
    <source src="http://url.redacted:8386/test" type="audio/mpeg">
</audio>

It works on localhost but when pushed to github and built on netlify, it just doesn't work. The player is greyed out.

Thank you for your help!

As seen in the box above.

1

There are 1 best solutions below

1
Nirmit Kotadiya On

Try this out:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- audio -->
    <audio controls="controls">
      <source
        src="http://replace.with.your/audio.mp3"
        type="audio/mpeg"
      />
    </audio>
  </body>
</html>

Save file as index.html and deploy your Hugo site to Netlify. Once deployed, visit your site to see the audio player in action.