| | |
Music player code in php
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Well if you are looking for a music player, how can the server play music on the clients computer. Sounds weird trying to get the server to play the music for the client and expect the client to be able to listen to the music. So your best options would be Flash and/or Java. Flash and Java are both client side languages meaning the will load on the users computer and not on the server (I am sure you want to music to load/play on the users computer and not on the server). Then perhaps php can tell Java or Flash where to download the file from. The only other option which I wouldn't recommend is a mixture of Javascript and html. But using Javascript and html it wouldn't look as great as Java or Flash and Javascript is widely disabled.
So those are the options but php itself can't play the music for the client. And after you have chosen one, I would suggest a google search on some client side web scripting tutorials and compilers (if using Java or Flash). Although it may not have been the answer that you wanted I hope it helps solve the problem.
So those are the options but php itself can't play the music for the client. And after you have chosen one, I would suggest a google search on some client side web scripting tutorials and compilers (if using Java or Flash). Although it may not have been the answer that you wanted I hope it helps solve the problem.
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
My favourite PC. - Oopy Doopy Do 2U2!
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - Oopy Doopy Do 2U2!
This works
Drop the file as index.php in a folder of mp3 or wma files and it produces a sorted list of filenames that click toplay
It only understands wmv wma asf mp3
just one of many possibilities.
There are 'utube', flash player scripts for download, complete setups, Google search
Drop the file as index.php in a folder of mp3 or wma files and it produces a sorted list of filenames that click toplay
php Syntax (Toggle Plain Text)
<?php ob_start("ob_gzhandler"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/TR/REC-html40"> <head> <LINK REL="stylesheet" TYPE="text/css" MEDIA="all" HREF="../style.css.php"> <script LANGUAGE="javascript" TYPE="text/javascript" SRC="../script.js.php"></script> <script type="text/javascript"> <!--// function shrink(){ document.getElementById("MediaPlayer1").style.width=384; document.getElementById("MediaPlayer1").style.height=300; } function enLarge(){ document.getElementById("MediaPlayer1").style.width=480; document.getElementById("MediaPlayer1").style.height=402; } //--> </script> <title></title> </head><body><a name='top'></a><H3><center>Videos</center></h3> <p class='logo'> <button onclick="enLarge()">large</button> <button onclick="shrink()">small</button> <a href='..'>Main Menu</a> <A HREF="http://www.microsoft.com/windows/windowsmedia/player/download/"><IMG ALT="Get Windows Media Player" SRC="http://www.microsoft.com/windows/windowsmedia/images/logos/getwm/mp11_88x31_static.gif" WIDTH="88" HEIGHT="31" BORDER="0"></A><br> <OBJECT ID="MediaPlayer1" width=384 height=300 classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> <PARAM NAME="fileName" VALUE=""> <PARAM NAME="showControls" VALUE="true"> <PARAM NAME="PlayCount" VALUE="0"> <PARAM NAME="animationatStart" VALUE="true"> <PARAM NAME="transparentatStart" VALUE="true"> <PARAM NAME="autoStart" VALUE="true"> <EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" SRC="" name="MediaPlayer1" width=360 height=260 AutoStart=true></EMBED></object></p> <div style='float:left; text-align:left;'> <?php $p = split('/', $_SERVER['SCRIPT_FILENAME']); $script_name = $p[count($p)-1]; $path = str_replace($script_name, '', $_SERVER['SCRIPT_FILENAME']); $dir_handle = @opendir($path) or die("Unable to open $path"); Function get_Extension($m_FileName){ $path_parts = pathinfo($m_FileName); if ($path_parts["extension"]) { $m_Extension = strtolower($path_parts["extension"]); return(strtoupper($m_Extension)); } else { return "unknown"; } } function check_image($filename){ $temp=strtoupper(get_Extension($filename)); if(($temp=="MP3")||($temp=="WMA")||($temp=="WMV")||($temp=="ASF")) return (true); else return (false); } Function get_Files($path) { if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if(!is_dir($file) && substr($file,O,1) != "."){ $m_Files[]=$file; } } closedir($handle); } if(sizeof($m_Files)>1) asort($m_Files); return $m_Files; } $files=get_Files($path); $filter_files=array_filter($files,"check_image"); $maxnr=sizeof($filter_files)-1; sort($filter_files); for ($i=0;$i<sizeof($filter_files);$i++){ echo "<a class='button' onclick=\"MediaPlayer1.SRC='$filter_files[$i]';MediaPlayer1.fileName='$filter_files[$i]';\">"; echo substr($filter_files[$i], 0, strlen($filter_files[$i])-4); echo "</a><br>"; } closedir($dir_handle); ?></table> </body></html> <?php ob_flush(); ?>
just one of many possibilities.
There are 'utube', flash player scripts for download, complete setups, Google search
Last edited by almostbob; Feb 13th, 2009 at 6:50 am. Reason: had my name in it :{(
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Similar Threads
- I need a great web designer and proffesional PHP Coder ~ 10k project (Web Development Job Offers)
- Established pr 4 social network for sale (Websites for Sale)
- how to delete extra commas on csv file with php (PHP)
Other Threads in the PHP Forum
- Previous Thread: Annoying PHP problem & Image Displaying
- Next Thread: How we can show total time in time as a total time
| Thread Tools | Search this Thread |
Tag cloud for PHP
# .htaccess 5.2.10 access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display dissertation download dynamic echo email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link login loop mail menu mlm mod_rewrite multiple mysql mysqlquery oop open parse paypal pdf persist php problem query radio random recursion regex remote script search server sessions sms soap sockets source space sql structure syntax system table tutorial update upload url validation validator variable video web xml youtube






