View Full Version : Jukebox problem


The Sumo
07-26-2005, 06:31 PM
I used this jukebox that was posted by DemolitionMan50, but for some reason cannot get it to play (the pages says it has an error). I put it in webstats and took off all the <br/ >'s that were originally on the script. This is it, someone please tell me what's wrong!

<!-- begin code provided by createblog.com -->
<OBJECT ID="Player" height="0" width="0" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<PARAM NAME="uiMode" VALUE="invisible">
<PARAM NAME="Autostart" VALUE="False">
</object>
<FORM ID="form">
<SELECT ID="playlist" size="1">
<!-- Add song info that appears in drop down list here -->
<option value="0">Sitting, Waiting, Wishing - Jack Johnson</option>
<option value="1">Mr. Jones - Counting Crows</option>
<option value="2">Blues Traveler - Canadian Rose</option>
<option value="3">Oasis - Wonderwall</option>
<option value="4">Sympathy for the Devil - The Rolling Stones</option>
</SELECT>
<BR>
<BUTTON ID="BackButton" onClick="Back(forms['form'].playlist);">&nbsp;<<&nbsp;</BUTTON>
<BUTTON ID="PlayPauseButton" onClick="PlayPause(forms['form'].playlist);"><FONT color="green">&nbsp;&nbsp;Play&nbsp;&nbsp;</FONT></BUTTON>
<BUTTON ID="NextButton" onClick="Next(forms['form'].playlist);">&nbsp;>>&nbsp;</BUTTON>&nbsp;
<BUTTON ID="StopButton" onclick="Stop();"><FONT color="maroon">Stop</FONT></BUTTON>
<b><font size="3" color="black">Shuffle</font></b><INPUT TYPE=checkbox CHECKED ID="ShuffleSwitch" onclick="ToggleShuffle(this);" value="ON">
</FORM>
</CENTER>
<comment ID="PlayHTML"><FONT color="green">&nbsp;&nbsp;Play&nbsp;&nbsp;</FONT></comment>
<comment ID="ShuffleOnHTML"><INPUT TYPE=checkbox CHECKED ID="ShuffleSwitch" onclick="ToggleShuffle(this);"></comment>
<comment ID="ShuffleOffHTML"><INPUT TYPE=checkbox UNCHECKED ID="ShuffleSwitch" onclick="ToggleShuffle(this);"></comment>

