Simple PHP Mp3 Player

topdog

Verified User
Joined
Jun 22, 2009
Messages
135
Hi there,
I have a simple question which isn't related to Directadmin, which is the reason it's posted here.
I want to create a simple PHP script which will play a random number of MP3 files, the numbers can be changed as an example: have the script play 1 to 4 mp3's, etc.
The script will read information about the selected playing file from a text file stored on the server with the MP3 or Mp3's, and the script should display on the site, the information stored in the text file for the specific MP3 or mp3's being played
For instance: If I play a file called test,mp3, the script should also open a file called test.txt. The test.txt will have information such as artist, albam, time, etc for the test.mp3 file. This information in test.txt should be displayed on the page that the script is included on, while test.mp3 is being played, and once it's over, close the test.txt file. When test1.mp3 plays, open test1.txt and test1.mp3's information should replace test.mp3's information with test1.mp3's info on the site.
Is this setup possible? And if so, would someone be willing to either create a simple script? or give an example script for me to modify?
If I read the PHP manual correct, I know that there is the rand function which should allow me to do something like, as an example:
PHP:
rand(1-4)
Which will tell PHP to play up to 4 MP3 files at a time. It's quite possible that's the right function, from what I saw, but as I'm rusty at PHP after not using it for a while, I forget.
I appreciate any help that can be provided.
P.S.: I failed to mention, the MP3's and text files will be in a specific directory and thus the script should have a directory variable to read from.
 
Last edited:
What has PHP in common with mp3-player? PHP can not be used for writing a mp3-player, you can built a playlist or whatever you like, it can read mp3 file (including TAGs ID3v1) or use it as a source link:

http://domain.com/mp3-source.php

to add in WinAMP (for example), or any other player.

Anyway you'd better Google, as there should be ready-made scripts for the purpose.

p.s. of course if you want my assistance, feel free to contact me, but in most cases it would cost you some money.
 
Back
Top