Jump to content

[SOLVED] Loop and Randomize playlist help


Waifthe3rd

Recommended Posts

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>

Link to comment
Share on other sites

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....

Link to comment
Share on other sites

<?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

Link to comment
Share on other sites

<?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

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

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?

Link to comment
Share on other sites

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 ,,,

Link to comment
Share on other sites

<?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

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

<?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

Link to comment
Share on other sites

<?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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.