rejetto forum
Software => HTML & templates => HFS ~ HTTP File Server => RAWR-Designs => Topic started by: Sentinel on February 04, 2008, 08:24:37 AM
-
i know the file directory is the play list i just want to know 'how' the player script constructs it's play list.
If i got that information i might be able to make a static playlist and load mp3 files from multiple directories
thx in advance
-
Javascript function on page load. Creates an array of id's i think.
-
//--Change the MP3 file.-------------------------//
function changeMP3(method) {
if (method=="shuffle") {
nr = Math.round(Math.random() * playList.length - 1);
while(boxOpen==playList[nr].boxid) nr = Math.round(Math.random() * playList.length - 1);
initPreviewBox(playList[nr].boxid,'MP3',playList[nr].name);
return false;
}
for(i=0;i<playList.length;i++) {
if(boxOpen == playList[i].boxid) {
nr = method=="next"?playList[i+1]?i+1:0:i-1>=0?i-1:playList.length-1;
initPreviewBox(playList[nr].boxid,'MP3',playList[nr].name);
return false;
}
}
}
//--Create dynamic playlist.---------------------//
function dynPL() {
var elem = document.getElementsByTagName("div");
for(i=0,j=0;i<elem.length;i++) {
if(elem[i]) if(elem[i].getAttribute("name")) if(elem[i].getAttribute("name") == "mp3File") {
playList[j] = elem[i]
playList[j].name = elem[i].firstChild.name
playList[j].boxid = elem[i].childNodes[1].id
j++;
}
}
}
These 2 functions handle the dynamic playlist..
The top one reads a file from the list and opens a preview box. The bottom one actually creates the list
:P good luck