March 27, 2009

Radio Streaming in Flash

আপনার ইউয়ারএল দিয়ে ডাউনলোড করুন এই ধরনের ফাইল হতে পারে- pls/.m3u।

এই ধরনের বাটন তৈরী করুন-

volu | Volume Up
vold | Volume Down
nextChan | Next Channel
prevChan | Previous Channel
rndbtn | Random Channel
/*******************************************
** RadioStreamer - v1.1 build 14 **
** Last build 9 May 2008 **
********************************************
** Author: Odin HG **
** Copyleft **
********************************************
** Notes: **
** Download any playlist-file, open in **
** a plain text-editor. Copy IP:PORT **
** add ";stream;nsv" (Whithout the qoutes)**
** to the stream-ip. **
** Then, add it to the chans-array. **
** chans[Channel#]=[title,ip,description] **
** use n for linebreak in description **
*******************************************/


/* EXAMPLE-CHANNELS */
var chans = new Array();//[title,ip:port;stream.nsv,description]
chans[0] = ["Radio #1", "http://s2.viastreaming.net:7130;stream.nsv", "Latest hits.nhttp://www.radio1.com"];
chans[1] = ["Classics", "http://193.112.14.122:8080;stream.nsv", "Classical music 24/7.nhttp://www.classicradio.com"];
chans[2] = ["FunkRadio", "http://stream.funkradio.com:7130;stream.nsv", "Funk music!.nVisit http://www.funkradio.com"];
/* END OF CHANNEL-ARRAY */


stream = new Sound();//Create new sound
current = 0;//Current channeø
vol = 75;//Volume


function update() {//Update channel
if (current<0) {
current = 0;
}
if (current>chans.length-1) {
current = chans.length-1;
}
stream.stop();//Stop stream
stream.loadSound(chans[current][1], true);//Load new stream
setvol();//Set new volume
_root.txtChan = chans[current][0];//Set title-text
_root.txtDesc = chans[current][2];//Set description-text
}


function setvol() {//Set volume
if (vol>100) {
vol = 100;
}
if (vol<0) {
vol = 0;
}
stream.setVolume(vol);//Set volume
}


_root.onLoad = function() {//On load
update();//Update channel
};


_root.volu.onPress = function() {//Volume up
vol += 5;
setvol();
};


_root.vold.onPress = function() {//Volume down
vol -= 5;
setvol();
};


_root.nextChan.onPress = function() {//Next channel
current += 1;//Go to next channel
update();//Update channel
};


_root.prevChan.onPress = function() {//Previous channel
current -= 1;//Go to previous channel
update();//Update channel
};


_root.rndbtn.onPress = function() {//Random channel
current = Math.round(Math.random()*(chans.length-1));//Get random channel
update();//Update channel
};

No comments:

Post a Comment