Come mettere una radio nel proprio sito
Obiettivo
In questo articolo tratteremo come mettere una radio nel nostro sito grazie a windows media player.
I canali radio
La prima cosa che dobbiamo fare e’ procuraci una lista di canali radio. Basta fare una ricerca con google per trovarli. Quelli che io ho messo sono:
DiscoRadio http://discoradio.fabbricadigitale.it/asx/discoradio.asx
101 Network http://www.radio101.it/live101/radio101.asx
105 Classic http://www.105.net/fmclassics.asx
Hit Channel http://www.rtl.it/mediaplayer/1025hitchannel.asx
Montecarlo http://www.tv-radio.com/station/rmc_italie/rmc_italie-20k.asx
Radio 105 http://www.105.net/105.asx
Radio Deejay mms://deejay.wm.p1.str3.com/djradio
RDS http://www.rds.it/pandora/streaming/rds.asx
RIN mms://wmedia.rin.it/rin
RTL 102.5 http://www.rtl.it/mediaplayer/rtl1025.asx
Fatto cio’ dobbiamo creare un player che trasmetta il suono proveniente da queste radio.
Articolo
LA cosa che dobbiamo fare e’ quella di copiare il codice sottostante nella nostra pagina e il gioco e’ fatto
<script>
var streams = new Array();
streams[0] = new makeStream(”http://discoradio.fabbricadigitale.it/asx/discoradio.asx”, “DiscoRadio”);
streams[1] = new makeStream(”http://www.radio101.it/live101/radio101.asx”, “101 Network”);
streams[2] = new makeStream(”http://www.105.net/fmclassics.asx”, “105 Classic”);
streams[3] = new makeStream(”http://www.rtl.it/mediaplayer/1025hitchannel.asx”, “Hit Channel”);
streams[4] = new makeStream(”http://www.tv-radio.com/station/rmc_italie/rmc_italie-20k.asx”, “Montecarlo”);
streams[5] = new makeStream(”http://www.105.net/105.asx”, “Radio 105″);
streams[6] = new makeStream(”mms://deejay.wm.p1.str3.com/djradio”, “Radio Deejay”);
streams[7] = new makeStream(”http://www.rds.it/pandora/streaming/rds.asx”, “RDS”);
streams[8] = new makeStream(”mms://wmedia.rin.it/rin”, “RIN”);
streams[9] = new makeStream(”http://www.rtl.it/mediaplayer/rtl1025.asx”, “RTL 102.5″);
function makeStream(url, name) {
this.url = url;
this.name = name;
}
function handleControlsOnOffClick() {
if (document.mediaPlayer.showControls == true) {
document.mediaPlayer.showControls = false;
document.playerCtrl.controls.value = ” Show Controls “;
}
else {
document.mediaPlayer.showControls = true;
document.playerCtrl.controls.value = ” Hide Controls “
}
}
function handlePlayOrPauseClick(){
var state;
playerStatus = document.mediaPlayer.playState;
if (playerStatus == 6) {
document.mediaPlayer.play();
document.playerCtrl.playOrPause.value = ” Pause “;
}
else if (playerStatus == 1) {
document.mediaPlayer.play();
document.playerCtrl.playOrPause.value = ” Pause “;
}
else if (playerStatus == 2) {
document.mediaPlayer.pause();
document.playerCtrl.playOrPause.value = ” Play “;
}
}
function changeSize(newSize) {
document.mediaPlayer.displaySize = newSize;
}
function change() {
var list = document.playerCtrl.streams;
var streamURL = list.options[list.selectedIndex].value;
document.mediaPlayer.stop();
document.playerCtrl.playOrPause.value = ” Pause “;
document.mediaPlayer.fileName = streamURL;
pstatus.innerHTML = “In attesa”;
speed.innerHTML = “In attesa”;
buffer.innerHTML = “In attesa”;
}
function playerstatus() {
code = mediaPlayer.OpenState;
if (code == 0) code = “In attesa”;
if (code == 1 || code == 2) code = “Caricamento dati”;
if (code == 3) code = “Ricerca Server”;
if (code == 4) code = “Connesso”;
if (code == 5) code = “”;
if (code == 6) code = “Connesso”;
pstatus.innerHTML = code;
buffer.innerHTML = ” ” + mediaPlayer.BufferingProgress + “%”;
speed.innerHTML = ” ” + parseInt(mediaPlayer.Bandwidth / 1024) + ” Kbps”;
}
</script>
<body onLoad=’window.setInterval (”playerstatus()”,800);’>
<FORM NAME=”playerCtrl”>
<INPUT TYPE=”hidden” VALUE=” Pause ” NAME=”playOrPause”>
<SCRIPT>
with (document) {
writeln(’<SELECT NAME=”streams” onChange=”change()”>’);
for (var i = 0; i < streams.length; i++) {
writeln(’<OPTION VALUE=”’, streams[i].url, ‘”>’, streams[i].name);
}
writeln(’</SELECT>’);
}
</SCRIPT>
</FORM>
Stato:<span id=”pstatus” style=’font-size:10px’>In attesa</span><br>
Buffer:<span id=”buffer” style=’font-size:10px’>In attesa</span><br>
Velocita’:<span id=”speed” style=’font-size:10px’>In attesa</span><br>
<br>
<OBJECT
ID=”mediaPlayer”
CLASSID=”CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95″
CODEBASE=”http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701″
STANDBY=”Loading Microsoft Windows Media Player components…”
TYPE=”application/x-oleobject”
STYLE=”WIDTH:282px;HEIGHT:26px”>
<PARAM NAME=”SendOpenStateChangeEvents” VALUE=”true”>
<PARAM NAME=”fileName” VALUE=”http://discoradio.fabbricadigitale.it/asx/discoradio.asx”>
<PARAM NAME=”animationatStart” VALUE=”false”>
<PARAM NAME=”transparentatStart” VALUE=”true”>
<PARAM NAME=”autoStart” VALUE=”true”>
<PARAM NAME=”showControls” VALUE=”true”>
<PARAM NAME=”AudioStream” VALUE=”true”>
<PARAM NAME=”ShowControls” VALUE=”true”>
<PARAM NAME=”ShowAudioControls” VALUE=”true”>
<PARAM NAME=”ShowDisplay ” VALUE=”false”>
</OBJECT>
Via | sastgroup
Nessun Commento »
Puoi lasciare una risposta, oppure fare un trackback dal tuo sito.
Vuoi essere il primo a lasciare un commento per questo articolo? Utilizza il modulo sotto..
