corillo181 Posted August 20, 2007 Share Posted August 20, 2007 hey I’m trying to build a mp3 player, right now I got a mysql with artist and another one linking to their music, but I been using EMBED because I can put a play list of their song, the only problem with this I’m trying to make my website XHTML 1.1 web standard and that’s the only thing giving me issues. in short how can I make a play list with the OBJECT and php any one know of a good tutorial. Quote Link to comment https://forums.phpfreaks.com/topic/65835-mp3-player/ Share on other sites More sharing options...
php_tom Posted August 20, 2007 Share Posted August 20, 2007 I'd just use XSPF Player (http://musicplayer.sourceforge.net/) and the XSPF XML format... Quote Link to comment https://forums.phpfreaks.com/topic/65835-mp3-player/#findComment-328997 Share on other sites More sharing options...
corillo181 Posted August 20, 2007 Author Share Posted August 20, 2007 well i really like to make my own stuff.. i just need a starting point and idea of how it would work. Quote Link to comment https://forums.phpfreaks.com/topic/65835-mp3-player/#findComment-329143 Share on other sites More sharing options...
Psycho Posted August 20, 2007 Share Posted August 20, 2007 Personally I would just create a dynamic playlist file and deliver it to the browser. The user's default mp3 play should start with the tracks in the playlist. But, if you want an actual "player" that exists in the browser, then I don't have a suggestion. Good luck. Quote Link to comment https://forums.phpfreaks.com/topic/65835-mp3-player/#findComment-329160 Share on other sites More sharing options...
micah1701 Posted August 20, 2007 Share Posted August 20, 2007 to make a player... i suggest download an open source one and reverse engineer it. but if you just want to stream individual MP3 files you want to convert them to M3U files on the fly so they stream in the users default player, instead of forcing the user to download the full MP3 file. what i've done in the past is something like this: user click: <a href="play.php?id=32210493">Play Song</a> play.php <?php $id= $_GET['id']; //add some code that uses the id to look up the actual location of the file; end up with: $file = "my/music/files/song.mp3"; header("Content-type: audio/m3u"); header("Content-Disposition: inline; filename=".$_GET['id'].".m3u"); ?> http://www.mydomain.com/<?php=$file ?> Quote Link to comment https://forums.phpfreaks.com/topic/65835-mp3-player/#findComment-329161 Share on other sites More sharing options...
corillo181 Posted August 20, 2007 Author Share Posted August 20, 2007 i guess the best way is to do a xml flash player, but how would i make a file with the artists and their song? because i know the extension has to be xml so i wouldn't know how to do that. query the artist and their song into a xml files and that file has to update when ever a new song or artists is added. any clue? Quote Link to comment https://forums.phpfreaks.com/topic/65835-mp3-player/#findComment-329248 Share on other sites More sharing options...
a2bardeals Posted August 20, 2007 Share Posted August 20, 2007 i did something just like this not to long ago. i used Flash's media playback component to load and stream mp3 files on a my page. it's pretty easy and only takes a few lines of Actionscript. Basically i started with data from a MySQL table with ID, Title, Artist, & Path columns. for example, using php to retrive song ID: 393 it loads the artist, title, path variables for that track display the title and artist variables in PHP: <?php $result = mysql_query("SELECT artist, title, path FROM music WHERE ID = `393` LIMIT 1" while ($row = mysql_fetch_array($result)){ echo 'Artist: '.$row[0].'<br>'; echo 'Title: '.$row[1]; $file_path = $row[2]; } ?> then pass the $file_path variable into flash like this (notice you have to pass it twice) <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/" WIDTH="250" HEIGHT="300" id="player"> <PARAM NAME=movie VALUE="player.swf[b]?path=<?php echo $file_path; ?>[/b]"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="player.swf[b]?path=<?php echo $file_path; ?>[/b]" quality=high bgcolor=#FFFFFF WIDTH="250" HEIGHT="300" NAME="player" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> </EMBED> </OBJECT> to create the empty player. you should add flash's media playback component to a new Flash project. Set the instance name to "media" in the properties window and set it's media type to mp3 in the component inspector. Select the first (and only) frame of the movie and open the actions window. Pass the variable like this: var passed:String = path; media.setMedia(path); export the flash movie as player.swf and save it in the same directory as the page retrieving the info from the database. you should be all set! Quote Link to comment https://forums.phpfreaks.com/topic/65835-mp3-player/#findComment-329288 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.