Using Red 5 Flash media server with Drupal
I am working on a project where I wanted to be able to record audio through a web browser. Not having the $5000 to pay for Adobe Flash Media Server, I decided to try to use Red 5 instead.
My first step was to download Red 5 and get it installed locally. As I'm on a shared computer, I'm developing in Windows so I used the Windows version. It installs relatively easily, and you can check to make sure it is running smoothly by visiting http://localhost:5080, assuming you install it with the default port.
One problem I discovered here was that if you shut down the Red 5 server improperly, ie. not using the batch script provided, you have to re-install Red 5 to get it up and running properly. That one was a big pain until I figured it out. Noticeably, the Red 5 install on Windows did not create a shortcut in my Start menu for shutting down the Red 5 server, so I suggest you set one up yourself. Another issue was that I needed to set the JAVA_HOME and JAVA_VERSION environmental variables, or rather I did, and ended up having fewer problems afterward...
Once I had this all set up and tested, I verified that I could actually record audio + video using the Red 5 demos, available at http://localhost:5080. I checked to see what directory the RTMP stream was being recorded to, and verified that a file was being created when I was recording the demo. This ended up being inside C:\Red5\webapps\oflaDemo\streams as I chose to install Red 5 to the root directory of my Windows installation. The next step was to try and get the audio recorder embedded within a Drupal node.
At first I tried out a module which claims to allow users to record audio and video from a webcam, and although the structure of the module was sound, I discovered a major problem. The URL for the Red 5 server was hard-coded into the SWF which I discovered after using a free tool to decompile the SWF as the module author did not include the source code for his web cam recorder.
So I looked around to see if anyone else had tackled this issue, and sure enough Dennie Hoopingarner had figured it out. He provides some advice, tutorials, and the license to use his scripts for free. Very nice guy! Also, his SWF audio and video recorders allow you to define the location of your Red 5 server using Flashvars, which made it relatively easy to create a module to handle the creation of audio files.
I created a module to handle the creation and display of the audio files. Basically what I do is, on node creation I move the newly created audio.flv file into the Drupal file system (if it exists) and I rely on the SWFTools module (with the JW Mediaplayer v4 installed) to display an audio player for the file when the node is being viewed. It's pretty bare boned without any significant features, but it works.
I used the Audio recorder available from Dennie Hoopingarner's website to provide the Flash ability to create RTMP streams back to my Red 5 media server.
On Linux, you'll have to make sure you set your permissions correctly in your Red 5 application folder so that this module can move the created file over. You may also have to fiddle with the settings initially to get it to work. For example, "Red5 Flash Server IP Address" should really be named "where do you access your Red 5 OFLADemo through a browser" but I just took a bunch of the code from the original module (which remember didn't work) and adapted it to my use case.
Let me know if there are any other issues. This is still a work in progress, but I thought some people might be interested in hearing about using Red 5 with Drupal.
Subcribe to my blog
- Gradient jQuery plugin (36,854)
- Modulo Arithmetic (10,578)
- Using Red 5 Flash media server with Drupal (10,062)
- Creating Equations in Movable Type (5,746)
- Flash Compass (5,722)
- Histograms Online (5,425)
- Game of Life ported to Flash (5,255)
- 1 of 13