Programming Theory
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesProgramming Theory

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old August 3rd, 2006, 02:30 PM
y0y y0y is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Raleigh, NC
Posts: 140 y0y User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 11 sec
Reputation Power: 2
Send a message via AIM to y0y
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: and the programming theory board barely gets any viewers. I just know there are some rather intelligent people here and I'd love to hear their feedback. ]

Reply With Quote
  #2  
Old August 3rd, 2006, 05:21 PM
instigator instigator is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Maryland
Posts: 1,158 instigator User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 20 m 13 sec
Reputation Power: 3
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.

Reply With Quote
  #3  
Old August 3rd, 2006, 10:54 PM
y0y y0y is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Raleigh, NC
Posts: 140 y0y User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 11 sec
Reputation Power: 2
Send a message via AIM to y0y
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?

Reply With Quote
  #4  
Old August 3rd, 2006, 11:00 PM
lig's Avatar
lig lig is offline
"Forum Nazi"
Codewalkers Demi-God (4500 - 4999 posts)
 
Join Date: Apr 2007
Location: Jacksonville, Fl
Posts: 4,727 lig User rank is Private First Class (20 - 50 Reputation Level)lig User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 1 h 4 m 45 sec
Reputation Power: 6
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

Reply With Quote
  #5  
Old August 3rd, 2006, 11:01 PM
lig's Avatar
lig lig is offline
"Forum Nazi"
Codewalkers Demi-God (4500 - 4999 posts)
 
Join Date: Apr 2007
Location: Jacksonville, Fl
Posts: 4,727 lig User rank is Private First Class (20 - 50 Reputation Level)lig User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 1 h 4 m 45 sec
Reputation Power: 6
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.

Reply With Quote
  #6  
Old August 3rd, 2006, 11:03 PM
System System is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Posts: 665 System User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Message Moved

Thread moved from 'PHP Coding' to 'Programming Theory' by lig.

Reason: Where it truly belongs

Reply With Quote
  #7  
Old August 4th, 2006, 11:42 AM
instigator instigator is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Maryland
Posts: 1,158 instigator User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 20 m 13 sec
Reputation Power: 3
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.

Reply With Quote
  #8  
Old August 6th, 2006, 07:06 AM
y0y y0y is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Raleigh, NC
Posts: 140 y0y User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 11 sec
Reputation Power: 2
Send a message via AIM to y0y
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

Reply With Quote
  #9  
Old August 6th, 2006, 07:38 PM
instigator instigator is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Maryland
Posts: 1,158 instigator User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 20 m 13 sec
Reputation Power: 3
RE: Help with arcitectural decision

like i said, i don't know how flash interacts with php. thanks for inadvertently showing appreciation though...

Reply With Quote
  #10  
Old August 6th, 2006, 08:39 PM
y0y y0y is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Raleigh, NC
Posts: 140 y0y User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 11 sec
Reputation Power: 2
Send a message via AIM to y0y
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


Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesProgramming Theory > Help with arcitectural decision


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway