Okay, technically, random song whenever the page is loaded, but it adds a nice effect to websites.
While not a new concept by any means, this code will let one add music to their forum.
Activate the Site Builder
Add a Static HTML Module
Edit the module
Add this code.
The vb conditional code ensures that the player only appears to registered users logged into the forum.
You can build your list as long as you like, you just have to make a few adjustments.
/Media_Server/Song_of_the_Day/ sets the location of your mp3 files.
The variables set the name of the mp3's. Don't use spaces or special characters.
You will also have to add more X= values. Note that the X value uses zero.
Also, if you do not want the music to start on load, then change autoplay="" to autoplay="false"
Save and reload.
The player will look slightly different in various browsers.
This is how it appears in Firefox.
While not a new concept by any means, this code will let one add music to their forum.
Activate the Site Builder
Add a Static HTML Module
Edit the module
Add this code.
The vb conditional code ensures that the player only appears to registered users logged into the forum.
You can build your list as long as you like, you just have to make a few adjustments.
/Media_Server/Song_of_the_Day/ sets the location of your mp3 files.
The variables set the name of the mp3's. Don't use spaces or special characters.
You will also have to add more X= values. Note that the X value uses zero.
Also, if you do not want the music to start on load, then change autoplay="" to autoplay="false"
Code:
<!-- Start Background Music Player --> [COLOR=#FF0000]<vb:if condition="is_member_of($user, 2)">[/COLOR] <center> <script> <!-- [COLOR=#00FF00]var sound1="Brazil.mp3" var sound2="Big_Balls.mp3" var sound3="Night_Life.mp3" var sound4="Kiss.mp3" var sound5="Futures.mp3"[/COLOR] var x=Math.round(Math.random()*4) if ([B]x=[/B]=0) x=sound1 else if (x==1) x=sound2 else if (x==2) x=sound3 else if (x==3) x=sound4 else [B]x=[/B]sound5 document.write('<audio [B]autoplay=""[/B] controls="" preload=""><source src='+'"[COLOR=#0000CD]/Media_Server/Song_of_the_Day/[/COLOR]'+x+'"'+'type="audio/mpeg"></audio>') //--> </script> </center> [COLOR=#FF0000] </vb:if>[/COLOR] <!-- End Background Music Player -->
Save and reload.
The player will look slightly different in various browsers.
This is how it appears in Firefox.
Comment