BEGIN RED5 DEVELOPMENT

[NOTE: Please replace the paths with your own directory structure for this tutorial]

CHECKOUT RED5 TRUNK INTO ECLIPSE – RED5 SERVER
Checkout red5 if you have reliable bandwidth.
1. Install subclipse. Instructions are on the following URL:
http://subclipse.tigris.org/install.html

2. Set up red5 on eclipse using the wink tutorial on the following URL:
http://www.bluetube.com/clients/red5/eclipse.htm
The red5 dev repository is:
http://svn1.cvsdude.com/osflash/red5/java/server/trunk

3. Right click on the red5 repository above, click on Checkout to checkout the code. The red5 sources will be copied to your workspace directory. In addition, a new java project will be automatically created.

4. You will now have checked out the red5 code and can immediately begin working on it.

Alternatively if your bandwidth is poor, you may download the red5 sources of your choice from the following link:
http://www.osflash.org/red5/red5downloads
Untar these sources, then continue on with the steps below:

CREATE NEW RED5 PROJECT IN ECLIPSE
1. Then navigate to File > New > Project. Call it say red5server

2. Right click on the red5server project link and select Import > File System. Navigate to the location of the untarred red5 sources folder. Select this folder and click on Finish to create your new Red5project.

INSTALLING FLEX2 ON LINUX
Why do we need flex2? We need flex2 to development the Flash Client User Interface that will be connecting to our Red5 server in order to play streams. Flex2 sources can be compiled on linux.

1. Download the flex2 SDK (flex_sdk_2.zip) from Adobe
http://www.adobe.com/cfusion/tdrc/index.cfm?product=flex
However, you need to be logged in first.

2. Then follow the steps below(Note: you might choose to create your flex2sdk directory in a different location):

#mkdir /home/sysadmin/flex2sdk
#cd /home/sysadmin/flex2sdk
#unzip /home/sysadmin/Downloads/flex_sdk_2.zip
#vim /usr/bin/mxmlc

Paste the following 2 lines inside:

#!/bin/sh
/home/sysadmin/flex2sdk/bin/mxmlc

Then…
#chmod 755 /usr/bin/mxmlc

You should now be able to compile flex2 source off the command line

EDITING FLEX2 CODE USING VIM
1. Download the actionscript vim file from the following link:
http://geocities.com/manish_jethani/actionscript.vim

2. Follow the steps below:

#dos2unix /home/sysadmin/Downloads/actionscript.vim
#cd /home/sysadmin/Downloads/
#cp actionscript.vim /usr/share/vim/current/syntax/
#vim /usr/share/vim/current/filetype.vim

Remove the *.as from the entry for the Atlas language
Then add the following 2 lines to the same file:

” Actionscript
au BufNewFile,BufRead *.as setf actionscript

Now,
#vim /etc/vimrc
Append the line below to the vimrc file:
syntax on

You should now be able to edit *.as files on vim.
3. Since *.mxml are xml files, syntax highlighting for these files will be on by default.

INSTALLING ECLIPSE WTP
1. Download Eclipse WTP (for J2EE web application development) from the following link:
http://download.eclipse.org/webtools/downloads/
Look for the wtp all in one sdk and download it, as it comes with all the required pre-requisites.

2. Untar the all in one wtp sdk.
#cd /home/sysadmin/Downloads
#mkdir wtp
#tar -xzvf wtp-all-in-one-sdk-*-linux-gtk.tar.gz —directory wtp

3. Create a folder (if it doesn’t exist already) called links in your eclipse installation path. So in my case I did this:
#mkdir /opt/eclipse/links

3. #vim /opt/eclipse/links/wtp.link
(Append the following line ie the path to your untarred wtp sdk folder)
path=/home/sysadmin/Downloads/wtp/eclipse

4. Now restart eclipse. The wtp plugin should have been installed. To remove the WTP plugin just remove the wtp.link file in your links directory above.

INSTALL SPRING ECLIPSE IDE
Red5 is written using the Spring Framework so to do server side logic code it would help a great deal to have this plugin installed. Red5 uses Spring to perform Dependency Injection (DI) by using Spring’s IoC (Inversion of Control) container. This allows you to custom configure red5 (with your own personal dependencies) without having to alter/modify the core red5 api. In addition, Spring comes with plenty of functionality and features that you can use for your server-side logic. When using Spring’s IoC container, try us much as possible to decouple the IoC container from your actual source code. Please follow the steps below to configure the Spring Eclipse IDE:

