Publish Red5 applications and stream it to webserver

The following example will show you how to publish your SWF files by embedding them into your HTML files. SWF files are located on your Red5 server. You may run the HTML file either from your local computer or host it on a webhosting server. As a result, the SWF will be streamed from your RED5 server to your web server. The following example embeds a Red5 Video Player in your HTML file.

STEP-1: Create a new HTML file called test.html (or any other name you want) on your local PC and paste the following example code in test.html file (see the code below in BLUE color). Remember to replace the RED5_SERVER_IP with your actual Red5 server's IP. You can find your Red5 server IP  in your Red5 activation email that you received from GigaPros.

Put the following lines of code in test.html file & save the html on your local PC:

<head><title>Red5 Test</title></head>

<h3>Test to Embed SWF</h3>
<embed src="http://RED5_SERVER_IP:5080/demos/ofla_demo.swf"
style="" id="pl2" name="pl2" bgcolor="#ffffff" quality="high" allowfullscreen="true" allowscriptaccess="always"
flashvars="streamer=rtmp://RED5_SERVER_IP:1935/oflaDemo&file=DarkKnight.flv" width="800" height="600"


STEP-2: Run test.html file (created in step-1 above) in your internet browser (like: Internet Explorer, Firefox etc). You will see the demo page running.

STEP-3: In your demo page, you will see an URL textbox showing rtmp://localhost/oflaDemo. Replace the content of this textbox with rtmp://RED5_SERVER_IP/oflaDemo. Click on Connect button located below the URL textbox.

STEP-4: You will see a list of movie files in the Library section located on the left side. Click on any of the movie names (like: DarkKnight.flv) and the movie will start playing!

Important Paths in your Red5 Server
1) Application (compiled SWF): /opt/red5/webapps/root/demos/ofla_demo.swf
2) Application (source files): /opt/red5/webapps/oflaDemo/WEB-INF/
3) Temporary Streams: /opt/red5/webapps/oflaDemo/streams/

Serving HTTP directly from your Red5 Server
Normally, you will be hosting your html files on a webhosting server, which is a separate physical server than your Red5 server. However, your Red5 server have a built-in webserver that can be used for testing purposes. To do so, put your html files in Red5 server's folder /opt/red5/webapps/root/. Here's a real example of HTTP mapping using your Red5 server:

The physical file /opt/red5/webapps/root/demos/ofla_demo.html maps to HTTP URL http://RED5_SERVER_IP:5080/demos/ofla_demo.html

The only disadvantage of using Red5's own HTTP server is: You will have to always append ":5080" with your URL IP, and you will not be able to use your domain name to browse your http content.

Using FlashVars parameters with RTMP
In the above example (blue code), note the use of flashvars near the end of the code. Flashvars are the parameters defined by the Red5 Application (in this case, oflaDemo application). While developing your application, you need to define the flashvars as variable parameters and expose them to SWF as flashvars. That way, the SWF users can control the behaviour of Rde5 application (SWF) by using appropriate flashvars that you defined. Note that, the flashvar in above code example will NOT really work with's just shown as an example to show how to use it.

Was this answer helpful?

Also Read
How do I upload files to my Red5 server?

Follow the steps shown below to upload files to your RED5 folder:1) Download and install WinSCP...

How do I test my Red5 server?

To test the basic functionality of your Red5 server, please use the following steps:1) Go to...

Do you provide FMS or RED5 connections?

FMS stands for Flash Media Streaming, which is a product developed by Adobe (Abode flash media...

How to I choose a RED5 hosting plan?

Here's a simple chart that will help you choose the correct RED5 hosting plan: # For 0-10...