Search code examples
htmlaudiosrc

HTML audio won't play file but download works


I feel like I have tried everything.

I have the following:

<audio controls ng-src="https://myS3routeToFile" class="w-full"></audio>

I have also tried the following variation:

<audio controls>
  <source src="https://myS3routeToFile" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

I am able to press download it does download the file correctly.

enter image description here

enter image description here

What am I doing wrong?


Solution

  • Use the second version and add an ogg version of your audio file to make it complatble with all browsers.

    <audio controls>
      <source src="your_file.ogg" type="audio/ogg">
      <source src="your_file.mp3" type="audio/mpeg">
    </audio>