Site with streaming radio.

Problem: when you start the sound, pressing the "ether" button , playback starts at 100% volume, which is not very convenient.

Is it possible to correct, so that it starts with 50%?

<audio id='player' src='http://бла-бла.mp3' /> <div style='position:absolute; top:154px; left:0px; z-index:11; width:104px; line-height:98px;'> <button onclick='document.getElementById(&apos;player&apos;).play()'>Эфир</button> <button onclick='document.getElementById(&apos;player&apos;).pause()'>Стоп</button> <button onclick='document.getElementById(&apos;player&apos;).volume+=0.1'><font size="+3">+</font></button> <button onclick='document.getElementById(&apos;player&apos;).volume-=0.1'><font size="+3">—</font></button> </div> 

  • Comments are not intended for extended discussion; conversation moved to chat . - JuriySPb

1 answer 1

Immediately set the sound to a certain level myVid.volume = 0.1;

 var myVid = document.getElementById('player'); myVid.volume = 0.1; 
 <audio id="player" src="https://api.soundcloud.com/tracks/316952238/stream?client_id=LvWovRaJZlWCHql0bISuum8Bd2KX79mb"></audio> <div style="position:absolute; top:154px; left:0px; z-index:11; width:104px; line-height:98px;"> <button onclick="document.getElementById('player').play()">Эфир</button> <button onclick="document.getElementById('player').pause()">Стоп</button> <button onclick="document.getElementById('player').volume+=0.1">+</button> <button onclick="document.getElementById('player').volume-=0.1">-</button> </div> 

  • To get 50% loudness, you will need to set myVid.volume = 0.5 accordingly ; - Oleg