What is and how to install Red5 in Windows

What is and how to install Red5 in Windows?

I started looking at Red5 these days and decided to write a post about it.

What is Red5?

Many years ago Adobe (legacy Macromedia) created a software called Flash Communication Server. This was a media server that allowed users to transfer real-time data, audio and video to create multi-user applications. Adobe changed its name to Flash Media Server or FMS. To send data it uses a protocol called RTMP (Real Time Messaging Protocol) and a data format known as AMF (ActionScript Message Format).

The license is pretty expensive. The cheapest one is about 999 USD and the most expensive one 4500 USD (or more) and not so many people and/or small companies have this amount of money for a single software.

A cheaper alternative is SmartFox Server that is very similar to Flash Media Server and manages prices between 500 a 2000 euros. This server is better for MMO games and supports connections not only from Flash but also from Unity, Silverlight, .net, Java, Android and iPhone. You can also buy an isometric game engine called OpenSpace by paying 2200 euros more. It keeps being expensive though.

A better approach is using Red5 which is a Flash Media Server clone, with the difference this is open-source and free. The only problem is its lack of documentation and that its installation is not as straightforward as FMS. I’ll explain the installation process in Windows below.

Installing Red5

This process describes how to install Red5 version 0.9.1.

Download: Lets download the installer from http://code.google.com/p/red5/. Select the download depending on your operating system.

Install JDK: If you do not have Java installed, download the latest version from http://java.sun.com/javase/downloads/index.jsp. Download the right version for your 32 or 64 bits operating system.

Set the environment variables in Windows: You have to create a JAVA_HOME environment variable so that other applications and Red5 know where to find Java.

In Windows XP you have to right-click “My Computer” and select “Computer” properties, and then click the “Advanced” tab. In Windows Vista or 7 you have to right-click on “Computer” and select “Properties”, then click Advanced System Settings and the “Advanced” tab.

Click on Environment Variables. In “System Variables”, click the “New” button and type JAVA_HOME in the “Variable Name” box and the path were JDK installed in the “Variable Value” box. Let’s say you installed it in C:Program FilesJavajre1.6.0_23, it all depends on the version and settings you chose when installing.

There is an extra step for 64-bits versions of Windows. When you install Java, some files are copied to the C:WindowsSystem32 folder, but you also need to copy them in the C:WindowsSysWow64 folder. In this case you only need to copy the C:Program FilesJavajdk1.6.0_23binjava.exe file to C:WindowsSysWow64.

Installing RED5: Execute the Red5 installer (setup-Red5-0.9.1.exe). By default you install it in C:Program FilesRed5 or C:Program Files (x86)Red5 for 64 bits systems. When you are prompted for an IP address type 127.0.0.1. When prompted for a port type 5080.

Start the RED5 server: Open up the “Control Panel” and select Administrative Tools and then Services. In the list of services look for RED5. Select it and start the services by clicking the “Start service” link or by right clicking the service and selecting Start. If start is not enabled then the service is already running.

Testing RED5: To test RED5 open this URL in a browser http://localhost:5080/. The RED5 home page must open and if it does everything installed correctly. Before running the examples you must install them first. Open the following URL http://localhost:5080/installer/ select the example you want to install and press Install (install SOSample for example). Then from the Red5 home page (http://localhost:5080/) click “Launch a demo” to see the list of demos. We can now open the Shared Ball demo in many browser windows and click the connect icon on each of them to connect the samples to the server. Then if you drag the Red5 logo, you’ll see how it moves in the other browser windows as well.

And now what?

If you wish to see the source code, the server code is located inside the Red5 installation folder C:Program FilesRed5webapps or C:Program Files (x86)Red5webapps for 64 bits systems. To get the client Flash code you can use TortoiseSVN or any other subversion client to get them from http://red5.googlecode.com/svn/flash/trunk (Flash samples) or http://red5.googlecode.com/svn/flex/trunk (Flex samples). The Flash samples were written in ActionScript 2.0, so you’ll have to translate them to ActionScript 3.0 but this is not complicated.

If you don’t want to translate code you can write your own. To connect to Red5 you use the NetConnection class, to exchange data you use RSOs (Remote Shared Objects) and to send and receive audio/video use the NetStream class. To create en RSO just use the following line of code:

var rso:SharedObject = SharedObject.getRemote(
"NombreRSO", "rtmp://localhost/NombreApp");

You just have to play a little and see the samples to get the rest done.

Advertisements
%d bloggers like this: