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

48 lines
1.4 KiB

5 years ago
var stream_url = 'http://stream.santic-zombie.ru';
var audio = new Audio(stream_url);
audio.volume = 0.01;
var play = document.getElementById('play');
play.addEventListener('click', function() {
5 years ago
$("#PlayStat").text("Now playing");
audio.play();
}, false);
var pause = document.getElementById('pause');
pause.addEventListener('click', function() {
5 years ago
$("#PlayStat").text("Paused");
audio.pause();
}, false);
$("#volume").mousemove(function(){
audio.volume = parseFloat(this.value / 10);
});
5 years ago
var button = document.getElementById('buff');
button.addEventListener('click', function () {
var MsgText = $('<div id="message-success"><p>Trackname copied to clipboard</p></div>'),
MsgData = $('#jGrowl');
MsgData.html(MsgText).fadeIn();
setTimeout(function() {MsgData.fadeOut();}, 2000);
//нашли наш контейнер
var ta = document.getElementById('trackname');
//производим его выделение
var range = document.createRange();
range.selectNode(ta);
window.getSelection().addRange(range);
//пытаемся скопировать текст в буфер обмена
try {
document.execCommand('copy');
} catch(err) {
console.log('Can`t copy, boss');
}
//очистим выделение текста, чтобы пользователь "не парился"
window.getSelection().removeAllRanges();
});
5 years ago
//audio.muted = true;