<script ID="Main" Language="JavaScript">
var songs = new Array();
//************************* ******//
//****** CHANGEABLE STUFF *******//
//*************************
var shuffle = false; // false = shuffle off, true = shuffle on
var autoStart = true; // false = autoStart off, true = autoStart on
var numberTracks = true; // true = place track number in front of list items, false = no track numbers
// Add song URLs here (make sure it matches up with the order you have for song info, and urls need quotes):
songs[0]="http://boss.streamos.com/wmedia/universalmotown/brushfire/jack_johnson/audio/01sitting_waiting_wishing.asx";
songs[1]="http://www.peterlangenberg.com/Downloads/Mp3z/Counting%20Crows%20-%2003%20-%20Mr.%20Jones.mp3";
songs[2]="http://harp.muse.pl/data/bt_rose.mp3";
songs[3]="http://webjay.org/insta.asx?url=http://a425.v8384d.c8384.g.vm.akamaistream.net/7/426/8384/3b858b51/mtvrdstr.download.akamai.com/8512/wmp/0/83/72_1_3_05.asf";
songs[4]="http://www.pressriot.com/lea_esta_semana/articulos/115/The_Rolling_Stones_Sympathy_For_The_Devil.mp3";
//************************* ******//
//************************* ******//
// Initializations //
with (document){
var length = forms['form'].playlist.length;
if(numberTracks){
for (var i = 0; i < length; i++){
forms['form'].playlist.options[i].innerHTML = (i+1) + " - " + forms['form'].playlist.options[i].innerHTML;
}
}
if (shuffle) {
var randsg = Math.floor(Math.random()* songs.length);
Player.url = songs[randsg];
forms['form'].playlist.options[randsg].selected = true;
forms['form'].ShuffleSwitch.outerHTML = ShuffleOnHTML.innerHTML;
}
else {
forms['form'].ShuffleSwitch.outerHTML = ShuffleOffHTML.innerHTML;
Player.url = songs[0];
}
if(autoStart){
var snum = forms['form'].playlist.selectedIndex;
if(Player.url != songs[snum]){
Player.url = songs[snum];
}
Player.controls.Play();
}
}
// Functions //
// Discription: "PlayPause" will toggle playing and pausing if the same song is still selected,
// otherwise it will load the newly selected song
function PlayPause(list) {
var snum = list.selectedIndex;
if((Player.url == songs[snum] && Player.url != "") && Player.playState != 1){
if(Player.playState == 3){
Player.controls.Pause();
}
else {
Player.controls.Play();
}
}
else {
Player.url = songs[snum];
Player.controls.Play();
}
}
// Discription: "Next" will move to the next music file if shuffle is off
// otherwise it will load a random song. Calls PlayPause to start music.
function Next(list) {
var snum = list.selectedIndex;
if (!shuffle) {
if (snum == list.length-1) {
snum = -1;
}
snum++;
}
else {
var temp;
do{
temp = Math.floor(Math.random()* songs.length);
} while(temp == snum);
snum = temp;
}
list.options[snum].selected = true;
PlayPause(list);
}
// Discription: "Back" does the same thing as "Next" but moves backwads
// through the list. If shuffle is on then picks a random song.
function Back(list) {
var snum = list.selectedIndex;
if (!shuffle) {
if (snum == 0){
snum = list.length;
}
snum--;
}
else {
var temp;
do{
temp = Math.floor(Math.random()* songs.length);
} while(temp == snum);
snum = temp;
}
list.options[snum].selected = true;
PlayPause(list);

// Discription: Self explanitory.
function Stop(){
Player.controls.Stop();
}
// Discription: Makes the shuffle flag the same as the status of the CheckBox
// The status of the checkbox (true/false) indicates if the box is checked
function ToggleShuffle(CheckBox) {
shuffle = CheckBox.status;
}
</SCRIPT>
<script ID="StateChangeHandler" Language = "JavaScript" For = "Player" Event = playStateChange(NewState) >
<br />
// Description: This is an interupt handler used to handle instances when the<br />
// state of the player changes to play or stop for example.
//STATE.innerText = NewState;<
<br />
switch(NewState){
case 8: // Handles player after it just finishes playing through a song
var num = document.forms['form'].playlist.selectedIndex;
<br />
if (!shuffle){
if(num == document.forms['form'].playlist.length-1){
num = -1;
}
num++;
}
else {
var temp;
do{
temp = Math.floor(Math.random()* songs.length);
} while(temp == num);
num = temp;
}
document.forms['form'].playlist.options[num].selected = true;
PreviousState = NewState;
break;
case 1: // Handles player after it stops
if(PreviousState == 8){
var num = document.forms['form'].playlist.selectedIndex;
Player.settings.autoStart = true;
Player.url = songs[num];
PreviousState = NewState;
}
else if (PreviousState != 3 && PreviousState != 2){
Player.controls.Play();
Player.settings.autoStart = false;
}
else{
forms['form'].PlayPauseButton.innerHTM L = PlayHTML.innerHTML;
}
break;
case 3: // Handles player after it starts to play
PreviousState = NewState;
forms['form'].PlayPauseButton.innerHTM L = "Pause";
shuffle = document.forms['form'].ShuffleSwitch.status;
break;
case 2: // Handles player after being paused
PreviousState = NewState;
forms['form'].PlayPauseButton.innerHTM L = PlayHTML.innerHTML;
break;

default:
}
</SCRIPT>
<!-- end code provided by createblog.com -->

DemolitionMan50
07-27-2005, 12:30 PM
You missed a few <br/ >

In addition, a few of your URL's were invalid. I fixed your code. It should work now.


<!-- begin code provided by createblog.com -->
<OBJECT ID="Player" height="0" width="0" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<PARAM NAME="uiMode" VALUE="invisible">
<PARAM NAME="Autostart" VALUE="True">
</object>
<FORM ID="form">
<SELECT ID="playlist" size="1">
<!-- Add song info that appears in drop down list here -->
<option value="0">Sitting, Waiting, Wishing - Jack Johnson</option>
<option value="1">Mr. Jones - Counting Crows</option>
<option value="2">Blues Traveler - Canadian Rose</option>
<option value="3">Oasis - Wonderwall</option>
<option value="4">Sympathy for the Devil - The Rolling Stones</option>
</SELECT>
<BR>
<BUTTON ID="BackButton" onClick="Back(forms['form'].playlist);">&nbsp;<<&nbsp;</BUTTON>
<BUTTON ID="PlayPauseButton" onClick="PlayPause(forms['form'].playlist);"><FONT color="green">&nbsp;&nbsp;Play&nbsp;&nbsp;</FONT></BUTTON>
<BUTTON ID="NextButton" onClick="Next(forms['form'].playlist);">&nbsp;>>&nbsp;</BUTTON>&nbsp;
<BUTTON ID="StopButton" onclick="Stop();"><FONT color="maroon">Stop</FONT></BUTTON>
<b><font size="3" color="black">Shuffle</font></b><INPUT TYPE=checkbox CHECKED ID="ShuffleSwitch" onclick="ToggleShuffle(this);" value="ON">
</FORM>
</CENTER>
<comment ID="PlayHTML"><FONT color="green">&nbsp;&nbsp;Play&nbsp;&nbsp;</FONT></comment>
<comment ID="ShuffleOnHTML"><INPUT TYPE=checkbox CHECKED ID="ShuffleSwitch" onclick="ToggleShuffle(this);"></comment>
<comment ID="ShuffleOffHTML"><INPUT TYPE=checkbox UNCHECKED ID="ShuffleSwitch" onclick="ToggleShuffle(this);"></comment>

<script ID="Main" Language="JavaScript">
var songs = new Array();
//************************* ******//
//****** CHANGEABLE STUFF *******//
//*************************
var shuffle = false; // false = shuffle off, true = shuffle on
var autoStart = true; // false = autoStart off, true = autoStart on
var numberTracks = true; // true = place track number in front of list items, false = no track numbers
// Add song URLs here (make sure it matches up with the order you have for song info, and urls need quotes):
songs[0]="http://a425.v8384d.c8384.g.vm.akamaistream.net/7/426/8384/3b858b51/mtvrdstr.download.akamai.com/8512/wmp/2/6224/30470_1_6_05.asf";
songs[1]="http://a425.v8384d.c8384.g.vm.akamaistream.net/7/426/8384/3b858b51/mtvrdstr.download.akamai.com/8512/wmp/0/19/48_1_3_05.asf";
songs[2]="http://harp.muse.pl/data/bt_rose.mp3";
songs[3]="http://a425.v8384d.c8384.g.vm.akamaistream.net/7/426/8384/3b858b51/mtvrdstr.download.akamai.com/8512/wmp/0/83/72_1_3_05.asf";
songs[4]="http://a425.v8384d.c8384.g.vm.akamaistream.net/7/426/8384/3b858b51/mtvrdstr.download.akamai.com/8512/wmp/4/99/6250_1_1_05.asf";
//************************* ******//
//************************* ******//
// Initializations //
with (document){
var length = forms['form'].playlist.length;
if(numberTracks){
for (var i = 0; i < length; i++){
forms['form'].playlist.options[i].innerHTML = (i+1) + " - " + forms['form'].playlist.options[i].innerHTML;
}
}
if (shuffle) {
var randsg = Math.floor(Math.random()* songs.length);
Player.url = songs[randsg];
forms['form'].playlist.options[randsg].selected = true;
forms['form'].ShuffleSwitch.outerHTML = ShuffleOnHTML.innerHTML;
}
else {
forms['form'].ShuffleSwitch.outerHTML = ShuffleOffHTML.innerHTML;
Player.url = songs[0];
}
if(autoStart){
var snum = forms['form'].playlist.selectedIndex;
if(Player.url != songs[snum]){
Player.url = songs[snum];
}
Player.controls.Play();
}
}
// Functions //
// Discription: "PlayPause" will toggle playing and pausing if the same song is still selected,
// otherwise it will load the newly selected song
function PlayPause(list) {
var snum = list.selectedIndex;
if((Player.url == songs[snum] && Player.url != "") && Player.playState != 1){
if(Player.playState == 3){
Player.controls.Pause();
}
else {
Player.controls.Play();
}
}
else {
Player.url = songs[snum];
Player.controls.Play();
}
}
// Discription: "Next" will move to the next music file if shuffle is off
// otherwise it will load a random song. Calls PlayPause to start music.
function Next(list) {
var snum = list.selectedIndex;
if (!shuffle) {
if (snum == list.length-1) {
snum = -1;
}
snum++;
}
else {
var temp;
do{
temp = Math.floor(Math.random()* songs.length);
} while(temp == snum);
snum = temp;
}
list.options[snum].selected = true;
PlayPause(list);
}
// Discription: "Back" does the same thing as "Next" but moves backwads
// through the list. If shuffle is on then picks a random song.
function Back(list) {
var snum = list.selectedIndex;
if (!shuffle) {
if (snum == 0){
snum = list.length;
}
snum--;
}
else {
var temp;
do{
temp = Math.floor(Math.random()* songs.length);
} while(temp == snum);
snum = temp;
}
list.options[snum].selected = true;
PlayPause(list);

// Discription: Self explanitory.
function Stop(){
Player.controls.Stop();
}
// Discription: Makes the shuffle flag the same as the status of the CheckBox
// The status of the checkbox (true/false) indicates if the box is checked
function ToggleShuffle(CheckBox) {
shuffle = CheckBox.status;
}
</SCRIPT>
<script ID="StateChangeHandler" Language = "JavaScript" For = "Player" Event = playStateChange(NewState) >
// Description: This is an interupt handler used to handle instances when the<br />
// state of the player changes to play or stop for example.
//STATE.innerText = NewState;<
switch(NewState){
case 8: // Handles player after it just finishes playing through a song
var num = document.forms['form'].playlist.selectedIndex;
if (!shuffle){
if(num == document.forms['form'].playlist.length-1){
num = -1;
}
num++;
}
else {
var temp;
do{
temp = Math.floor(Math.random()* songs.length);
} while(temp == num);
num = temp;
}
document.forms['form'].playlist.options[num].selected = true;
PreviousState = NewState;
break;
case 1: // Handles player after it stops
if(PreviousState == 8){
var num = document.forms['form'].playlist.selectedIndex;
Player.settings.autoStart = true;
Player.url = songs[num];
PreviousState = NewState;
}
else if (PreviousState != 3 && PreviousState != 2){
Player.controls.Play();
Player.settings.autoStart = false;
}
else{
forms['form'].PlayPauseButton.innerHTM L = PlayHTML.innerHTML;
}
break;
case 3: // Handles player after it starts to play
PreviousState = NewState;
forms['form'].PlayPauseButton.innerHTM L = "Pause";
shuffle = document.forms['form'].ShuffleSwitch.status;
break;
case 2: // Handles player after being paused
PreviousState = NewState;
forms['form'].PlayPauseButton.innerHTM L = PlayHTML.innerHTML;
break;

default:
}
</SCRIPT>
<!-- end code provided by createblog.com -->

The Sumo
07-27-2005, 04:11 PM
Does it work for you? I copied it exactaly and I'm still gettiong an error. Could it be that its in the same box as my web counter? Would that have anything to do with it?

DemolitionMan50
08-01-2005, 02:33 PM
I started over with a new code. I replaced some of your non-existent URL's at www.cdzinc.com (well, except for Oasis), but luckily, the code you provided did indeed work. When I posted your "corrected" code, I got rid of a few spaces and ; and apparently that messed it up big time. This code does work for me, I tried it on my tester xanga. Here you go!

<OBJECT ID="Player" height="0" width="0" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<PARAM NAME="uiMode" VALUE="invisible">
<PARAM NAME="Autostart" VALUE="False">
</object>
<FORM ID="form">
<SELECT ID="playlist" size="1">
<!-- Add song info that appears in drop down list here -->
<option value="0">Sitting, Waiting, Wishing - Jack Johnson</option>
<option value="1">Counting Crows - Mr. Jones</option>
<option value="2">Canadian Rose - Blues Traveler</option>
<option value="3">Wonderwall - Oasis</option>
<option value="4">Sympathy for the Devil - The Rolling Stones</option>
</SELECT>
<BR>
<BUTTON ID="BackButton" onClick="Back(forms['form'].playlist);"> << </BUTTON>
<BUTTON ID="PlayPauseButton" onClick="PlayPause(forms['form'].playlist);"><FONT color="green"> Play </FONT></BUTTON>
<BUTTON ID="NextButton" onClick="Next(forms['form'].playlist);"> >> </BUTTON>
<BUTTON ID="StopButton" onclick="Stop();"><FONT color="maroon">Stop</FONT></BUTTON>
<b><font size="3" color="black">Shuffle</font></b><INPUT TYPE=checkbox CHECKED ID="ShuffleSwitch" onclick="ToggleShuffle(this);" value="ON">
</FORM>
</CENTER>

<comment ID="PlayHTML"><FONT color="green"> Play </FONT></comment>
<comment ID="ShuffleOnHTML"><INPUT TYPE=checkbox CHECKED ID="ShuffleSwitch" onclick="ToggleShuffle(this);"></comment>
<comment ID="ShuffleOffHTML"><INPUT TYPE=checkbox UNCHECKED ID="ShuffleSwitch" onclick="ToggleShuffle(this);"></comment>

<script ID="Main" Language="JavaScript">
var songs = new Array();
//*******************************//
//****** CHANGEABLE STUFF *******//
//*******************************//

var shuffle = false; // false = shuffle off, true = shuffle on
var autoStart = true; // false = autoStart off, true = autoStart on

var numberTracks = true; // true = place track number in front of list items, false = no track numbers

// Add song URLs here (make sure it matches up with the order you have for song info, and urls need quotes):
songs[0]="http://a425.v8384d.c8384.g.vm.akamaistream.net/7/426/8384/3b858b51/mtvrdstr.download.akamai.com/8512/wmp/2/6224/30470_1_6_05.asf";
songs[1]="http://a425.v8384d.c8384.g.vm.akamaistream.net/7/426/8384/3b858b51/mtvrdstr.download.akamai.com/8512/wmp/0/19/48_1_3_05.asf";
songs[2]="http://harp.muse.pl/data/bt_rose.mp3";
songs[3]="http://a425.v8384d.c8384.g.vm.akamaistream.net/7/426/8384/3b858b51/mtvrdstr.download.akamai.com/8512/wmp/0/83/72_1_3_05.asf";
songs[4]="http://a425.v8384d.c8384.g.vm.akamaistream.net/7/426/8384/3b858b51/mtvrdstr.download.akamai.com/8512/wmp/4/99/6250_1_1_05.asf";

//*******************************//
//*******************************//
// Initializations //
with (document){
var length = forms['form'].playlist.length;
if(numberTracks){
for (var i = 0; i < length; i++){
forms['form'].playlist.options[i].innerHTML = (i+1) + " - " + forms['form'].playlist.options[i].innerHTML;
}
}

if (shuffle) {
var randsg = Math.floor(Math.random()*songs.length);
Player.url = songs[randsg];
forms['form'].playlist.options[randsg].selected = true;
forms['form'].ShuffleSwitch.outerHTML = ShuffleOnHTML.innerHTML;
}
else {
forms['form'].ShuffleSwitch.outerHTML = ShuffleOffHTML.innerHTML;
Player.url = songs[0];
}
if(autoStart){
var snum = forms['form'].playlist.selectedIndex;
if(Player.url != songs[snum]){
Player.url = songs[snum];
}
Player.controls.Play();
}
}
// Functions //
// Discription: "PlayPause" will toggle playing and pausing if the same song is still selected,
// otherwise it will load the newly selected song
function PlayPause(list) {
var snum = list.selectedIndex;

if((Player.url == songs[snum] && Player.url != "") && Player.playState != 1){
if(Player.playState == 3){
Player.controls.Pause();
}

else {
Player.controls.Play();
}
}
else {
Player.url = songs[snum];
Player.controls.Play();
}
}
// Discription: "Next" will move to the next music file if shuffle is off
// otherwise it will load a random song. Calls PlayPause to start music.
function Next(list) {
var snum = list.selectedIndex;
if (!shuffle) {
if (snum == list.length-1) {
snum = -1;
}
snum++;
}

else {
var temp;
do{
temp = Math.floor(Math.random()*songs.length);
} while(temp == snum);
snum = temp;
}

list.options[snum].selected = true;
PlayPause(list);
}
// Discription: "Back" does the same thing as "Next" but moves backwads
// through the list. If shuffle is on then picks a random song.
function Back(list) {
var snum = list.selectedIndex;
if (!shuffle) {
if (snum == 0){
snum = list.length;
}
snum--;
}

else {
var temp;
do{
temp = Math.floor(Math.random()*songs.length);
} while(temp == snum);
snum = temp;
}

list.options[snum].selected = true;
PlayPause(list);
}
// Discription: Self explanitory.
function Stop(){
Player.controls.Stop();
}
// Discription: Makes the shuffle flag the same as the status of the CheckBox
// The status of the checkbox (true/false) indicates if the box is checked
function ToggleShuffle(CheckBox) {
shuffle = CheckBox.status;
}
</SCRIPT>
<script ID="StateChangeHandler" Language = "JavaScript" For = "Player" Event = playStateChange(NewState)>
// Description: This is an interupt handler used to handle instances when the
// state of the player changes to play or stop for example.
//STATE.innerText = NewState;
switch(NewState){
case 8: // Handles player after it just finishes playing through a song
var num = document.forms['form'].playlist.selectedIndex;

if (!shuffle){
if(num == document.forms['form'].playlist.length-1){
num = -1;
}

num++;
}
else {
var temp;
do{
temp = Math.floor(Math.random()*songs.length);
} while(temp == num);
num = temp;
}

document.forms['form'].playlist.options[num].selected = true;

PreviousState = NewState;
break;
case 1: // Handles player after it stops
if(PreviousState == 8){
var num = document.forms['form'].playlist.selectedIndex;
Player.settings.autoStart = true;
Player.url = songs[num];
PreviousState = NewState;
}

else if (PreviousState != 3 && PreviousState != 2){
Player.controls.Play();
Player.settings.autoStart = false;
}

else{
forms['form'].PlayPauseButton.innerHTML = PlayHTML.innerHTML;
}
break;
case 3: // Handles player after it starts to play
PreviousState = NewState;
forms['form'].PlayPauseButton.innerHTML = "Pause";
shuffle = document.forms['form'].ShuffleSwitch.status;
break;
case 2: // Handles player after being paused
PreviousState = NewState;
forms['form'].PlayPauseButton.innerHTML = PlayHTML.innerHTML;
break;
default:
}
</SCRIPT>