Red5 is quite a complex beast. Understanding how an application should be setup is one of the common pitfalls that developers of all ranges experience. Red5 was built using the Spring Framework, an inversion of control system. By using Spring, the Red5 team opened up the server to be as extensible and flexible as possible. However, flexibility comes with its share of criticism as well. It is my intention to demystify how services should be setup. It is a common programming pattern that will help you build a system that can be extended in a clean and object oriented approach!
Let’s start with some history. I was first approached by Trevor Burton (lead engineer behind Paperworld3d) back in April right before FITC. Paperworld is a Realtime 3D Multi-User Application Framework for the Flash Platform. Trevor was looking for a way to make Paperworld3d flexible and object oriented. I was more than glad to help out Trevor and we eventually built a solid foundation for the Paperworld3D project. Trevor’s brilliance and extensive knowledge of Red5 and AS3 made him a prime candidate to be a part of the Infrared5 team and a formal offer came soon afterward. You can check out Trevor’s bio on the Infrared5 site. You can additionally see Trevor speaking at Flash on Tap.
There is a positive from this flexibility though. With the right knowledge at hand and a good understanding of Red5 and Spring, the approach can be simple! Typically, you want to receive status as to what is going on with the application. This is usually handled from your Red5 application adaptor class. However, you also don’t want a monolithic class to handle all of this event handling. I’ve standardized on injecting the application adapter into my service beans. At this point the service bean can do what its supposed to do while also having the ability to listen to application level events.
View the following presentation:
http://www.newviewnetworks.com/nvnhome/blog/client/uploads/Red5_Services.swf
and you can follow along by looking at how Paperworld3D is setup.
If you liked this tip, then you might be interested in joining us at the Red5 workshop in October where Paul Gregoire and myself (red5 engineers) will be discussing application level design and will probably divulge a few more tips and tricks. For more information about the workshop and the conference in general visit: Flash on Tap!
Tags: Uncategorized // 5 Comments »