|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with arcitectural decision
I have a design decision that I need to make and I'm just looking for some suggestions and/or ideas.
I am creating a flash audio player that will play music from a user generated playlist on the website. At any given point the user may add a song to his or her playlist. Only the player itself will be flash, the rest of the site will be PHP driven html. The player will live in a separate window, a popup if JS is enabled. The problem I'm trying to solve for is real-time playlist updates. I can't think of a simple way to trigger the flash player to include an added song to its displayed playlist immediately upon adding a song to it. Furthermore, I'm not sure where to store the playlists. I have two viable options, at least that I can think of. First, I can store the user's playlist in a database and have flash either A) check for updates everytime it's about to play a new song B) check for updates at a set interval (every X seconds) to keep the playlist a bit more "real-time" updated Either way, this is a lot of db hits for a high volume site. Another option would be to do the same thing (either A or B) except store the playlists in XML files linked to either usernames or session id's if they are guests. So, really what I'm looking for is 1. What everyone thinks is the best place to store these playlists that will be updated during the course of a user's visit to the site and read at high interval by the flash player 2. What would be the best method of triggering the player to check for playlist updates? The most efficient and as close to real-time as possible. Any ideas or suggestions are most appreciated. Thanks! [ Also, I realize this isn't a very specific PHP question. While the storage and managing of the playlists will all be done using PHP, this isn't a code question. We just don't have an application design forum here (::nudge nudge: |
|
#2
|
|||
|
|||
|
RE: Help with arcitectural decision
i'd store the playlists in a database. it's more powerful and will allow you to add features later if you want. for example, before someone adds a song to their playlist you could display how many other people have that song. if it was all stored in separate files, i don't think i need to tell you how long that would take to gather any kind of useful statistics. another example would be: "People who liked song X also liked song Y". you get the idea.
|
|
#3
|
|||
|
|||
|
RE: Help with arcitectural decision
The playlists and any statistical information would be separate. Most playlists would be on a per-session basis, anyway, so gathering on the fly statistics wouldn't show a whole lot except maybe "x people are listening to this song right now" or something. I will be keeping all stat tracking as a separate entity that is updated upon adding a song to the playlist, most likely.
However, I do agree that a database offers much more power and flexibility. What about an xml db? Have you had any experience with that? And finally, I still need to figure out the best way to trigger the player to update its visual playlist when a song is added in the separate window. Anymore ideas? Anyone? |
|
#4
|
||||
|
||||
|
RE: Help with arcitectural decision
I too would place the list in the DB ( but I admit to being a DB fan). for the interaction - I would probably look into the whole ajax thing ( i haven't worked with it yet) as one possibility... Hmm - Or maybe you can use an observer pattern with this... the player have a listener and the upload have an announce... granted you would have to track sessions and what not on it, but ... Hmm
|
|
#5
|
||||
|
||||
|
RE: Help with arcitectural decision
Oh - and you might want to look into the SQLite DB - it is very lite and may be the comprimise you need.
Edit - and I always check the theory forum. |
|
#6
|
|||
|
|||
|
Message Moved
Thread moved from 'PHP Coding' to 'Programming Theory' by lig.
Reason: Where it truly belongs |
|
#7
|
|||
|
|||
|
RE: Help with arcitectural decision
i don't understand the purpose of a playlist that clears when you close the browser. why would anyone take the time to create something that is going to be erased? maybe if you explained more of exactly what you're trying to accomplish we could better assist you.
if you're saying that the information is going to be deleted when the browser closes, why save the playlist information in a database or a file? because then you're going to have to register all the session IDs, and when they've been inactive for a certain period of time you would have to go delete their records. why not just store the list in $_SESSION as an array. then it'll do all the clean up for you when they close the browser, and i'm pretty sure it'd be easier on the server. i think ajax is going to be your best bet for the display though. php isn't really well suited for this type of thing. people have run into the same problem when trying to make chat apps, because the real-time display just isn't practical using php. i'm not really familiar with how php interacts with flash though, so i couldn't tell you anything difinitive. |
|
#8
|
|||
|
|||
|
RE: Help with arcitectural decision
Instigator,
If they want to save their playlist they can register. Think of it this way. If you were at a site all about music which had a catalogue of songs and you wanted to hear a song you just found but if you play it it will replace the song playing now, would you not be annoyed? That's how most sites are now. Myspace, garageband, etc. Why not have it append to a session based playlist so you can continually browse and add music without stopping what's currently playing. Users will have savable playlists attached to their user id, guests on the other hand will have temporary playlists attached to their session id so they can have this functionality. You did say something that was interesting, however. Using $_SESSION to store everything. At first I was annoyed you suggested it because Flash can't directly access PHP variables. Flash is client side and PHP is serverside. However, I see no reason why I can't create a webservice for Flash to connect to that will return an XML based playlist from the list stored in $_SESSION. That way I can (as you said) let PHP handle garbage collection and all I need in my DB are named, saved playlists. Thanks for inadvertantly answering my question |
|
#9
|
|||
|
|||
|
RE: Help with arcitectural decision
like i said, i don't know how flash interacts with php. thanks for inadvertently showing appreciation though...
|
|
#10
|
|||
|
|||
|
RE: Help with arcitectural decision
Haha, sorry. I didn't exactly mean for that to come out so inappreciative. I just felt that you weren't really understanding my problem as I read your post. The only reason I replied is because it actually did lead to my finding the solution - which I am very happy about. =P
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Programming Theory > Help with arcitectural decision |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|