1. Download the spring ide eclipse plugin from the following URL:
http://springide.org/updatesite/

2. unzip it:
#cd /home/sysadmin/Downloads
#mkdir spring
#mv springide_updatesite_*.zip spring
#cd spring
#unzip springide_updatesite_*.zip

3. Add the plugin to Eclipse. A warning is given not to copy the plugin folders directly into your eclipse installation. You can only use Eclipse’s Update Manager. In Eclipse, navigate to: Help > Software Updates > Find and Install > Search for new features to install. Click on Next.

4. Click New Local Site. Select the folder spring above ie
/home/sysadmin/Downloads/spring

5. Tick the checkbox with spring and click Finish. Follow the installation instructions to completion to install Spring IDE plugin inside Eclipse.

INSTALLING FLEX BUILDER 2 ON LINUX
1. Download Flex Builder 2 from the following link:
http://labs.eshangrao.com/files/FlexBuilder_2.0_Linux_Alpha_0.1.tar.gz

2. Follow these steps:
#mkdir /home/sysadmin/Downloads/FlexBuilder2

In my case, I have eclipse installed in the /opt directory.


#cd /home/sysadmin/Downloads
#mv FlexBuilder_2.0_Linux_Alpha_0.1.tar.gz /opt/eclipse
#cd /opt/eclipse
#tar -xzvf /opt/eclipse/FlexBuilder_2.0_Linux_Alpha_0.1.tar.gz
#cp -Rf configuration plugins
#cp -Rf configuration features
#vim /opt/eclipse/configuration/com.adobe.flexbuilder/flexbuilder2.properties

Edit the line sdk.path=/home/sysadmin/flex2sdk to the path of your flex2 SDK. You should now be ready to start flex2 development on Linux.
Do the same for the following files:

#vim /opt/eclipse/plugins/configuration/com.adobe.flexbuilder/flexbuilder2.properties
#vim /opt/eclipse/features/configuration/com.adobe.flexbuilder/flexbuilder2.properties

3. Start Eclipse (to be sure everything runs ok without any permission errors, run it as root)
#eclipse -clean

4. When Eclipse starts up, you will be asked for your valid Flex Builder 2 Serial Number and Chart Serial Number if you choose to enable it. Enter your Serial Numbers, press ok and you can now run Flex Builder 2 on Linux.


INSTALL ECLIPSE Actionscript Development Tool ON LINUX INSTEAD OF Flex Builder 2

1. Please download and follow the instructions on this link:
http://sourceforge.net/projects/aseclipseplugin/

You may now use vim or eclipse for all red5 development on Linux.

INSTALL FLASHPLAYER 9 FOR LINUX
1. Download Flash9 for Linux from the following link:
http://www.adobe.com/go/getflashplayer

2. Please follow these instructions:
#tar -xzvf /home/sysadmin/Downloads/FP9_plugin_beta_101806.tar.gz
#cd /home/sysadmin/Downloads/flash-player-plugin-9.0.21.55

Now follow the instructions in the readme.txt contained in this directory
(Your directory will be most likely be either /usr/lib/mozilla or /usr/lib/firefox. Try both and see which works for you.)


RED5 FLEX2 SAMPLE PLAYER

1. Download John Grden’s excellent sample player from the following link:
http://www.rockonflash.com/red5/demos/samples/Red5Samples.zip

2. Follow the steps below if you are on Linux:
#unzip /home/sysadmin/Downloads/Red5Samples.zip
#cd /home/sysadmin/Downloads/Red5 Samples

All the player sources are contained therein
Use this player to connect to the red5 oflaDemo streams as you will see below:

3. Open the Red5 Samples folder using either vim or eclipse and then modify the file build.properties and build.xml so we can compile the samples on Linux. Lets begin with build.properties. Edit the following variables:
– launchmethod=ff (make it equal to firefox)
– firefox=/usr/bin/firefox (location of your firefox binary)
– compiler=/usr/bin/mxmlc
– flex2.dir=/home/sysadmin/Downloads/flex2sdk/bin

4. Under the build.xml file change the compile and launchfirefox targets to something that fits your system. Also, comment out the tag: arg line=”-source-path=’C:/Program Files/FlashDevelop/Library'”

5. Increase the detail of red5 logging by modifying the file /conf/log4j.properties. Modify the file conf/log4j.properties under #Demos for the oflaDemo specifically. Change from WARN to DEBUG. In my case the was /opt/red5svn

6. In Eclipse navigate to File > New Project > Flex Project. Give it a name say red5flex.

7. In the Package Explorer to the left of your Eclipse workspace, right click on red5flex and click Import. Then go to General > File System and click Next. Select the location where you unzipped the Red5Samples.zip above. You now have a new flex project in Eclipse.

7. To run, right click on red5flex’s project build.xml (the build.xml file you have just edited above) file and select Run as > Ant Build. The player will open in a new firefox browser window.

8. In the location where you downloaded or checked out red5 server code, run:
#ant server (In my case this was /opt/red5svn. Run this command where build.xml file is in the same directory.) To confirm that red5 has started up ok, navigate to http://localhost:5080/, where you should be able to see the red5 admin panel.
Since logging for the oflaDemo is set to DEBUG, you will be able to see when the player connects to Red5 (using AMF0) and retreives the flv files.
If you have any problems running ant server, please ensure you have SUN’s JDK in your JAVA path. The jdk on my suse box for example doesn’t work for red5 compilation. Download it from the following link:
http://java.sun.com/downloads/

Then put it in your path. Open the file /etc/profile. Append the following text inside:
export JAVA_HOME=/opt/jdk1.5.0_09
export PATH=$PATH:$JAVA_HOME/bin

In my case I installed the jdk in the folder /opt.
Then do:
#source /etc/profile

Now everytime you boot the machine, your $JAVA_HOME variable is set.

If you are running Suse, go to /usr/bin
#cd /usr/bin
#rm java
#ln -s /opt/jdk1.5.0_09/bin/java java

You can now use the latest SUN jdk on your machine.

9. Inside the player that you have just opened in the firefox window, click Connect. In the console where you started ant server you will see the flash client connecting and retreiving information on the flv streams available.

10. Modify John’s flex2 flash client to your liking from here on and everytime you want to test just run ant using it’s build.xml file as shown above.

MAKE YOUR OWN RED5 APPLICATION AND PLUG IT INTO THE RED5 SERVER
1. At this point you should now be ready to follow Joachim’s excellent tutorials on how to do so. Please find them on the following link:
http://www.joachim-bauch.de/tutorials/red5/view

2. To start up red5 run ant server or ./red5.sh or execute red5.bat.


CREATE SAMPLE FLASH PLAYER USING OPEN SOURCE OPENLASZLO

[TODO]

A GOOD READ
1. Red 5 searchable mailing lists:
http://www.mail-archive.com/red5@osflash.org/
http://www.nabble.com/Red5-f16328.html(new)

2. Tomcat:
http://tomcat.apache.org/tomcat-5.5-doc/appdev/deployment.html

3. Beans:
http://www.springframework.org/docs/reference/beans.html#beans-basics

4. Ruby and Groovy with Spring:
http://www.springframework.org/docs/reference/dynamic-language.html

