<button onclick='playPause()'><i aria-hidden='true' id='myicon'/></button> <button onclick='player.volume = Math.min(player.volume * 1.2, 1)'><font size='+1'><i aria-hidden='true' class='fa fa-volume-up'/></font></button> <button onclick='player.volume /= 1.2'><font size='+1'><i aria-hidden='true' class='fa fa-volume-down'/></font></button> 

There is a working audio player on JS. Everything works as expected (in the desktop), but: the android at full stop "does not see" the preset volume (0.2) and starts the volume higher (according to the sensations - 0.5). And the first time you press volume up (+ volume) instead of increasing the sound, the set value is executed: resets the sound by 0.2. Then everything works as it should. The bug occurs only during the first launch. And only in android. Where is the mistake?

 <script> var mysrc = &quot;http://радиостанция.mp3&quot;; var player = new Audio(mysrc); var myicon = document.getElementById(&quot;myicon&quot;); var current_volume = player.volume = 0.2; if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ){ myicon.className = &quot;fa fa-play&quot;; }else{ myicon.className = &quot;fa fa-spinner fa-pulse fa-1x fa-fw&quot;; player.addEventListener(&#39;loadeddata&#39;, function(){ myicon.className = &quot;fa fa-play&quot;; }, false); } function playPause(){ if(player.paused){ player.play(); if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { myicon.className = &quot;fa fa-spinner fa-pulse fa-1x fa-fw&quot;; setTimeout(function(){ myicon.className = &quot;fa fa-pause&quot;; player.volume = current_volume; }, 3000); }else{ myicon.className = &quot;fa fa-pause&quot;; } }else if(player.muted==true){ player.muted=false; player.volume = current_volume; myicon.className = &quot;fa fa-pause&quot;; }else{ current_volume = player.volume; player.muted=true; myicon.className = &quot;fa fa-play&quot;; } } </script> 

    0