Quote:
Originally Posted by kisersose
Does anyone Know how to add music on the homepage for instant somethin like..... www.yoursite.com and when visitors are there.. ders a backround music....? anyone know how to do dat? :ermm:
|
this is what i use on my root site page (its a 12 second redirect to the site main page)
this code will randomly play the tracks listed (dirArray{} = 'track.wav') and auto play apon page load and it will also play .wav or .mp3 files
on my site i have over 600 5 second to over 2min long tracks that will randomly play
PHP Code:
<?php
$dirArray = array();
$dirArray[] = 'track1.WAV';
$dirArray[] = 'track2.mp3';
$dirArray[] = 'track3.wav';
$cnt = count($dirArray);
$rand = rand(0,$cnt);
$dirFile = $dirArray[array_rand($dirArray)];
echo "<embed src=\"http://www.YOUSITE.com/LINK_TO_YOURMUSIC_DIRECTORY/$dirFile\" hidden=\"true\" autostart=\"true\">";
?>
dj_melayu/s code will only play one track...the one that is linked in the code
Music Test Page <-- this page is a test page i used to test the coding out a long time ago - keep refreshing and im sure you wont hear the same track more than twice
view in action at
http://dfmafia.net