Playr 2.0: And the Best Goes On
Compared with traditional application development technologies, one important aspect of rich Internet applications (RIAs) is the ease of handling media rich contents. The Playr ActionScript 3 music library is one example that helps Flash, Flex or AIR based applications easily incorporate music contents. InfoQ spoke with the Playr creator Ronny Welter for more insight.
Welter, a young Flash developer who lives in Belgium, is the Chairman of FlashFocus.nl. He describes how Playr was born of his many deadline crunching projects:
I was working on a project, for which I needed a music player that could handle different playlists. I figured this is Flash! I ran a quick search on the Web, only to find there was no library out there that did what I really needed. Since I was in a hurry, I created what I needed. Later, I released the class—only to get bug reports and lots of feature requests. Initially, it was called 'MusicPlayer'. When the first decent ActionScript 3 version was released, I named it Playr.
Playr makes building any kind of music player in Flash/Flex a piece of cake: easy, straight forward and quick! Playr can handle the needs for anything from a single track or a loop to a full-feature music player.
According to Welter, Playr is designed a bit like a model view controller (MVC) application that enables you to create the view and add the model and the controller in a way it fits your needs. He says:
I added register functions to make sure you could wire the handlers to the desired control in a simple way. However, if you prefer hooking everything up yourself, using event listeners, knock yourself out. There is an event for almost everything in there. This should enable everyone to accomplish whatever they want.
With respect to the challenges encountered during the development of Playr, Welter shares:
Playr was supposed to make everything easier. Therefore, building a library that is flexible, yet stays easy to use, was probably the most difficult part. Keeping it all that simple and getting Playr shaped up the way I wanted really gave me a headache sometimes. One thing that still doesn't fit right is the de duration of the track. Right now, you have to pass this value along (in seconds) using XML or a few features will not work. The ID3 tag gives you the length of the track only for the part that has been loaded. For example: if you've got a track of 240 seconds that has only been loaded halfway, ActionScript will return 120 seconds for the length property of the sound. In other words, it gives the buffered part of the track. I've tried all kinds of stuff, but I can't get the correct length right, so I'll just stick with the XML until I get this right.
As for future plans, Welter tells InfoQ:
I've got lots of ideas for Playr. I'm looking into new features, such as cross fading, Last.fm API integration, sound distortion and effects, and so forth. Right now, there is a PHP implementation of something called PlayrDiscovr. PlayrDiscovr is the automated playlist that saves time. The latest PlayrDiscovr version was written by Ward Werbrouck. I'm looking for people willing to write ASP, Ruby, ColdFusion and Python implementations for PlayrDiscovr.
I'm also working on a Visualizr class to add all kinds of sound visualizations. This isn't Playr-only, but it should be as easy to use as Playr itself.
Here are some music projects that use Playr: