Help me pls

kinxlord

Registered Member
Joined
Nov 18, 2010
Messages
89
Reaction score
37
Hi guys. It's nearly 3 a.m. here and I feel kinda tired but I want to finish my project today.
So I'm coding a mp3 listining script. It's simple one. Mp3's are fetched from file. First I used this :
PHP:
//if not in ignore list create a link       if(!in_array($curfile, $ignore)) {           echo "<li><a href='?file=".$curfile."'>$curfile</a></li>\n ";       }   }  


   //if file selected   if(isset($_GET['file'])){
    //get selected file    $file = $_GET['file'];

But thn I don't want user to click and start playing the song because there will be alot of mp3s. So What I want to do shuffle player. Whenever user refresh the page random song starts from the file and when song is finished another random song starts. I hope I could explain it. I'm still working on it, I know I'm doing something wrong. Someone can help me ?

PHP:
<?php   //set folder to read from   $dirname = "music/";
   //read files in folder   $files = scandir($dirname);   shuffle($files);   //ignore hidden files   $ignore = Array(".", "..");
   //loop through all files   foreach($files as $curfile){
         }  


   //if file selected   if(isset($_GET['file'])){
    //get selected file    $file = $_GET['file'];
    //player pass in the path to the file    echo '		<div class="player">					<audio id="player" src="'.$dirname.$file.'" type="audio/mp3" autoplay="1"></audio>				</div>';
    }
 
that is something you need to configure in the player... where is the code for player list?
 
that is something you need to configure in the player... where is the code for player list?
I don't think that all of them can be configured from player, btw I made html5 player using mediaelementjs. com.
Edit

Using mysql and I did it. Thanks .
 
Last edited:
If you want something that doesn't easily make the URL known (or even to have an encrypted stream), you're going to have to go with a flash-based player like:
http://www.longtailvideo.com/players/jw-flv-player/
There are ways to obfuscate the URL to make the MP3 slightly more difficult to find, but ultimately, even with encrypted streams, there are tools out there to grab and save the data as it streams.
 
Back
Top