PDA

View Full Version : random music



M3GGs
09-12-2004, 05:26 PM
i have my website so i can play music, one song. im trying to get it so it will play a different song everytime the page is loaded, or a set list of songs. however i would like the order to change everytime i refresh the page... i have not been able to accomplish this at all. if anyone can help, it would be greatly appreciated.

p.s. im using a javascript snippet that i found for this music, but i posted this here because there was other music stuff in the html post section. if you would like to move it, please do, i just didnt know where to post.


<script language="JavaScript"><!--
var soundFile = "http://webzoom.freewebs.com/ethix7664/jeremys****/music/Trogdor.mp3";if (soundFile.indexOf(",") > 0) {var sounds = soundFile.split(",");soundFile = sounds[Math.floor(Math.random()*sounds.length)];}if(navigator.plugins.length>0){
if (navigator.mimeTypes["audio/mp3"] && navigator.mimeTypes["audio/mp3"].enabledPlugin) document.write('<embed src="'+soundFile+'" autostart="true" loop="1" controls="SmallConsole" width=145 height=15></embed>');}
else {
document.write('<embed src="'+soundFile+'" autostart="true" loop="1" width=70 height=25></embed>');}

//-->
</script>
<noscript><embed src="http://webzoom.freewebs.com/ethix7664/jeremys****/music/Trogdor.mp3" autostart="true" loop="1"></embed></noscript>
<noembed><bgsound src="http://webzoom.freewebs.com/ethix7664/jeremys****/music/Trogdor.mp3" loop=1></noembed>
Thats what i have... that works fine. i would just like to add a few more songs to it, so i can play them randomly on refresh.

cr3ative
09-14-2004, 07:05 PM
I might be wrong, but I think replacing the .mid files should work for wave format:



<SCRIPT LANGUAGE="JavaScript">
<!-- Javascripts resource by Hypergurl!! http://www.hypergurl.com -->
<!-- hide script. Begin
nummidi = 3
day = new Date()
z = day.getTime()
y = (z - (parseInt(z/1000,10) * 1000))/10
x = parseInt(y/100*nummidi,10) + 1
if (x == (1))
midi=("mid1.mid")
if (x == (2))
midi=("mid2.mid")
if (x == (3))
midi=("mid3.mid")
document.write('<EMBED SRC= ' + midi + ' autostart=true loop=true ')
document.write('volume=100 align="center" width=50 height=15 controls=smallconsole>')
// End -->
</SCRIPT>


Care of hypergurl javascripts

Hope this helps
cr3ative

M3GGs
09-17-2004, 12:59 AM
thx cr3ative, i found a solution already, similar to yours, somewhat. haha, feel free to check it out, i modified the coding of most of it though, pretty sweet. at least i thought so. :) got it so it plays 3 random songs per day. a different band each day. ;) i enjoyed coding that one... fun stuff.

DJ-JO
11-06-2004, 02:04 PM
how does it work???? email me at ojn_bike246@hotmail.com :cool:

elvisfied
03-17-2005, 08:45 AM
Hi, I have a website Back 2 The 50s with Elvis http://www.elvis-tcb.com/

Recently I have had to remove the Dynamic Drive script for embed and no embed that I have used with no problems for 2 years.

I received emails from viewers that had new Compaq XP's that the embedded music locked up their computer and they had to shut down. Temporarily I have replaced with <BGSOUND src=SONG loop=infinite> but it is so slow starting the song.

Is there a script that would allow <embed> music but detect if the computer was Compaq XP and switch them to <bgsound>
Thanks for any help,
John

Teo1
06-11-2007, 07:56 PM
Hi,

Did you get the random list solved? I'll help if you still haven't. Let me know.

Peace,

of music... :rolleyes:

hreyes
10-07-2008, 02:51 AM
Can someone tell me how to play ONE song in the background continuously throughout each web page?