Web radio
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
radio/js/audio.js

33 lines
899 B

5 years ago
var stream_url = 'http://stream.santic-zombie.ru';
var audio = new Audio(stream_url);
var play = document.getElementById('play');
play.addEventListener('click', function() {
$("#myPlay").text("Now playing:");
audio.play();
}, false);
var pause = document.getElementById('pause');
pause.addEventListener('click', function() {
$("#myPlay").text("Paused");
audio.pause();
}, false);
audio.addEventListener("timeupdate", function() {
var duration = document.getElementById('duration');
var s = parseInt(audio.currentTime % 60);
var m = parseInt((audio.currentTime / 60) % 60);
var h = parseInt((audio.currentTime / 3600) % 60);
if (s < 10) s = '0' + s;
if (m < 10) m = '0' + m;
if (h < 10) h = '0' + h;
duration.innerHTML = h + ':' + m + ':' + s;
}, false);
$("#volume").mousemove(function(){
audio.volume = parseFloat(this.value / 10);
});
5 years ago
//audio.muted = true;