1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<!DOCTYPE html> <script> var ac = new AudioContext(); fetch("audio.ogg").then(response => { return response.arrayBuffer(); }).then(ab => { return ac.decodeAudioData(ab); }).then(ab => { var src = ac.createBufferSource(); src.buffer = ab; src.loop = true; src.start(); src.connect(ac.destination); }); </script>