Log in

View Full Version : Dynamic playlist for audio player



unitedlocalbands
08-02-2007, 04:25 AM
Is it posible to create a dynamic playlist so that when a person looks at a band profile on my website, the play list will update to only show songs by that band.

I know how to embedded the different audio players and I can link them to the correct file like (.asx, .xml and I forget the rest) for the playlist... but I'm having trouble making these files update dynamically.

I use mostly coldfusion to query mysql... and I did go to a coldfusion forum but it has turned up no help. Can this be done using javascript?

I'm open to any suggestions. I started to build an audio player from scratch but writing the actionscript is a little overwhelming.

Thanks if you can help, no problem if you cant.

Take care,

James

unitedlocalbands
08-03-2007, 03:37 PM
I have asked this same question on atleats three different forums and not one has earned a response. Not even a ("sorry we cant help", or "dont you dare ask this question!")

I bet over 100 people have looked at this question between the three forums and not one response.

Thats ok... I'm going to figure it out on my own and then I'm going to post the answer on every forum I can.

That way the next guy who is in a similar situation will be able to use the "code" I have devised!

Thanks anyway,

James

shachi
08-03-2007, 06:58 PM
1) Describe which format your player uses,
2) Describe which format you want the playlist to be in,
3) It can be done with php and maybe also with javascript(and coldfusion which I am not at all familiar with)

unitedlocalbands
08-03-2007, 09:13 PM
Lets start with this code for a windows media player.



<OBJECT id="VIDEO" width="320" height="240"
style="position:absolute; left:0;top:0;"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="application/x-oleobject">

<PARAM NAME="URL" VALUE="your file or url">
<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">
<PARAM NAME="AutoStart" VALUE="True">
<PARAM name="uiMode" value="none">
<PARAM name="PlayCount" value="9999">
</OBJECT>


and lets use a .asx file for the playlist.

Can javascript look at mysql database and and filter the songs for that .asx playlist?

That way when a uers picks a profile to view the media players palylist only contains songs from that profile.

Thanks for your response.

I'm still working on my own custom audio / video player. It is going to be a while before I get it working because I dont know anything about actionscript.

I dont mind though, because 8 months ago I didnt even know what coldfusion, html, javascript, or css was either. Now atleast I know I can learn it.

Medyman
08-04-2007, 05:06 PM
Maybe I'm not seeing the whole picture, but this seems like a simple php task.

Have the php query a mysql table and spit back the url of whatever particular xml file (or create an xml file with only that artist's songs and then link to it).

Then you can use any basic mp3 player with external vars (there are a million of free ones on the next and building your own isn't too difficult either) with that new xml file.


Good luck with building your own mp3. If you need any help, feel free to post in the flash forum. It is daunting at first but not so difficult when you figure it out some basics. Check out gotoAndLearn.com for some awesome tutorials if you need them.

unitedlocalbands
08-04-2007, 05:39 PM
Thank you for your reply,

There are two issues:

1) The media player seems to ignore any dynamicly created url.
I use coldfusion to qurey the database, not sure if this is the case with php.
So when I run the program the player doesnt think there is any file to play.
weird thing is when you "viewsource" from the browser you can see the file is in the "src" atribute of the "embed" code.

2) I would like for my user to be able to just upload there media files and have the xml file update automaticly. I could have a seperate xml file for every user but that doesnt solve the problem of the xml file has to be updated manually. I havent tried to use php in the xml file but I know that coldfusion gets ignored.

The other option is to only let my user upload one song. But even still like I said befor, the media play seems to ignore dynamicly generated data.

But thank you very much for your time.

jscheuer1
08-04-2007, 07:03 PM
I have found that multimedia tags like Flash, MediaPlayer, QuickTime, etc. object, embed, object/object, or object/embed are resistant to DOM and various other javascript methods for altering them once that they have been parsed by the browser and passed to the plug-in that handles them. How this happens varies from browser to browser, but they all do it relatively poorly.

What I would suggest is using either a pop up window, or (I generally prefer) an iframe. You pass the variable(s) to the page to be loaded into the iframe or pop up and have it use javascript or server side code to write (if using javascript, document.write()) the multimedia tag(s) only one time to that page.

Then, if you want to open up another song, movie or whatever, load that as a new page into the pop up or iframe using the same method. If you are using iframe and you want the multimedia object to stop without adding a new one, you need to change the location or the source (src attribute) of the iframe to 'about:blank'. With a pop up, the user just needs to close it.

unitedlocalbands
08-04-2007, 09:01 PM
Thank you for the information. I will try this out. If I get it working I'll post back what I came up with.

James

unitedlocalbands
08-04-2007, 11:14 PM
Well your idea works great. I got it to work so that all the person viewing my site has to do is just click the name of the song they want to hear and the iframe reloads its self with that file in the src. Now I just have to build all the code to allow the users to upload there music.

Thanks again!

James