radio/script.js
2023-10-02 11:49:28 +02:00

41 lines
1.8 KiB
JavaScript

class station{
constructor(url, radio){
this.url= url;
this.radio= radio;
}
play(){
var title = document.getElementById('radio-title')
var stream = document.getElementById('stream');
title.innerText = "Escoltant " + this.radio;
stream.src = this.url;
stream.play();
const playPauseButtonIcon = playPauseButton.querySelector('i.fas')
playPauseButtonIcon.classList.remove('fa-play')
playPauseButtonIcon.classList.add('fa-pause')
}
show(){
var stream = document.getElementById('stream');
stream.pause();
const playPauseButtonIcon = playPauseButton.querySelector('i.fas')
playPauseButtonIcon.classList.remove('fa-pause')
playPauseButtonIcon.classList.add('fa-play')
var win=window.open(this.url, '_blank');
win.focus();
}
}
var catRadio = new station('http://shoutcast.ccma.cat/ccma/catalunyaradioHD.mp3', 'Catalunya Ràdio');
var catInfo = new station('http://shoutcast.ccma.cat/ccma/catalunyainformacioHD.mp3', 'Catalunya Informació');
var iCat = new station('http://shoutcast.ccma.cat/ccma/icatHD.mp3', 'iCat');
var catMusic = new station('http://shoutcast.ccma.cat/ccma/catalunyamusicaHD.mp3', 'Catalunya Música');
var vallekas = new station('https://radio.radiobot.org/listen/rvk/rvk.mp3', 'Radio Vallekas');
var punk = new station('http://punkirratia.net:8000/punk', 'Punk Irratia');
var irola = new station('http://s.streampunk.cc/_stream/irola_irratia.mp3', 'Irola Radio');
var almaina = new station('http://zeppelin.streampunk.cc/_stream/almaina.ogg', 'Radio Almaina');
var rac1 = new station('https://streaming.rac1.cat/', 'Rac 1');
var rac105 = new station('https://streaming.rac105.cat/', 'Rac 105');
var franceInfo = new station('https://icecast.radiofrance.fr/franceinfo-midfi.mp3', 'France Info');
var rne = new station('rne.html', 'RNE');
var serCat = new station('sercat.html', 'SER Catalunya');