Waifthe3rd Posted November 16, 2007 Share Posted November 16, 2007 Hi all here's what im stuck on. i got the WMP embedded, and have it playing a random song at the get go. but once the song is done it keeps looping the same song in IE, but stops in FF. was wonding if there was a way to fix this, and add the loop funtion in my php so it plays all my songs, randomly and loops them. ************PHP*********** <?php $url[0] = "http://www.example.com/music/example1.mp3"; $url[1] = "http://www.example.com/music/example2.mp3"; $url[2] = "http://www.example.com/music/example3.mp3"; $url[3] = "http://www.example.com/music/example4.mp3"; srand ((double)microtime()*1000000); $randomnum = rand(0, count($url)-1); header ("Location: $url[$randomnum]"); ?> **********************HTML****************** <OBJECT ID="embedded_player" height="45" width="180" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" VIEWASTEXT> <PARAM name="FileName" value="http://example.com/music/example.php" /> <param name="AutoStart" value="True"> <param name="ShowStatusBar" value="False"> <param name="ShowPositionControls" value="0"> <param name="Loop" value="True"> <embed name="wmplayer" TYPE="application/x-mplayer2" pluginspace="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&" FileName="http://example.com/music/example.php" Width="180" Height="45" ShowPositionControls="0" ShowStatusBar = "False" Loop="True" </embed> </OBJECT> Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/ Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 what ever loop, randomization you made it will still play the same song because once the song is finish there is no script that tell your page to load the next song if you can determine the playing time of each song that would be better or set the time in your header file or meta tags so after a given time the page will reload and run the script you made which is randomizing ect.... Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392511 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 Im sorry im a bit new to everything i got the php script from a friend, and the WMP for a website source. not sure what to do from here, um i can find out how long each song is but where i put that at? The total of 1 song is 6:59 Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392514 Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 try to integrate this code $songs = array('song1','song2','song3','song4','song5'); $title= $songs[array_rand($songs,1)]; header('Refresh: 359; url=http://www.example.com/music/'.$songs.'.mp3'); Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392524 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 <?php $url[0] = "http://www.digitalcyberpunk.com/music/Jumping.mp3"; $url[1] = "http://www.digitalcyberpunk.com/music/Fortunato2.mp3"; $url[2] = "http://www.digitalcyberpunk.com/music/ArtofNoise.mp3"; $url[3] = "http://www.digitalcyberpunk.com/music/OceanTrance.mp3"; $songs = array('Jumping.mp3','Fortunato2.mp3','ArtofNoise.mp3','OceanTrance.mp3'); $title= $songs[array_rand($songs,1)]; srand ((double)microtime()*1000000); $randomnum = rand(0, count($url)-1); header('Refresh: 359; url=http://www.digitalcyberpunk.com/music/'.$songs.'.mp3'); ?> This is what i got, and nothing cant even play, I took out all the $url[ ] and nothing still cant even play Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392530 Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 <?php $songs = array('Jumping.mp3','Fortunato2.mp3','ArtofNoise.mp3','OceanTrance.mp3');//add here the title of the song $title= $songs[array_rand($songs,1)]; header('Refresh: 10; url=testing_ko.php'); ?> <OBJECT ID="embedded_player" height="45" width="180" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" VIEWASTEXT> <PARAM name="FileName" value="http://www.digitalcyberpunk.com/music/Jumping.mp3" /> <param name="AutoStart" value="True"> <param name="ShowStatusBar" value="False"> <param name="ShowPositionControls" value="0"> <param name="Loop" value="True"> <embed name="wmplayer" TYPE="application/x-mplayer2" pluginspace="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&" FileName="http://www.digitalcyberpunk.com/music/<?=$title?>" Width="180" Height="45" ShowPositionControls="0" ShowStatusBar = "False" Loop="True" </embed> </OBJECT> i test that and it works.. just edit the time top refresh i put 10 means 10 seconds put there what you want Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392540 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 hmm in FF it wont work, in IE it plays Jumping.mp3 over and over again? <?php $songs = array('Jumping.mp3','Fortunato2.mp3','ArtofNoise.mp3','OceanTrance.mp3');//add here the title of the song $title= $songs[array_rand($songs,1)]; header('Refresh: 10; url=http://www.digitalcyberpunk.com/music/random.php'); ?> <OBJECT ID="embedded_player" height="45" width="180" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" VIEWASTEXT> <PARAM name="FileName" value="http://www.digitalcyberpunk.com/music/Jumping.mp3" /> <param name="AutoStart" value="True"> <param name="ShowStatusBar" value="False"> <param name="ShowPositionControls" value="0"> <param name="Loop" value="True"> <embed name="wmplayer" TYPE="application/x-mplayer2" pluginspace="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&" FileName="http://www.digitalcyberpunk.com/music/<?=$title?>" Width="180" Height="45" ShowPositionControls="0" ShowStatusBar = "False" Loop="True" </embed> </OBJECT> Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392547 Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 it works fine on me i run it in FF in IE it plays Jumping.mp3 over and over again? that should happen because i put after 10 seconds it will play another song but you cant be sure that it will play another song we use random so theres a possibility of playing the same song <?php $songs = array('Jumping.mp3','Fortunato2.mp3','ArtofNoise.mp3','OceanTrance.mp3');//add here the title of the song $title= $songs[array_rand($songs,1)]; header('Refresh:389; url=http://www.digitalcyberpunk.com/music/random.php');//play within 389 sec ?> <OBJECT ID="embedded_player" height="45" width="180" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" VIEWASTEXT> <PARAM name="FileName" value="http://www.digitalcyberpunk.com/music/Jumping.mp3" /> <param name="AutoStart" value="True"> <param name="ShowStatusBar" value="False"> <param name="ShowPositionControls" value="0"> <param name="Loop" value="True"> <embed name="wmplayer" TYPE="application/x-mplayer2" pluginspace="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&" FileName="http://www.digitalcyberpunk.com/music/<?=$title?>" Width="180" Height="45" ShowPositionControls="0" ShowStatusBar = "False" Loop="True" </embed> </OBJECT> you can do some stuff to avoid the song from repeating but i guess its not right to do all the that hehe try to do it then if theres a prob let us know Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392550 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 dude man idk what u voodoo magic you got lol cause its still playing jumping.mp3 over and over in IE, and it wont let me press the play button in FF. Maybe the world just hates me today P.S. ive tried it with a 3 second refresh and still nothing bro. same thing as before oh oh does it matter that that the mp3s and the php file are in the music folder and the music player is on the index.html file being the root directory? Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392555 Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 like i said you cant be sure what your script will play because it random order.. it is possible that your script will play 10 consecutive jumping.mp3 it randomize so we dont know whats next.. but you can add some script to avoid this using session and some if condition ,,, Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392564 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 no dude if i replace <PARAM name="FileName" value="http://www.digitalcyberpunk.com/music/Jumping.mp3> and put Fortunato2.mp3 its plays that continuously. if i put random.php it dont work. Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392572 Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 <?php $songs = array('Jumping.mp3','Fortunato2.mp3','ArtofNoise.mp3','OceanTrance.mp3');//add here the title of the song $title= $songs[array_rand($songs,1)]; header('Refresh:389; url=http://www.digitalcyberpunk.com/music/random.php');//play within 389 sec ?> <OBJECT ID="embedded_player" height="45" width="180" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" VIEWASTEXT> <PARAM name="FileName" value="http://www.digitalcyberpunk.com/music/<?=$title?>" /> <param name="AutoStart" value="True"> <param name="ShowStatusBar" value="False"> <param name="ShowPositionControls" value="0"> <param name="Loop" value="True"> <embed name="wmplayer" TYPE="application/x-mplayer2" pluginspace="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&" FileName="http://www.digitalcyberpunk.com/music/<?=$title?>" Width="180" Height="45" ShowPositionControls="0" ShowStatusBar = "False" Loop="True" </embed> </OBJECT> sorry try that theres is a little changes any ways http://www.digitalcyberpunk.com/music/ <-- location of your mp3s <?=$title?> <--the randomize title of the song so whne the script run that could be http://www.digitalcyberpunk.com/music/jumping.mp3 the variable $tile is now jumping.mp3 so will have the ^^url Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392575 Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 i guess this is solved and the music ? what are this dont you have real music so can play that on my pc hehe Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392576 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 OOOH BURN ON ME hahah well the 3 i like, and Jumping.mp3 i created. Idk i perfer tranceish lounge. Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392577 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 yeah i noticed u put title up there but i tried that too and idk if you got some pluggins thats making it work or what i got 3 comps. and its not working on any of them bro. <?php $songs = array('Jumping.mp3','Fortunato2.mp3','ArtofNoise.mp3','OceanTrance.mp3');//add here the title of the song $title= $songs[array_rand($songs,1)]; header('Refresh:389; url=http://www.digitalcyberpunk.com/music/random.php');//play within 389 sec ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>DCP WAIF</title> <style type="text/css"> <!-- body { background-color: #000000; } --> </style> </head> <body> <OBJECT ID="embedded_player" height="45" width="180" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" VIEWASTEXT> <PARAM name="FileName" value="http://www.digitalcyberpunk.com/music/<?=$title?>" /> <param name="AutoStart" value="True"> <param name="ShowStatusBar" value="False"> <param name="ShowPositionControls" value="0"> <param name="Loop" value="True"> <embed name="wmplayer" TYPE="application/x-mplayer2" pluginspace="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&" FileName="http://www.digitalcyberpunk.com/music/<?=$title?>" Width="180" Height="45" ShowPositionControls="0" ShowStatusBar = "False" Loop="True" </embed> </OBJECT> <div align="center"> <table width=" "> <tr> <td><img src="images/n.jpg" width="801" height="605" /></td> </tr> </table> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392580 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 THERE THATS MY WHOLE INDEX idk if its the css messing it up or the meta maybe? Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392584 Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 <?php $songs = array('Jumping.mp3','Fortunato2.mp3','ArtofNoise.mp3','OceanTrance.mp3');//add here the title of the song $title= $songs[array_rand($songs,1)]; header('Refresh:389; url=random.php');//play within 389 sec ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>DCP WAIF</title> <style type="text/css"> <!-- body { background-color: #000000; } --> </style> </head> <body> <OBJECT ID="embedded_player" height="45" width="180" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" VIEWASTEXT> <PARAM name="FileName" value="http://www.digitalcyberpunk.com/music/<?=$title?>" /> <param name="AutoStart" value="True"> <param name="ShowStatusBar" value="False"> <param name="ShowPositionControls" value="0"> <param name="Loop" value="True"> <embed name="wmplayer" TYPE="application/x-mplayer2" pluginspace="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&" FileName="http://www.digitalcyberpunk.com/music/<?=$title?>" Width="180" Height="45" ShowPositionControls="0" ShowStatusBar = "False" Loop="True" </embed> </OBJECT> <div align="center"> <table width=" "> <tr> <td><img src="images/n.jpg" width="801" height="605" /></td> </tr> </table> </div> </body> </html> hope this help Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392589 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 nothin its working on urs?? and ur using FF i havent got it to work on FF yet, just been able to test it on IE Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392594 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392612 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 Can someone help me plz this is becomeing a real headache??? Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392623 Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 <?php $songs = array('Jumping.mp3','Fortunato2.mp3','ArtofNoise.mp3','OceanTrance.mp3');//add here the title of the song $title= $songs[array_rand($songs,1)]; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="refresh" content="3" /> <title>DCP WAIF</title> <style type="text/css"> <!-- body { background-color: #000000; } --> </style> </head> <body> <OBJECT ID="embedded_player" height="45" width="180" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" VIEWASTEXT> <PARAM name="FileName" value="http://www.digitalcyberpunk.com/music/<?=$title?>" /> <param name="AutoStart" value="True"> <param name="ShowStatusBar" value="False"> <param name="ShowPositionControls" value="0"> <param name="Loop" value="True"> <embed name="wmplayer" TYPE="application/x-mplayer2" pluginspace="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&" FileName="http://www.digitalcyberpunk.com/music/<?=$title?>" Width="180" Height="45" ShowPositionControls="0" ShowStatusBar = "False" Loop="True" </embed> </OBJECT> <div align="center"> <table width=" "> <tr> <td><img src="images/n.jpg" width="801" height="605" /></td> </tr> </table> </div> </body> </html> try 3 seconds then it loads hmm that works in FF and IE Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392636 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 yeah dude idk why its working on urs go to www.digitalcyberpunk.com and see if it works cause all its doing on mine is click click click every 3 seconds Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392638 Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 i think you save your file as .html thats why the phpscript is not running Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392640 Share on other sites More sharing options...
Waifthe3rd Posted November 16, 2007 Author Share Posted November 16, 2007 so what u want me to save my index as? Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392641 Share on other sites More sharing options...
teng84 Posted November 16, 2007 Share Posted November 16, 2007 since you have php script there save it as index.php thats is why when you view the source the page is the title of the song is not right note: <meta http-equiv="refresh" content="3" /> 3 is the seconds before it reloads Quote Link to comment https://forums.phpfreaks.com/topic/77544-solved-loop-and-randomize-playlist-help/#findComment-392642 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.