This week I started working on a new Flash/Flex based application that allows users to create a playlist, upload songs, put the songs in a playlist, and then be able to embed the Music Player on their blog/myspace/website etc…
http://www.mymusicplayer.ericschleeper.com/
This is actually three swf’s that connect to the same AMFPHP gateway. One is a fairly secure login/account create page, one is the admin page, and the last is the actual player.
To see more and download some of the source code, keep reading
The login page connects to the gateway and checks the user name to the password. If there is a match, the password is encrypted into a session variable and the user’s email address is stored in a session variable and the admin page loads.
I created the admin page with the Flex 3 SDK and a sweet text editor called Flash Develop. Flash Develop is an open source project and it also makes a great editor for Flash projects because it has Visual Studio-esque intellisense. So there are less typing errors and I can immediately tell if a variable or method was not initialized properly or if it is out of scope. Even for my custom classes. Plus it imports classes as you type. This makes programming faster and easier.
Click here to download the source of the admin page
These are log in credentials with filler data:
email: jim@morrison.com
password: thedoors
The DB is normalized and relational, but fairly simple. A user has many songs and many playlists, but songs can be on multiple playlists so there is a play lists to songs table. Also, the HTML page contains an Iframe where the upload page is, and an AJAX (prototype.js) call to display the player. This makes it so the page never refreshes.
The actually player is kind of sort of simple. I am using MVC in a similar manor I have used in the past (See my code section). All that the embed code has is a Flash variable that holds the id of the playlist. The php contains a select statement with a join to return URL’s and Song Names based on the playlist number. The actual player is the place I have the most work remaining, it is a little bit buggy and could use better design elements and functionality. I also plan on making more players and the user can pick which player they would like to use.




