master
santic-zombie 5 years ago
parent dcf3626d6b
commit a1bd4295cc
  1. 13
      index.php

@ -43,7 +43,7 @@
<div> <div>
vol: vol:
<br> <br>
<input id="volume" type="range" min="0" max="20" value="5" /> <input id="volume" type="range" min="0" max="10" value="5" step="0.1" />
</div> </div>
<span id="duration"></span> <span id="duration"></span>
@ -57,20 +57,19 @@
<script language="JavaScript"> <script language="JavaScript">
var audio = new Audio('http://stream.santic-zombie.ru'); var audio = new Audio('http://stream.santic-zombie.ru');
var play = document.getElementById('play'); var play = document.getElementById('play');
play.addEventListener('click', function() { play.addEventListener('click', function() {
$("#myPlay").text("Now playing:"); $("#myPlay").text("Now playing:");
audio.play(); audio.play();
}, false); }, false);
var pause = document.getElementById('pause'); var pause = document.getElementById('pause');
pause.addEventListener('click', function() { pause.addEventListener('click', function() {
$("#myPlay").text("Paused"); $("#myPlay").text("Paused");
audio.pause(); audio.pause();
}, false); }, false);
var volume = document.getElementById('volume');
volume.addEventListener('change', function(){
audio.volume = parseFloat(this.value / 10);
}, false);
audio.addEventListener("timeupdate", function() { audio.addEventListener("timeupdate", function() {
var duration = document.getElementById('duration'); var duration = document.getElementById('duration');
var s = parseInt(audio.currentTime % 60); var s = parseInt(audio.currentTime % 60);
@ -81,6 +80,10 @@
if (h < 10) h = '0' + h; if (h < 10) h = '0' + h;
duration.innerHTML = h + ':' + m + ':' + s; duration.innerHTML = h + ':' + m + ':' + s;
}, false); }, false);
$("#volume").mousemove(function(){
audio.volume = parseFloat(this.value / 10);
});
</script> </script>
<script language="JavaScript"> <script language="JavaScript">

Loading…
Cancel
Save