JSFiddle - React, Tailwind, and code Playground
by Daniil464
HTML
<!doctype html>
<html>
<head>
<title>Audio test</title>
<script>
function playSound(filename){
var mp3Source = '<source src="https://boost-lol.ru/wp-content/themes/newsium/plyus_org-z_uk-u_edomleniya-4.mp3" type="audio/mpeg">';
var oggSource = '<source src="' + filename + '.ogg" type="audio/ogg">';
var embedSource = '<embed hidden="true" autostart="true" loop="false" src="' + filename +'.mp3">';
document.getElementById("sound").innerHTML='<audio autoplay="autoplay">' + mp3Source + oggSource + embedSource + '</audio>';
}
</script>
</head>
<body onload="playSound()">
<p id="status">Страница загружена</p>
<!-- Will try to play bing.mp3 or bing.ogg (depends on browser compatibility) -->
<button onclick="playSound();">Play</button>
<div id="sound"></div>
</body>
</html>