Jump to content

NooB Alert - Optimize Playlist player


spiceman

Recommended Posts

Current Scenario:

 

> Php communicates with Flash playlist player

> users are able to create playlists for a flash player on site

> Flash Player will play songs based on playlist id which contains the associated trackids

> Flash player plays trackmp3 according to direct path of track ID

> SQL request is initiated when playlist loads

> Playlist is can be embedded on other pages

 

How do I reduce the MYSQL connections with the above scenario? Is there any thing i can incorporate like reading from an XML file or something to reduce load or improve optimization as more ppl start embedding the player?

 

I ultimately think that something is wrong with the overall PHP design/solution that the programmer has...

Link to comment
https://forums.phpfreaks.com/topic/193282-noob-alert-optimize-playlist-player/
Share on other sites

Not really enough information really. I am assuming that the playlist that the user creates only contains track IDs and that is why you have to do a database query to get the track path?

 

I did something similar before, but in a very different process. For my application, I did not want the user's to be able to access the music files directly. So, in my application I allowed the user to create "playlists" via a webpage. Those playlists were just database records.

 

Then, when a user selected a link to play a playlist I would do a single query to the database to get the tracklist for the playlist (all I would get were the track IDs from the database). I would use the results of that query to build an actual flat-file playlist that could be consumed with the user's default media player. I would never actually write the file to disk - I would just use the appropriate headers to send the file to the user. Also, the actual playlist file would contain links such as

    www.mysite.com/playfile.php?id=23

    www.mysite.com/playfile.php?id=187

    www.mysite.com/playfile.php?id=93

 

The user's media player would make a request to the URLs above and that page would do a query to get the mp3 location and, using the appropriate headers, send the file to the user.

 

I never had a problem with performance because I never had a ton of usage, plus when a user selected to play a playlist they would only be doing a database request once every 3-5 minutes.

i appreciate the insight... i will reread this post and see what else i can ask ...

 

but it sounds that you do a single query for playlist... and it doesn't query for each song afterwords... i will check if mine does that.

 

Right now i am getting max_connection issues and cpu spikes and i think its related to the playlist... i'll come back later to bother you..

 

thanks again...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.