HTML audio tag volume

后端 未结 1 1510
野的像风
野的像风 2020-12-17 09:30

I embedded a background audio into my website which autoplays on visit.

The source of the audio is a online stream hotlink.

相关标签:
1条回答
  • 2020-12-17 10:19

    Theres no volume attribute supported by browsers so you must set the volume property in JavaScript

    <audio autoplay id="myaudio">
      <source src="http://lel.com/link/to/stream.m3u">
    </audio>
    
    <script>
      var audio = document.getElementById("myaudio");
      audio.volume = 0.2;
    </script>
    

    See http://jsfiddle.net/sjmcpherso/6r1emoxq/

    0 讨论(0)
提交回复
热议问题