'Audio file not playing

I want to embed the audio file on the html page on the server. The audio file is in the same folder as the html file, the path in src in the tag audio is correct, why is it not playing?

html file

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">

  <title></title>
</head>
<body>

<audio>
<source src="f.mp3" type="audio/mp3">
</audio>

</body>
</html>


Solution 1:[1]

As described in mdn (https://developer.mozilla.org/fr/docs/Web/HTML/Element/audio), the <audio> tag should be writted like <audio src="f.mp3" type="audio/mp3"></audio>.

If you want to display your player, add controls to your tag.

If you want to play the media when the page load, you can add autoplay, but, many web browser not enable autoplay by default as you can read here https://developer.chrome.com/blog/autoplay/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Blouf