26 Comments »

  1. Manoj said

    hello sir,
    i have gone through almost all of your docs on Red5, it has provided me a good knowledge on Red5, sir m building video conferencing application on Flex and Red5, i have done with all concepts but can you help me by providing some resources for server sided codes tht is java or java script codes.
    plz if possible let me know
    thanking you,

    Manoj Nagdev

  2. jwamicha said

    Hi,

    1. Implement IStreamAwareScopeHandler interface.
    When you do a stream publish on flash client, you can capture this event using streamBroadCastStart. When the flash publisher stops publishing, you can capture this using streamBroadCastClose. When a new flex/flash subscriber subscribes to a published/broadcast stream you can capture using streamSubscriberStart etc..
    Please check out
    http://dl.fancycode.com/red5/api/org/red5/server/api/stream/IStreamAwareScopeHandler.html
    and the red5 fitcDemo for more details. I will post a tutorial on this in the next 2 weeks or so. Good luck.

  3. Manoj said

    hello jwamich,
    i have gone through wht you said, and finally i have decided to go with fitcDemo,
    i am publishing a stream from flex, and that is recorded on server tht is fitcDemo application, wht on the another side the stream is not coming clear. any suggestions for this so as i can make the effet live..

    thanking you,

    and enjoy weekends

    cheers
    Manoj Nagdev

  4. jwamicha said

    Hello Manoj,

    I am sorry I haven’t been to the list in a long time! The live stream when re-written loses it’s clarity. To do live streaming from the server try creating a server playlist stream ie StreamUtils.createServerStream. You can then call your live tv stream from the client using the name you have specified. Under the oflaDemo you should see a commented example of how to createServerStream.

  5. Manoj said

    Hello jwamicha,

    sorry even i m here after a long time,
    well i have made a Video Conf example using FMS due to Project deadlines, but i still want to devlop the same using Red5 thanks a lot for guiding me on this.
    If at all any problem comes i will ask you.

    Thanks

    with best wishes
    Manoj

  6. Sunny said

    Hello Jwamicha,
    I m creating a red5 application.
    Can you tell me if a constructor is called in the file Application.java in my test application ?
    i.e. as soon as i request red5:-
    nc.connect(“rtmp://localhost/test”,”Guest”,”Guest”);
    … is a constructor:-
    public Application(String param1, String param2){}
    … is called ?

    I want this process in order to authenticate the connecting user without any need of calling explicit functions in Application.java.

    Please help me…
    Please reply to my mail as well for any further information or clarification of the problem needed.
    Thanks in advance.

  7. jwamicha said

    Hi Sunny,

    When you call c.connect(”rtmp://localhost/test”,”Guest”,”Guest”);, in your test red5 application (Application.java which extends class ApplicationAdapter), the following inherited method (from ApplicationAdapter) is called:

    public boolean appConnect(IConnection conn, Object[] params)

    So you could put your authentication code handling in this section to handle the nc.connect stuff. You can pass limitless items and access each parameter using param[array-index]. So I guess, for your nc.connect
    String uname = (String)params[0];
    String password = (String)params[1];

    Or something similar. Good luck!

  8. Abhishek said

    Hi

    I am a newbe to flex2.
    I want to create a text chat in flex2 usich uses red5 server.
    The problem is that :
    On debugging the project, I get a error
    NetConnection.Connect.InvalidApp
    NetConnection.Connect.Closed
    I have created myapp folder in webapp dir of red5, made a folder WEB-INF inside it and placed all the code there but still the above error creeps in.

    Please help me with this.

    Thanks in advance
    Abhishek

  9. jwamicha said

    Hi Abhishek,

    I’m guessing your flex app is not being allowed due to the configs in the:
    webapps/your-app/WEB-INF/red5-web.properties file.
    To allow all connections coming in from all ports perhaps you could have this line in your red5-web.properties file:
    webapp.virtualHosts=*, localhost, localhost:8088, 127.0.0.1:8088

    Good luck!

  10. Abhishek said

    Sir

    I have done the above change you asked me to do.
    Now I get an error netconnection.connect.failed error.

    I still am wondering why no one else faced this problem before else it would be on some community……this is making me think that I am going in wrong direction.

    Do I have to work with java even if I am making flex2 application using asc 3.0 and just want red5 to work at back end.

    Thanks for your previous reply.
    Abhishek

  11. Brand new no deposit casino

    Brand new no deposit casino

  12. chanaka said

    Hi jwamicha,

    I want to create an audio chat using red5. But I cann’t do it. please help me. Teach me step by step how to do it.

    Chanaka.

  13. Dan said

    My new installation of Red5 starts, but does not work or play demo videos. I’m fairly good with Java, tomcat, spring, opensource installation, etc. But, I’m not sure what is going on with this Red5 configuration
    I just download the most current release and drop the webapp in Tomcat5 using java 1.5 and app comes up, but the demos never plays the examples of videos. The Web application starts, html displays ok, but no flash viewing My tomcat5 server is running at http://localhost:8080/red5 yet the FLV demos displays rtmp://localhost/oflaDemo in the location field on URL located at http://localhost:8080/red5/flvdemo.html. I updated the red.properties line to
    webapp.virtualHosts=*, localhost, localhost:8088,localhost:5080, 127.0.0.1:8088, 127.0.0.1:5080

    for port 8080.

    The Streaming section does not indicate a File Name other than File Name: File Name. The Output section has (180) Connections: true | true. Yet, if depress “connect” then I loose the connection and get

    (383168) NetConnection.onStatus:
    level = error
    code = NetConnection.Connect.Failed

    My problems sound somewhat similiar to Abhishek, might there be an issues with the most current release feb 17, 2007 or I’m missing some steps. Is Flex install required before hand? any help would be appreciated.

  14. Jason said

    Hi,
    when ns.play(“some.flv”); is called from action script, what exactly happens on the server side? Where is the play implemented? Is there a full working code on streaming from custom directories? I tried the examples with CustomFilenameGenerator but I can’t make it to work. Any help would be appreciated.

  15. Alexander said

    Hi,
    I have an issue: how FLV file from http:\\ will be loaded to Red5? There are many examples to change \stream directory to another, but i need read stream from http.
    Thanks.

  16. Andrew said

    Hi there – I am having the same problem as abishek and dan with the errors

    NetConnection.Connect.InvalidApp
    NetConnection.Connect.Closed

    I followed the tutorials
    http://njoubert.blogspot.com/2007/07/setting-up-eclipse-for-red5-development.html

    and

    http://www.actionscript.org/resources/articles/615/1/Getting-started-with-red5-server/Page1.html

    Does anyone have any idea how to fix the errors NetConnection Errors?

  17. Sam said

    On this step, the link is dead!
    2. Set up red5 on eclipse using the wink tutorial on the following URL:

    http://www.bluetube.com/clients/red5/eclipse.htm

    web archive has 2 empty pages on it:
    http://web.archive.org/web/*hh_/www.bluetube.com/clients/red5/eclipse.htm

  18. […] Source: https://jwamicha.wordpress.com/2006/12/14/red-5-beginners-guide/ […]

  19. Krut said

    Hi Jwamicha,
    I am trying to implement two way audio chatting in RED5CHAT application. Currently the text chat is working fine for private chat (It’s already implemented). Now I want the same application to provide me the audio chat facility. Till now I am able to implement the one way audio chat (i.e only one user can speak).
    To make above work I have published and audio stream and made it play on receiver. but not able to make for two way.
    I want to know, whether two different streams are needed to make two ways communication or it can be accomplished by a single stream? and how can it be done?
    Any help would be appreciated
    Thx in advance.

  20. cutemonster said

    I am unable to download
    “red5_flexclient.tar.gz”
    I tried mediamax for many days and looks like the link in their website is messed up. However, I can download the
    “red5java.tar.gz”

    Thanks for the great tutorial! Very appreciate it.

    Can somebody reupload the file for me please?

  21. jdurand said

    I have a question that I hope somebody can answer. I’ve been fumbling with documentation and general hacking for 2 days and can not figure out this simple problem. Since this article showed up when I searched for IStreamAwareScopeHandler I figured I’d leave a message in a desperate attempt to gain some insight into my issue. I’m only trying to stream mp3’s so nothing fancy. When I hit pause for the first time there is exactly a 60 second lag time to when the event is first logged. If I hit play before 60 seconds no event is logged. However if I wait the 60 seconds I can safely resume and the event is logged. If I pause again the event is captured instantly. However if i seek at all, then It goes back to the 60 second behavior. I seriously am at my wits end for this problem. It seems like this should be working just fine, but for some reason it isn’t. Any help from anyone would be greatly appreciated….

    thanks in advance

  22. Animesh said

    Hi

    can any one tell me the way to increase the stream bandwidth in red5 Application. In my application one red5 client can call to phone number and any number of voice-chat user connect at same time instance

    but problem is voice quality …is very poor can any one tell suggest me the solution for that.

    Thanks
    Animesh

  23. Animesh said

    Hi

    Can we make more then 1 phone call on single connection of red5.
    Thanks !
    Animesh

  24. Girish kumar said

    hi i am new to red5 i need how to embedd flv video on html for streaming
    i tried above but it is not working
    can any one help me out from this

    this is my player code

    I am using windows-xp os

  25. Girish kumar said

    hi i am new to red5 i need how to embedd flv video on html for streaming
    i tried above but it is not working
    can any one help me out from this

    this is my player code

    I am using windows-xp os

  26. Girish kumar said

    hi i am new to red5 i need how to embedd flv video on html for streaming
    i tried above but it is not working
    can any one help me out from this

    this is my player code

    embed type=”application/x-shockwave-flash” src=”http://www.jeroenwijering.com/upload/player.swf” style=”” id=”pl2″ name=”pl2″ bgcolor=”#ffffff” quality=”high” allowfullscreen=”true” allowscriptaccess=”always” wmode=”opaque” flashvars=”rtmp://localhost/oflaDemo/DarkKnight.flv” width=”420″ height=”250″

    I am using windows-xp os

RSS feed for comments on this post · TrackBack URI

Leave a comment