Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > PHP Programming
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 10-23-2006, 01:23 PM
  #1
evropa
Soldier (Level 11)
 
Join Date: Dec 2005
Posts: 118
iTrader: (0)
evropa is an unknown quantity at this point
PHP music player

I'm wondering what is the best way to create a audio player powered by PHP? Keep in mind I have no experience in Flash. Maybe some html, ajax and CSS styling?
evropa is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-23-2006, 02:17 PM
  #2
erisco
Catapulted
 
erisco's Avatar
 
Join Date: Dec 2005
Location: Within the division of zero
Posts: 5,859
iTrader: (0)
erisco will become famous soon enougherisco will become famous soon enough
PHP does not deal with audio players, flash players, ajax, css, html, or any type of players or client side language. AJAX being partly server-side, but it is a different language set altogether.
erisco is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-23-2006, 05:02 PM
  #3
evropa
Soldier (Level 11)
 
Join Date: Dec 2005
Posts: 118
iTrader: (0)
evropa is an unknown quantity at this point
Do you have any links that have examples of non flash audio players? I'm not sure how to start it, I'm thinking a textareas for the song info and songs?
evropa is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-23-2006, 05:42 PM
  #4
blackpepper
Gampi
 
blackpepper's Avatar
 
Join Date: Jul 2005
Location: metro - nyc
Posts: 1,282
iTrader: (0)
blackpepper will become famous soon enough
this is a music player who is done in html and then powered/config'd through php
the actual player is in html and some javascript, however the songs are read from a directory and put into the player. All songs in the "music" folder will be inserted into your playlist.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript"><!--
function song(){
document.getElementById('music1').innerHTML="<embed type='application/x-mplayer2' id='music2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+document.getElementById('cancion').value+"' name='MediaPlayer1' width='300' height='75' controltype='2' showcontrols='1' showstatusbar='1' AutoStart='true'></embed>";
}
//-->
</script>
</head>
<body>
<select  id="cancion" onchange="song()" size="1"> 
   <option value="none">::::::::::::: Choose Your Song Here :::::::::::::</option>
<?php
$nameofdir = "music/";
$domain = $_SERVER['HTTP_HOST'];
$dir = opendir($nameofdir);

while (($file = readdir($dir)) !== false)
  {	
 if (strpos($file, '.mp3') !== false) {
   	$name = str_replace('.mp3', ' ', $file);
   	$files = str_replace(" ", "%20", $file);
       echo '<option value="http://'.$domain.'/'.$nameofdir.''.$file.'">'.$name.'</option>'."\n"; } 
  }
?>	
</select><br> 
<span id="music1"><embed type="application/x-mplayer2" id="music1"
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" 
src="" 
name="MediaPlayer1" 
width="300"
height="70"
controltype="2" 
showcontrols="1"
showstatusbar="1"
AutoStart="0">
</embed></span>
</div>
</body>
</html>
__________________
blackpepper is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-16-2009, 08:06 AM
  #5
_MuSiC_
Novice (Level 1)
 
Join Date: Sep 2009
Posts: 1
iTrader: (0)
_MuSiC_ is an unknown quantity at this point
Quote:
Originally Posted by blackpepper View Post
this is a music player who is done in html and then powered/config'd through php
the actual player is in html and some javascript, however the songs are read from a directory and put into the player. All songs in the "music" folder will be inserted into your playlist.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript"><!--
function song(){
document.getElementById('music1').innerHTML="<embed type='application/x-mplayer2' id='music2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+document.getElementById('cancion').value+"' name='MediaPlayer1' width='300' height='75' controltype='2' showcontrols='1' showstatusbar='1' AutoStart='true'></embed>";
}
//-->
</script>
</head>
<body>
<select  id="cancion" onchange="song()" size="1"> 
   <option value="none">::::::::::::: Choose Your Song Here :::::::::::::</option>
<?php
$nameofdir = "music/";
$domain = $_SERVER['HTTP_HOST'];
$dir = opendir($nameofdir);

while (($file = readdir($dir)) !== false)
  {	
 if (strpos($file, '.mp3') !== false) {
   	$name = str_replace('.mp3', ' ', $file);
   	$files = str_replace(" ", "%20", $file);
       echo '<option value="http://'.$domain.'/'.$nameofdir.''.$file.'">'.$name.'</option>'."\n"; } 
  }
?>	
</select><br> 
<span id="music1"><embed type="application/x-mplayer2" id="music1"
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" 
src="" 
name="MediaPlayer1" 
width="300"
height="70"
controltype="2" 
showcontrols="1"
showstatusbar="1"
AutoStart="0">
</embed></span>
</div>
</body>
</html>
but how can i put my site server address ???
i make a directory in my server .... name = music
but how can i path my site address ??
i cant see my playlist

plz help me
_MuSiC_ is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-20-2009, 09:56 AM
  #6
mattmill30
Soldier (Level 11)
 
Join Date: Oct 2006
Posts: 144
iTrader: (0)
mattmill30 is an unknown quantity at this point
Hi,

If you want to simplify the script you could always use the new HTML5 standard <video> and <audio> tags.
This will make it compatible with Mac and Linux, as to my knowledge, WMP isn't compatible with Mac, and certainly isn't compatible with Linux.

http://www.w3.org/TR/html5/video.html#audio.

However, this isn't compatible with IE(they're hving enough problems, with HTML 4.01 compatibility)

IE HTML5 - Official Excuse

It depends whether this media player, is for public access, or whether you just want it to play your music @ work
mattmill30 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Reply
KEEP TABS
SPONSORS
 
Boxedart

 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 05:43 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.