943,840 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 19608
  • PHP RSS
Feb 13th, 2009
0

Music player code in php

Expand Post »
hi
i m very interested to make a online music website, so i need Music player code in php. please help me.

thanks in advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Narayan15 is offline Offline
20 posts
since Nov 2008
Feb 13th, 2009
0

Re: Music player code in php

Click to Expand / Collapse  Quote originally posted by Narayan15 ...
...
so i need Music player code in php.
...
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.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Feb 13th, 2009
0

Re: Music player code in php

Thank you for your reply. Yes, u r right, i want to play music on clients computers. But i don't know how to write music player code in java. How to connect Java to PHP. I tried a lot in google, but i couldn't get required code. Please help me.

Thank u in advance
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Narayan15 is offline Offline
20 posts
since Nov 2008
Feb 13th, 2009
0

Re: Music player code in php

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
php Syntax (Toggle Plain Text)
  1. <?php ob_start("ob_gzhandler"); ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <html xmlns="http://www.w3.org/TR/REC-html40">
  4. <head>
  5. <LINK REL="stylesheet" TYPE="text/css" MEDIA="all" HREF="../style.css.php">
  6. <script LANGUAGE="javascript" TYPE="text/javascript" SRC="../script.js.php"></script>
  7. <script type="text/javascript">
  8. <!--//
  9. function shrink(){
  10. document.getElementById("MediaPlayer1").style.width=384;
  11. document.getElementById("MediaPlayer1").style.height=300;
  12. }
  13. function enLarge(){
  14. document.getElementById("MediaPlayer1").style.width=480;
  15. document.getElementById("MediaPlayer1").style.height=402;
  16. }
  17. //-->
  18. </script>
  19. <title></title>
  20. </head><body><a name='top'></a><H3><center>Videos</center></h3>
  21. <p class='logo'>
  22. <button onclick="enLarge()">large</button>
  23. <button onclick="shrink()">small</button>
  24. <a href='..'>Main Menu</a>
  25. <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>
  26. <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">
  27. <PARAM NAME="fileName" VALUE="">
  28. <PARAM NAME="showControls" VALUE="true">
  29. <PARAM NAME="PlayCount" VALUE="0">
  30. <PARAM NAME="animationatStart" VALUE="true">
  31. <PARAM NAME="transparentatStart" VALUE="true">
  32. <PARAM NAME="autoStart" VALUE="true">
  33. <EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" SRC="" name="MediaPlayer1" width=360 height=260 AutoStart=true></EMBED></object></p>
  34. <div style='float:left; text-align:left;'>
  35. <?php $p = split('/', $_SERVER['SCRIPT_FILENAME']);
  36. $script_name = $p[count($p)-1];
  37. $path = str_replace($script_name, '', $_SERVER['SCRIPT_FILENAME']);
  38. $dir_handle = @opendir($path) or die("Unable to open $path");
  39. Function get_Extension($m_FileName){
  40. $path_parts = pathinfo($m_FileName);
  41. if ($path_parts["extension"]) {
  42. $m_Extension = strtolower($path_parts["extension"]);
  43. return(strtoupper($m_Extension));
  44. }
  45. else { return "unknown"; }
  46. }
  47. function check_image($filename){
  48. $temp=strtoupper(get_Extension($filename));
  49. if(($temp=="MP3")||($temp=="WMA")||($temp=="WMV")||($temp=="ASF")) return (true);
  50. else return (false);
  51. }
  52. Function get_Files($path) {
  53. if ($handle = opendir($path)) {
  54. while (false !== ($file = readdir($handle))) {
  55. if(!is_dir($file) && substr($file,O,1) != "."){
  56. $m_Files[]=$file;
  57. }
  58. }
  59. closedir($handle);
  60. }
  61. if(sizeof($m_Files)>1)
  62. asort($m_Files);
  63. return $m_Files;
  64. }
  65. $files=get_Files($path);
  66. $filter_files=array_filter($files,"check_image");
  67. $maxnr=sizeof($filter_files)-1;
  68. sort($filter_files);
  69. for ($i=0;$i<sizeof($filter_files);$i++){
  70. echo "<a class='button' onclick=\"MediaPlayer1.SRC='$filter_files[$i]';MediaPlayer1.fileName='$filter_files[$i]';\">";
  71. echo substr($filter_files[$i], 0, strlen($filter_files[$i])-4);
  72. echo "</a><br>";
  73. }
  74. closedir($dir_handle); ?></table>
  75.  
  76. </body></html>
  77. <?php ob_flush(); ?>
It only understands wmv wma asf mp3

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 :{(
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Jan 10th, 2010
0
Re: Music player code in php
Hi every one ,

I need a php script to upload videos of any format and it should make a thumbnail of this video so thumbnail will be show in video player and i also need a better video player where i can play these videos in front end...


Thanks in advance
Reputation Points: 10
Solved Threads: 0
Newbie Poster
computer_jin is offline Offline
1 posts
since Jan 2010
Jan 10th, 2010
0
Re: Music player code in php
google UTube Clone script
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Feb 18th, 2010
0
Re: Music player code in php
hi!

i am a beginner in learning php codes..

please do help me to make a codes for music uploading and downloading using php.

thank you!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
alegane is offline Offline
1 posts
since Feb 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Form submit
Next Thread in PHP Forum Timeline: PHP and MYSQL injection attacks





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC