View Full Version : Putting a play/stop music button thing on your xanga


rockmachickenzz
07-18-2004, 06:04 PM
Sorry I do not have any examples, but I'm pretty sure you know what I mean. How do you do that? (if you can)

oincubusx
07-19-2004, 09:04 AM
a windows media player thingy like it says PLAY PAUSE STOP? well if thats what you mean.... here it is:

<object id="darkplayer" codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" height="0" standby="Loading Microsoft Windows Media Player components..." width="0" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95">
<param NAME VALUE>
<param NAME="ShowControls" VALUE="0">
<param NAME="ShowStatusBar" VALUE="0">
<param NAME="ShowDisplay" VALUE="0">
<param NAME="DefaultFrame" VALUE="Slide">
<param NAME="Autostart" VALUE="1">
<param NAME="Loop" VALUE="True">
</object>
<form name="form">

<p style="text-align: center">
<select style="FONT-SIZE: 8pt; BACKGROUND:#000000; WIDTH: 150px; COLOR: #FFFFFF; font-face: arial" name="playlist" size="1">
<option value="0">TITLE FOR FIRST SONG...</option>
<option value="1">song 1 title</option>
<option value="2">song 2 title</option>
<option value="3">song 3 title</option>
<option value="4">song 4 title</option>
<option value="5">song 5 title</option>
<option value="6">song 6 title</option>
<option value="7">song 7 title</option>
<option value="8">song 8 title</option>
<option value="9">song 9 title</option>




</select><br>
<input TYPE="BUTTON" NAME="PLAY" VALUE="play" OnClick="play(document.forms['form'].playlist);">
<input TYPE="BUTTON" NAME="PAUSE" VALUE="pause" OnClick="document.darkplayer.Pause(); playstate=2;">
<input TYPE="BUTTON" NAME="STOP" VALUE="stop" OnClick="document.darkplayer.Stop(); playstate=2;"></p>
</form>
<script language="JavaScript">
<!--
var playstate = 1;
shuffle = 1; // set to 0 to always play first song in list
// set to 1 to randomly choose the first song to play
songs=new Array();
songs[0]="URL HERE FOR FIRST SONG THAT PLAYS";
songs[1]="URL HERE FOR SONG 1";
songs[2]="URL HERE FOR SONG 2";
songs[3]="URL HERE FOR SONG 3";
songs[4]="URL HERE FOR SONG 4";
songs[5]="URL HERE FOR SONG 5";
songs[6]="URL HERE FOR SONG 6";
songs[7]="URL HERE FOR SONG 7";
songs[8]="URL HERE FOR SONG 8";
songs[9]="URL HERE FOR SONG 9";

if (shuffle == 1) {
var randsg = Math.floor(Math.random()*songs.length);
document.darkplayer.FileName = songs[randsg];
document.darkplayer.scr = songs[randsg];
document.forms['form'].playlist.options[randsg].selected = true;
}
function play(list) {
if (playstate == 2) {
document.darkplayer.Play();
} else {
var snum = list.options[list.selectedIndex].value
document.darkplayer.FileName = songs[snum];
document.darkplayer.scr = songs[snum];
}
playstate = 1;
}
//-->
</script>

-->edit: if that dont work tell me

Deone
07-19-2004, 04:18 PM
Hey how do you make that script play random songs without refreshing the page? Thanks.

rockmachickenzz
07-19-2004, 08:22 PM
Thanks, yes that is exactly what I meant!

rockmachickenzz
07-19-2004, 08:46 PM
Thanks, yes that is exactly what I meant!
By the way, It worked GREAT!

Monkey Bizzle
07-19-2004, 11:22 PM
finally somebody got it right!!! i posted that same code here a few days ago and like 3 people imed me telling me it didn't work... i mean, how hard is it to copy, and paste... good job!

taofang
07-21-2004, 07:01 PM
The script works great! Is it possible to have it auto-play the 1st song? I mean like when the page loads up, it'll auto-start playing the song, and doesn't require the view to click on play? Thanks in advance! =)

Monkey Bizzle
07-21-2004, 07:53 PM
i thought it already did that...see this part of the code...

var playstate = 1;
shuffle = 1; // set to 0 to always play first song in list
// set to 1 to randomly choose the first song to play

taofang
07-21-2004, 10:25 PM
I have that in the code, but the music will only play when the viewer clicks on play. I was hoping it would auto-play when the page loads. Thanks again for taking the time to help me. =)

Monkey Bizzle
07-21-2004, 10:58 PM
hrmm... very puzzling...

mitsukai212
07-26-2004, 05:03 PM
Hey, How's it Goin? OK... the source code works AWSOME Thank you you VERY much for being kind enough to take the time to post valueble things like that!. But I do have a small problem with the code. When I type in the code, the player appears on the site and all is good! But as soon as the code recognizes that there is a song URL, it automatically plays it on site load-up and will not allow the user to STOP. if user tries to play a differnt song, they double over! how do I fix this? (I have not changed ANY other elements of the source code except for the song name and URL)

mitsukai212
07-26-2004, 06:24 PM
lol, guess I spoke to soon... I figured it out.
Chatter box has a predetermined script linking to whatever song you previously had in the music link under Look and Feel I had to go down to the script and search for anything pertaining to the link to that specific song. It was Identified with in tags <embed> </noembed>

Hopefully this helps some of you guys out.
Maybe, maybe not.
But now that I did fix that... I am having trouble with that whole "the song won't load automatically on site start-up". So, I'll look into that. but I'll keep checking in here as well!

XxZen_StoicxX
07-26-2004, 11:41 PM
finally somebody got it right!!! i posted that same code here a few days ago and like 3 people imed me telling me it didn't work... i mean, how hard is it to copy, and paste... good job!
heh...no offense but i'm pretty sure i copied and pasted (ctrl+c then ctrl+v) correctly...but then it ended up not working and i had to look up "darkplayer" on the internet. so for some xangas like mine...the code may not work...at least, that's what i'm thinking

JiNgLeBeLLz77
07-27-2004, 05:06 AM
the code does work... end of story!