Red5 Plugin for Grails


Continuing with my Grails plugin love fest, I spent several 3-4 AM nights digging into how to integrate Red5 RTMP streaming into my Grails Video plugin. The two options I came up with were:

  1. Leave the Red5 functionality as a separate WAR and use a shared directory which the video plugin would deposit the encoded movies
  2. Copy the war artifacts into the Grails plugin so the Grails app embeds the Red5 functionality within the WAR

I opted for the latter because I would like to have the Red5 application code use GORM to read meta data about the Movie asset. Additionally, to have a tight integration with Spring Security I would like to have the artifacts share the same application context. Finally, it is easier to debug code (btw, IntelliJ IDE rocks) if you don’t have to manage the startup of two different WARs. I’d like to say developing this plugin was easy, but in all honesty, it was a totally pain in the bum, and at the time, it seemed overly complex. In hindsight though, I realize that the reason for the “pain in the bum” was my lack of understanding of the life cycle of the context loader in Spring.

Once that hurdle was jumped, due to the tight Java/J2EE integration, the rest of the plugin development, installation scripts, custom artifact, etc. was ridiculously easy. The work was mostly setting up Spring configuration for the plugin. Because of how elegant the plugin architecture is, I think stitching together tiny pieces of functionality that is packaged in plugins is the best way to grow functionality base of Grails.

With this in mind I decided to release the Red5 integration work as a separate plugin and have the Video plugin depend on that for the RTMP streaming. So if one person doesn’t want to use all the Video plugin functionality they can at least use the Red5 Integration functionality. If you’d like to check it out please find it in the grails plugins section of our site. One thing to note is the Red5 plugin comes packaged with the source code for Red5.

I am going to send an email to the Red5 team and see if they will keep me abreast of new functionality as it comes down the road so I can maintain the plugin. I’ll keep folks posted on what they say. Finally, I’d like to thank, the Red5 team for the their 0.6.3 WAR release of the Red5 server and Alexander zhukov who created Red5-minimal. The fact that Alexander was able to accomplish what he did let me know it was “in theory” possible to incorporate the functionality in a plugin and gave me inspiration during the dark times. If you become the next youtube with this Grails plugin, throw a brother a couple bucks…. do the right thing :)

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts
One step closer to Grails 1.0
Sweet Potato Pie!: A Video Plugin for Groovy on Grails

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Be the first to leave a comment!