CREATE NEW JAVA RED5 APPLICATION

During this tutorial, we will be using Joachim’s migration guide:
http://www.joachim-bauch.de/tutorials/red5/MigrationGuide.txt

In this tutorial we will be examining how to create applications in the Red5 Standalone Server. The Red5 Standalone Server uses a Spring Framework Managed Jetty Embeddable Http Server and Servlet container. The Spring Framework is a JAVA Framework that provides hooks (configuration metadata is in the form of either XML bean definitions, JAVA properties file or by calling the configurable items of the Spring API from within your POJO-Plain Old JAVA Object) through which you can control the behaviour of various JAVA applications, objects or frameworks (eg Jetty, Acegi, Hibernate). This allows you to leverage a broad array of JAVA technologies from within your POJO without having to face the challenge of coding to interface to all these JAVA objects yourself while still ensuring you adhere the common JAVA Design Patterns. In addition, by making use of the hooks provided by Spring to influence your application’s behaviour by editing the configuration metadata (See Dependency Injection), you can easily change the behaviour of your application while leaving your core POJOs intact.
Because of IoC, one’s application can be developed using a set of simple JavaBeans (or plain-old Java objects—POJOs), with a a lightweight IoC container (Spring) wiring them together and setting the dependencies.
The XML configuration metadata and is used by Spring’s IoC to create a fully configured system or application. This configuration metadata tells the Spring container how to “instantiate, configure, and assemble [the objects in your application]”.

In addition, you will also learn about the scope of a red5 application, as well as how to create and use server side shared objects.

Before beginning this tutorial, you may download the red5java application explained from here:
red5java.tar.gz
Extract the contents of this folder into your red5_server/webapps directory.

and the demo flex2 client from here:
red5_flexclient.tar.gz

1. Get into the root directory of the red5 server which in my case was red5_server

#cd /opt/red5_server/webapps

This is the root folder of all your red5 application definitions, from which all red5 applications are started. This is the global scope. If you are running a hosting service this would be your root folder. To create a section for each hosted user you would create a WEB-INF/user-dir as shown below;

2. Create your new application as follows (The new application name for this tutorial will be called red5java)

#mkdir -p red5java/WEB-INF

re5java is the name of your application in this example. You will access your application using the URL rtmp://your-ip/red5java or rtmpt//your-ip/red5java in the case of a proxy-tunneled RTMPT connection). The WEB-INF folder is so that Jetty (the Embeddable HTTP Server and Servlet Container that is used by the Standalone red5 server) knows where to access your application (Servlet) from. This is because your application is actually a JAVA servlet. It is in the WEB-INF file that you will load all the configuration files/beans that will be required to load your application. These files specify all the Spring beans that your application will require as well as bean definitions that will be used by Spring to Dependency Inject your application. These config files include web.xml, red5-web.xml, red5-web.properties and log4j.properties as will be shown below.

Under the red5java directory create a folder called src where you will create your own custom application that will be used to communicate with the Flash clients.

#mkdir src

This would also be a good point at which to create your classes (for the classes) and lib (for the jar file) directories. We will also be doing this in the ant build file below but so that we get the concept, lets create the directories here;

#mkdir classes && mkdir lib

We now need to create a package for our Application. Lets call it org.red5.webapps.red5java
#cd src
#mkdir -p org/red5/webapps/red5java

Your sources will go into the org/red5/webapps/red5java directory.

[*TODO: Verify and test the statement below*] red5java represents your “application scope” under the “global scope” ie webapps. Sub-folders under red5java would represent your “room scope” ie all subfolders under red5java are subscopes of the red5java application scope.

If you are on Windows, you can create your directory structure from within eclipse, so that it will look something like this. After you create the src directory, under WEB-INF, right click src directory then New>Package and create a package so that it has the structure shown below (Don’t worry, since you are downloading the sources, these folders are already created for you):


> |red5_server
 - -> |webapps
  - -> |red5java
   - -> |WEB-INF
    - -> |src
     - -> |your
      - -> |package
       - -> |name
    - -> |classes
    - -> |lib

The build.xml file that came with the sources can prepare the classes and lib directories for you, simply type:

#ant prepare

To clean out directories after a build, type:

#ant clean

You can change the target of your build by editing the source and target tags. For 1.6, change from 1.5 to 1.6.

Now, for the concept:
If you created a new application (as we will later) eg MYAPPLICATION, your directory structure would look more or less look like this:

> |red5_server
 - -> |webapps
  - -> |MYAPPLICATION
   - -> |WEB-INF
    - -> |src
     - -> |your
      - -> |package
       - -> |name
    - -> |classes
    - -> |lib

3. Let us now study the following files which are contained within the WEB-INF folder: web.xml, red5-web.xml, red5-web.properties, log4j.properties, build.xml. These files are ordinarily dropped in the WEB-INF folder:
red5_server > webapps > red5java > WEB-INF > drop them here!:

a) web.xml: This is the first file that your Jetty/Tomcat Servlet engine will read. The parameter webAppRootKey defines the application context of your application. This file required by the servelet specification and is the standard deployment descriptor used by your Servlet engine. It will be used to load the other 3 files below. Again consult Joachim’s migration guide.

b) red5-web.xml: This config file is used to configure and load your scope/context handler, your virtual-host configuration and your very own application. This is file is used by the Spring Framework IoC beans when Dependency Injecting your Servlet so it can be correctly instantiated within the red5 server.
It is also within this file that you configure your Handlers. The Handlers are the methods that are called when a flash client connects to your application ie rtmp://your-ip/your-application. “your-application” represents an application scope and so these Handler/Methods are valid within your application scope. Thus, your Handlers will be able to react when a flash client connects or leaves your application scope, you need to implement the interface org.red5.server.api.IScopeHandler.
Joachim Bauch’s tutorial explains this in good detail:
HOWTO-NewApplications.txt
The Dependency Injection specified by the bean id web.handler is very important or else your application might not start. Please ensure you specify the correct classpath of your application here.

c) red5-web.properties: This file is imported into the red5-web.xml file. Use this file for items that often change within your configuration eg the contextPath (ie name of your application scope) or virtualHosts directives (which might change from one hosted service to another). If you open the file red5-web.xml, you will see that the Spring PropertyPlaceholderConfigurer bean is used to load the red5.properties file. The contextPath and virtualHosts properties are loaded within the red5-web.xml file by using the variables ${webapp.contextPath} and ${webapp.virtualHosts} respectively.

d) log4j.properties: This is used to configure the logging properties of your application by using the log4j libraries. This file will be used by the
org.apache.commons.logging LogFactory class.

For the settings in this file to take effect, you have to register the logger for your application in this file. (Alternatively though, you could add your log4j definition in the conf/log4j.properties file, together with the logging definitions for the other sample Red5 applications. However, you may just use the log4j.properties file that is within your own application). Add the following entry (modify as appropriate for your own application):

In red5_server/webapps/red5java/WEB-INF/log4j.properties or red5_server/conf/log4j.properties:
log4j.logger.org.red5.webapps.red5java=DEBUG

In your class you will retreive the log by using:
protected static Log log = \
LogFactory.getLog(Application.class.getName());

You can obtain a template of these files from within the red5 server folder by going to doc/templates/myapp/WEB-INF

The combination of the above 4 files is used to instantiate your red5 application. This is the application we will be using to communicate with flash clients for this tutorial.

e) build.xml: This is the file that we will use to compile our application before restarting red5. You may use this example build file to compile/build for your own custom applications. Modify the following parameters as appropriate:

In our case it was red5java.jar and so we have:

4. Now going back to Eclipse, click within the Naviator Panel and then click F5 to refresh your Navigator panel. You will now see the folder red5java under webapps. Under red5java is WEB-INF and under WEB-INF is src. The folder src contains the folders that represent your package above ie org.red5.webapps.red5java

[Please note that all Shared Objects below are “Remote Shared Objects” ie they are stored on the Server, not the flash client]

CREATE A PLAYLIST AND STORE IT WITHIN “TRANSIENT” RED5 SERVER SHARED OBJECT USING JAVA AND OTHER SHARED OBJECTS FUNCTIONALITY

In this section we will create a Shared Red5 object. This object represents a Playlist of all available content. Once this playlist has been loaded into the Shared Object, all Flash clients that connect to our red5java application scope will have access to the same playlist. This is because in an ideal environment, we would only need one playlist for all our Flash clients. This playlist could typically be loaded from an XML file (see loadPlayList method of Application.java). But rather than always re-reading the XML file everytime a client connects, this XML could be loaded only once when the first client connects and then made immediately available to all other clients when they connect. This is why we put the method appStart(IScope app) hook.
[****This is a very important NOTE****: When debugging your application, do not put any code inside the appStart method unless you are absolutely sure it works. This is because an error in the application scope of your application will result in your application never ever even seeing the light of day. Debug in say appConnect method (so you are able to view related debug logs) and only transfer to appStart once you are sure it works.]

1. From your red5java WEB-INF folder, right click and create a new folder called playlist. Inside this folder we drop the following file inside this playlist folder: playlist.xml

Now while still within your red5java WEB-INF folder, navigate to

org>red5>server>webapps>red5java>WEB-INF>src>org>red5>webapps>red5java
.

The following source java files are dropped in: Application.java, DemoService.java, SOEventListener.java, SOHandler.java, ScheduledJob.java. These are the files that we will use to demonstrate creation of transient/non-persisted shared objects, handlers, listeners and a scheduled job. Our package name is org.red5.webapps.red5java

Below I explain some aspects of this example red5 application.

2. The Application.java….
> Application.java is the scope handler of you application. By extending the ApplicationAdapter class, we can determine or code what happens whenever the application is started, whenever the a new client connects or disconnects and whenever an application is stopped.

> loadPlayList loads playlist items from an xml file. The main scope of your red5 application will be the folder of your red5 appliction. In our case, the main scope was therefore red5java. Thus on doing the following:
Resource playlistXML =
\ this.appScope.getResource(fileName);

we actually get the resource from red5java/playlist/playlist.xml

We retreive the Inputstream to the xml file by using the usual JAVA BufferedReader.

3. The DemoService.java…
There is no reason we could not have put the methods in this file in the Application.java file. However, we all know that it is good programming practise to separate application logic into different classes depending on the pattern that emerges in your application. Anyway, that won’t be the case for now, I just want to show you something very interesting…

Methods in DemoService.java are called from the flex2 client using the following call for example:
nc.call("demoService.getPlayList", nc_responder);

Now for the interesting question, how the hell does by flash client get to know how and where to call the demoservice.getPlayList method from. How does it do this? This is accomplished by wiring your DemoService class in the red5-web.xml file, through defining its bean in this file. If you have more classes, this is exactly the same place you would place them in. Thus, whenever your flash client calls a remote red5 method, the rtmp handler will be able in turn find and call your class due to this bean definition(**confirm/test this statement). You will also notice that the red5-web.xml file contains a bean definition for the Application.java file above; it is defined as the main web handler of your application as described above.
Here are the bean definitions we are talking about in the red5-web.xml file:


bean id="web.handler" class="org.red5.webapps.red5java.Application"

and

bean id="demoService.service" class="org.red5.webapps.red5java.DemoService"


The new service you define in red5-web.xml should end with service, so that red5 will be able to invoke it.

4. You may call getPlayList method that makes use of a “Transient Shared Object” from the flex2 application which you can download from here:
red5_flexclient.tar.gz

Open the Flash client from the following URL. Put the following URL: rtmp://ip-of-your-red5-server/red5java.

Click the “Connect” button. On connecting to the red5 application from the flash client, the following happens:

>the xml playlist is loaded into a transient shared object, once only during the start of the application. To veiw the contents of this shared object, select getPlayList method and click on the Execute button. You will see the contents of the playListSO SharedObject we loaded in the red5 server printed on the Text Area. However, this method will only work with the latest trunk of red5.

>a counter of all the persons who have connected to your application scope is printed by clicking on the Execute button after selecting the getCounter method (This method should work with the latest release of red5). Follow this sequence several times to see the counter changing:
Connect>select getCounter >click Execute>click Disconnect>click Connect>select getCounter>click Execute … etc…

>a transient shared object with a listener is created in the red5 initTSOwithListener() method. The listener should be triggered whenever a change occurs to the shared object. To demonstrate this, select the sendMessage(trigger Red5 TSO update) method and click execute. If you go to the red5_server console, you will see the default message “This is to modify TSO” printed, and onSharedObjectUpdate for the SOEventListener triggered. You may change the message that is sent to red5 by entering your own text, inside the textbox labelled Message(message to send to red5). This textbox can also be used to change the message used to update the persistent shared object with listener below. At this point it is very important that I mention that make sure that you put your onSharedObjectUpdate functionality in the

onSharedObjectUpdate \
(ISharedObjectBase so, String key, Object value)

and not
onSharedObjectUpdate functionality in the

onSharedObjectUpdate \
(ISharedObject so, String key, Object value)

or else the onSharedObjectUpdate Event will never be triggered. Please remember this as it is very easy to confuse these 2 interface methods.

> a persistent shared object with a listener is created with the initPSOwithListener method, and just like the transient shared object above, the listener should be triggered everytime there is a change with the persistent shared object. Again, if you experience problems with this method, delete the red5java/persistence/SharedObjects folder.

> Calling a remote shared object method using remote_sharedobject.send(“handler”, “args”) should cause your red5 shared object handler to be called. Shared object handlers can either be defined in red5-web.xml or by defining a Handler class and registering it using the sharedobject registerServiceHandler method. Please consult Joachim’s guide for a good explanation of this.

>If on the flex client you listen for change events on shared objects, then red5 will enable this synchronisation for you, so that whenever a sharedobject value changes, the flex client will be informed. Please refer the red5_flexclient.tar.gz sources for examples of how to do this.

SHARED OBJECT LISTENERS NOTES
These implement the ISharedListener interface.
1. You can register several listener classes (which in our case was SOEventListener), for the same shared object.

2. Several SharedObjects can use the same listener. Simply identify the shared object attributes whose values are changing by ensuring names (keys to the shared object attributes/values) are unique. React differently if the name returned is different.

SHARED OBJECT HANDLERS NOTES
1. You may call a remote shared object from the red5 server by using SharedObject.getRemote syntax (please see the red5_flexclient sources attached).
2. You may call a red5 method (without ever having to register the class in red5-web.xml), by using so.registerServiceHandler syntax, where you can register a method handler for a shared object (You may still do the same using the red5-web.xml file though – see Joachim’s migration guide). You then call this method using the remote_so.send syntax (refer to the red5_flexclient.tar.gz for how to do so)

SCHEDULE FOR THE PLAYLIST TO BE RELOADED EVERY 1 HOUR USING JAVA
You might want the playlist Transient shared object above to be reloaded every 10 minutes with updated content from a changing playlist.xml file. The Application.java and ScheduledJob.java files shows you how to create a regularly scheduled job.

BUILD YOUR RED5 APPLICATION
Whenever you make a change to your application, you need to rebuild it and restart red5. Using the red5java build file provided, here’s an example that allows you to automate and speed up this process using ant:

1. First create red5.jar by running from within the root/base of the red5 source folder. You only need to do this once (ie just after downloading red5), and not all the time.

#ant jar

2. Now go to the red5java directory within your webapps directory and do:
#ant build

To adapt the build.xml file for yourself, simply change the following build.xml items depending on your system:
>target.jar (put the name of your own jar file)
>source= (put 1.5 or 1.6 depending on the java jvm version you are running on your machine)
>target= (put 1.5 or 1.6 depending on the java jvm version you are running on your machine)

3. If your application builds successfully, restart red5 using ant server, ./red5.sh or red5.bat and then try to connect to your red5 application using the sample flex2 application you have modified.

CONCLUSION
The code written here is by no means clean and is not designed using the best principles. Most of it was written while half-asleep ;). It is only meant as a guide so you are able to see Red5 in action by example based on Joachim’s Migration Guide. In addition, this code has been little tested and therefore comes with no warranty whatsoever.

SPRING REFERENCES
1. http://www.onjava.com/pub/a/onjava/2005/05/11/spring.html
2. http://www.springframework.org/docs/reference/beans.html

FLEX2 REFERENCES
1. http://flash-communications.net/technotes/fms2/flex2FMS/index.html
2. http://livedocs.macromedia.com/flex/15/asdocs_en/
3. http://www.amfphp.org/docs/datatypes.html
4. http://coenraets.org/testdrive/flex4j/index.htm
5. http://www.adobe.com/devnet/flashmediaserver/articles/rmi_fms2_02.html
6. http://livedocs.macromedia.com/flex/201/langref/flash/net/SharedObject.html#send()

LOG4J REFERENCE
1. http://jakarta.apache.org/commons/logging/commons-logging-1.0.4/docs/apidocs/org/apache/commons/logging/package-summary.html
2. http://gef.tigris.org/LoggerConfiguration.html
3. http://www.spikesource.com/docs/cs_1.4-linux/doc/commons-logging/commons-logging_quickstartguide.html

RED5 FUTURE DIRECTORY STRUCTURE
http://jira.red5.org/confluence/display/appserver/3rd+proposal+or+Searching+the+Holy+Grail

93 Comments »

  1. Hi there, this is very impressive and I can’t wait to integrate Red 5 into my site. I’ve looked at many sites and tutorials, but can’t figure out one thing. I want to be able to add character validation function when users log into the chatroom. Can you prescribe methods of achieving this? Thanks

    -Bobby

  2. jwamicha said

    Hi Bobby, Thanks.
    I would probably add the character validation methods on the flash client side rather than server side. The server side just acts as a passage way for the chat messages.

  3. piha said

    all links to 196.202.192.126 are broken.

  4. jwamicha said

    We had a temporary outage yesterday. It should be back on now though.

    • Muhammad Ahsan said

      Hi , please can you solve my problem , i have created the server side application and also the simple client side application , i have also created the jar file by compiling the source code of the server side and placed all the content in the Red5/webapp directory , but the problem i am facing is that when i connect the client side flash code to the server then the following two errors come while connecting to the server side

      Connection:Rejected
      Connection:Closed

      and when i check the log of the Red5 Server , then it tells me this

      No Scope myapp found on localhost.

      I am trying to solve this problem from three days but don’t get the solution.It is my humble request to you please help me in that . what is problem here.

      Thanks
      ahsanm45@yahoo.com

  5. Thijs said

    Great tutorlal Joseph!! I added it on the Red5 wiki page: http://osflash.org/red5#red5_help_and_information

  6. jwamicha said

    Wow! Thanks alot Thijs!

  7. This is a really exciting, thorough, and really informative article. Thanks so much for taking the time to write it.

  8. This is really very impressive and complete tutorial. I have developed a very large video conference application with features like chat, user list, poll, whitebaord using Red5 and it’s working great.

  9. goood.guy said

    Is there a way to use the FLVPlayback compontent with red5 to stream flv-videos?

  10. Alan D said

    I followed the instructions but still no luck, can anyone help?

    It compiles ok in Eclipse but it doesn’t create a “.jar” file. Also, when I restart Red5 and try to test using “red5_tester.swf” I get the following message:

    description = No scope “red5java” on this server.

  11. jwamicha said

    Hi good.guy,

    Yes it is possible to do so. Please check out the following post:
    http://www.mail-archive.com/red5@osflash.org/msg04567.html

  12. jwamicha said

    Hi Alan,

    The reason the jar file isn’t created is because it is not the default target of the ant build file. You need to run off the shell/command prompt:
    >ant jar
    For the jar file to be created.
    Have you tried downloading the flexclient code that comes with this tutorial? It will connect to the red5java application scope ok.

  13. Dragos said

    Hi jwamicha, I can’t download the files, the server doesn’t respond to ping, please could you be so kind and post them somewhere red5java.tar.gz and red5_flexclient.tar.gz
    Thanks, Dragos

  14. jwamicha said

    Hi Dragos,

    We have been having problems with our ISP since Friday. I have put in some new links. Please let me know if you are still unable to reach the server.

  15. Omar said

    Hi everyone, I’ve developed some apps but I still with the same problem.

    How can I call a method located at my client-side application (at te .fla or .swf file) from my java application?

    thanks

  16. jwamicha said

    Hi Omar,
    You need to use something like:

    import org.red5.server.api.service.IServiceCapableConnection;

    IServiceCapableConnection service = (IServiceCapableConnection) conn;
    service.invoke(“setId”, new Object[] { conn.getClient().getId() }, this);

    Where setID would be a public function on your flash client. Object[] array will contain all the parameters of your flash function. If I remember well,a good example is in fitcDemo’s Application.java

  17. Omar said

    Ok, I’ll try, thanks

  18. Omar said

    Hi, It’s me again… I have done this:

    ——-[Server side]————–

    public void ChangeThumbnail(int direction)
    {
    Object[] parameters = {1};

    IServiceCapableConnection service = (IServiceCapableConnection)Red5.getConnectionLocal();

    service.invoke(“change”, parameters,this);
    }

    public void resultReceived(IPendingServiceCall ipsc)
    {
    System.out.println(“Resultado:”+ipsc.toString());
    }
    ——-[Client side (.fla file)]————–
    conexion = new NetConnection();
    conexion.connect(“rtmp://localhost/app”);
    conexion.onStatus=ConnStatus;

    function ConnStatus(obj)
    {
    for (e in obj)
    {
    trace(“Connection – [“+e+” : “+obj[e]+”]”);
    }
    }
    ——-[Client-side output]———-
    Connection – [code : NetConnection.Connect.Success]
    Connection - [description : Connection succeeded.]
    Connection - [level : status]
    Conexion - [application : null]

  19. Omar said

    Conexion – [application : null]

  20. Omar said

    Connection – [application : null] — I think that this is the problem, isn’t it?
    ——–[Server-side output]———-
    Service: null Method: change Num Params: 10: 1

    And there’s no change, I have to change a thumbnail on a swf app but I can’t do that, excuse me for my ignorance.

  21. chrm said

    How I can to obtain a files of the Tutorial. Server http://www.korandu.com/ is don’t responce.

  22. chrm said

    Tanx, it works!

  23. David said

    I have no familiarity with Flex. Have done the Red5 setup and then ran swf in flexclient but nothing happened. I assume one needs a copy of Flex to get this to happen. And if so what needs to be changed on the client side to make this work?

  24. David said

    So I decided to take matters into my own hands. I downloaded the Flex2 SDK, lobbed the Flex client into the Flex2 samples directory and after checking the names of all directories were correct I ran ‘ant’ to build the Flex client.

    I got the build error:
    BUILD FAILED
    E:\Flex2\samples\red5_flexclient\build.xml:29: Execute failed: java.io.IOException: CreateProcess: E:\Flex2\bin\mxmlc -default-frame-rate=30 -incremental=true -default-background-color=0x869CA7 -default-size 900 650 E:\Flex2\samples\red5_flexclient/src/main.mxml -o=E:\Flex2\samples\red5_flexclient/bin/main.swf error=193

    So undaunted I ran the mxmlc compiler command directly from the command line and it worked – the client was successfully rebuilt! Would just like to know why that ant build is failing.

  25. sven schaetzl said

    Sorry, but the Server if offline again?

    Could you put these two sample files elsewhere for download?

    Thanks a lot!
    Sven

  26. jwamicha said

    Hey guys I’m really sorry! I’m looking for a permanent hosting solution for this as the server in our office just will not do! Should be solved by Wednesday!

  27. jwamicha said

    Finally a mirror for guys who have been having problems downloading!

  28. omar said

    hi

    I’m finishing my red5 app, my app handles video and I’ve mount it on a server in my company but when I play video it plays for a while (about 5 seconds), then it stops for a long time, then plays a while and stops, does everyone knows why?

  29. Hello Jwamicha, thanks a lot for this tutorial as well as the provided codes, together with Joachim’s migration and first application tutorials it gave me an idea of how the Red5 works together with AS 3, it’s a fun to read and a clear way of getting your fingers wet. Thanks again!

  30. Ilias said

    interesting

  31. Kris said

    Cool.

  32. interesting

  33. omar said

    hi, i’ve finally made my full app with red5 and flash even when I don’t know much abput flash…

    well, before, I have a question, someone knows how where developed the .fla apps that come with red5???? I’ve tried it but I haven’t found code on the apps, just images…

  34. Vaggelis said

    Nice!

  35. Cool…

  36. Angelo said

    Nice…

  37. Stefanos said

    Nice!

  38. Sreenivas said

    Hi jwamicha,

    just two days before i came to about Red5 flash server.
    Will Red5 work with java/jsp files/tomcat sever or will it only work for Spring framework/jetty server/tomcat server.

    I have a requirement where i have use video conferensing in jsp pages of my web application which is running on tomcat server.

    please tell how to handle the above problem.give an example

    Thanks

  39. jwamicha said

    Hello Sreenivas,

    Sorry for taking so long to get back to you. I haven’t tried this yet but probably go to your red5 server directory and do an
    #ant war
    Grub the created war and drop it inside the tomcat webapps directory. Will try this out this weekend and report on the exact steps.

  40. jwamicha said

    For tomcat everything is exactly as above but the command is:

    #ant webwar

  41. jwamicha said

    Grab the red5.war from the following path:

    red5_server/dist/red5.war

  42. snowman said

    Hey,

    thank you for this cool tutorial, I like it, but, the links don’t work 😦 I can’t download red5java.tar.gz. The first link never even loads and the second one “has a small hiccup” … :S

  43. Ambrosios said

    Interesting…

  44. Kris said

    Cool…

  45. Titos said

    Cool…

  46. Rafa said

    Hi,

    Thank you for this great tutorial, pretty valuable for a flex / red5 beginner.
    Everything works as expected, but i’m having troubles calling the remote shared object handler method from Flex,

    – When first connected, calling TSOHandler.sendMessage(..) from Flex gets registered in red5 log, but tsoOnSync event handler never gets called in Flex.

    – If I disconnect from the server and reconnect, subsequent calls don’t even get logged in Red5.

    Everything goes fine by using NetConnection.call instead. Any clue about this?

    Is there any performance penalty for using the NetConnection call method instead of the SharedObject method?

    Thanks in advance

  47. Rafa said

    Hi,

    Seems the second issue has been solved in Red5 trunk. The room scope was not being stopped when the last client exited the room although my shared object was being properly freed. Since i was creating this shared object at roomStart handler which was never fired again -since from server’s point of view the room actually was running-, i was getting a null reference to the SO. Now it’s (apparently) fixed.

    First issue’s still driving me mad.

    Thank you.

  48. Yawei said

    This is a great article.

    Can anybody email me the sample codes? I can’t download them.

    Thanks a lot.

  49. Yawei said

    my email zhiyawei@hotmail.com

  50. this is the very big problum

  51. Mandar Khankhoje said

    Thanks. for a very good application, and a great article.

  52. Hey Jwamicha,

    Thanks. for a very good application, and a great article.

    Can u tell me will jsp, php, js files/servlet will work with red5 server.

  53. Excellent article. Thanks a lot.

  54. Ed said

    Hey jwamicha, I think you accidentally left something out that you meant to include (and it’s the very thing that I am looking for).

    In this part:

    e) build.xml: This is the file that we will use to compile our application before restarting red5. You may use this example build file to compile/build for your own custom applications. Modify the following parameters as appropriate:

    In our case it was red5java.jar and so we have:

    There is nothing after the two colons. (And then it just goes on to the next topic). I even checked the underlying html and there are just empty code tags (as if you were going to paste it in there). That code is what I need. 🙂 Can you please fill in these two empty spaces? Thanks so much.

  55. For diifeernt hosting When I made an application it shares it for all the sites. I want it to process the requests as different for the connections from different sites…

  56. cezar said

    Hi,

    This is a great article.

    Can anybody email me the sample codes? I can’t download them.

    Thanks a lot.

  57. Thomas said

    hello,

    can anybody hosts the sample-files on rapidshare or megashare or other fileshares.

    thank you.

  58. jwamicha said

    The files can now be downloaded from here:

    http://www.thelinkup.com/SharedPage.aspx?vpath=fyw0ogo7twc0

  59. Varley said

    I have two problems

    1) For this tutorial, I can’t get the client to connect to the server.
    > Connection to rtmp://localhost/red5java closed.

    2) However, I have been able to connect with the simple “demo” example (which adds two numbers). The problem is that it never returns the sum.

    I’m using red5 0.7, Ubuntu 8.04. Java 1.6.0.
    Note: I can get the SOSample to work. Also I am restarting red5 whenever I make modifications to red5java.

  60. Jason said

    Can anyone else repost the files pretty please? http://www.thelinkup.com/SharedPage.aspx?vpath=fyw0ogo7twc0 is not working.

  61. jwamicha said

    Sorry. The files are now back on mediafire.

  62. Oliver said

    Hi,

    I ran into the same problem Varley described. I can not connect to the red5 server. In the flex GUI I get the message:

    “Connection to rtmp://localhost/red5java closed.”

    and in my red5 error log I find:

    “2008-10-17 12:29:58,648 [DefaultQuartzScheduler_Worker-1] WARN o.r.server.net.rtmp.RTMPConnection – Closing RTMPMinaConnection from 127.0.0.1 : 33247 to localhost (in: 3467 out 3215 ), with id 3784466 due to long handshake”

    I use Red5 0.7 on Slackware 10.1 with JDK 1.6.

    I saw these kind of problem before with the demos from red5 installation. Here I needed to install the single demos using the link on the start page of red5. After that ‘installation’ the demos worked (see current red5 FAQ).

    Any idea?

  63. Oliver said

    On my second try or view I must say a great tutorial,
    that shows many of the great features of red5.

    I tried several versions from red5, but I only had success with red5-0.6.3.
    So I recommend to use this version with this tutorial.

    My final successful environment:
    Client (Windows XP SP3)
    – Flex Builder 3 (60 Trial from Adobe)
    Server (Slackware Linux 2.4.29)
    – Red5 V0.6.3 (build with ‘ant’)

    Thanks, Oliver

  64. prashant said

    Hi,
    i build the application with eclipse and flex but when i debug build.xml it gives following error messages.

    C:\Program Files\Red5\webapps\red5java\red5java\WEB-INF\build.xml:38: Includesfile C:\Program Files\Red5\webapps\lib\library.properties not found.

  65. Current situation:
    I know action script 2 and other animation technique of Flash.
    Red5 has been installed on the server. I can access to this server using IP Address xxx.xxx.xxx.xxx. The person who installed the red5, said that it is installed on /user/local/red. I also have hosted other domains on the server.
    Now I need to know the following things:
    Set A:
    1. What is the root folder of my red5 server (e.g. public_html or httpdocs etc)?
    2. How can I access to my root folder’s files (flv) from any internet browser?
    3. Can I access on the server from my other domains? If yes, How? (e.g. rtmp://mydomain.com).

    Set B:
    What are the alternatives of $_POST and $_GET of PHP in action script? I mean, I want to pass the data from php to swf.
    I may use $_GET type data (mysite.com/index.php?myvariable=123), or post data of a form.
    By the same way, I want to post the data from swf file to php by using any method. How can I?

    You have to provide me answers of these questions in a simple way – so that I can understand and with example codes.

  66. deepak said

    Hi,
    I want to streaming audio and video on red5 open source flash media server so any body can help me on this.

    thanks
    Deepak

  67. m hewedy said

    Great, thank you .

  68. salvatore said

    hi, this is a very great post. thanks.
    I have a problem when i try to connect client, the connection io ok but when i try to get a playlist i recive the message Connection to rtmp://localhost/red5java closed. why? i’ll be crazy

    • Niraj Patel said

      Hey I have same problem .

      I also got the same : rtmp://localhost/red5java closed.

      if you got the solution , please tell me the solution .
      My email id is : niraj874u@gmail.com

      Thanks.

    • Niraj Patel said

      Hey I have same problem .

      I also got the same : rtmp://localhost/red5java closed.

      if you got the solution , please tell me the solution .
      My email id is : niraj874u@gmail.com

      ok ,

      Thanks.
      Niraj Patel

  69. Vardan said

    Hi Joseph,

    Thanks for the tutorial. One question, quite easy to stream from file directory(/streams) but is it possible to stream a flv not from custom/directory(streams) but from db directly lets say MySQL Blob object.
    Also is it possible to stream a video straight into VideoDisplay object using BlazeDS+Tomcat+Java+Flex rather than using HttpService call?

    Thanks again for this great article.

  70. Alberto Cole said

    Hello,

    Thanks for this tutorial, now I’m able to set up a Red5 Server and send info from Flash to Java, could you make a little “2nd part” of this tutorial, and teach us how to capture video from a web cam and create flv’s? It would be great! 😀

    Thanks

  71. Poon said

    A good example. It does not compile and run on Red5 0.7 or 0.8 release any more. Is there any chance you may have this fix up? I can help if you need me to.

    • jwamicha said

      Hi Poon,

      If you can help me fix this up, I would be grateful. I haven’t looked at red5 in very long. Thanks Poon.

      I’ve also been putting this off for too long; I’ll take a thorough look at the current red5 release (the red5 team have been tireless and have done an excellent dev job on red5 with many new features since this tutorial was made) and update this tutorial with anything new I may find, in the coming weeks.

      • Poon said

        Here is an updated version of red4java code that compiles and runs on latest Red5 0.8.0 trunk code (rev 3700). Not all client functionalities are working jet. I also notice some strange behavior.

        You can download the updated code here:
        http://public-misc.s3.amazonaws.com/red5java-20090711.zip

        The changes are as follow:

        Since Red5 0.7.0, Red5 switched from log4j to slf4j. I decide to stay with Red5 native logger instead of using a separate logger.

        As a result, all loggers instantiation code in *.java has to be changed. In addition, all logger config in *.xml are also updated.

        Ant build file is updated to use the new logger jar file. In addition, the scripts.properties and lib.properties in Red5 6.x are no longer there.

  72. Niraj Patel said

    Hey I have same problem .

    Thanks for the article .

    But still I get some error.

    I also got the same : rtmp://localhost/red5java closed.

    if you got the solution , please tell me the solution .
    My email id is : niraj874u@gmail.com

    ok ,

    Thanks.
    Niraj Patel

  73. jwamicha said

    Hi Poon,

    Many thanks for the updated/corrected code!

    Updated tutorial coming soon, as soon as I finish off some pending tasks.

    Niraj, are you able to connect to red5 using the example demos?

  74. Porno said

    long paraghraphs are very exhausting…and hard to read

  75. Arash said

    Hi,
    Thanks for the article
    I’m from Iran ( Green Power of Iran )
    Could you pleas help me?
    my final project is : replace flash media server with red5 server (project is Video Conference)
    my asc code is:

    application.onAppStart = function() {

    application.users_so = SharedObject.get(“users_so”, false); application.clearStreams(“/”); application.speaker=”condidate”; application.users_so.data=” “; application.nextId = 0;

    }
    application.onConnect = function(newClient, name) {

    newClient.name = name; newClient.id = “u” + application.nextId++; application.users_so.setProperty(newClient.name, name); application.acceptConnection(newClient); newClient.call(“receiveID”, null, newClient.id, newClient.name); newClient.call(“startPlaying”,null,application.speaker);

    newClient.PlayVideo = function(speakerName) {

    application.users_so.send(“PlayVideo”,speakerName);

    }
    newClient.ReqSpeakAll=function(voterName,voterID){

    if(application.clients[i].name==”condidate”){
    application.clients[i].call(“ReqSpeakAll”,null,voterName,voterID);

    }

    }

    } newClient.AcceptSpeakAll=function(voter1){

    }
    newClient.StopSpeak=function(voter1){

    }
    newClient.acceptStopSpeak=function(){

    application.speaker=”condidate”; application.users_so.send(“speaking”, application.speaker);

    }

    }
    if (client.name==”condidate”){

    application.speaker=”condidate”; for(var i=0;i<application.clients.length; i++){

    application.clients[i].call("closeConnection", null, i);

    }

    }

    }

  76. Candice said

    Hi!

    Thanks for your post. It’s been helpful… BUT… with every application that I try to create or even already created sample applications (including yours), I get the same error when starting the server. EVERYTIME!!!!
    This is the error I get:
    Exception in thread “Launcher:/videoDemo” java.lang.RuntimeException: Failed to load webapplication context class.
    at org.red5.server.tomcat.TomcatLoader$1.run(TomcatLoader.java:531)
    Caused by: java.lang.ClassNotFoundException: org/springframework/web/context/support/XmlWebApplicationContext
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.red5.server.tomcat.TomcatLoader$1.run(TomcatLoader.java:528)

    Since I get the same error for every application, I’m guessing the problem is more with my configuration of the server or something, as opposed to a xml files problems.

    CAN YOU PLEASE PLEASE HELP ME?!?!? I’m desperate!!!!

    Thank you!

    Candice

    • Daniel said

      I also have this problem. Any solution?

    • dadasign said

      I’ve also lost some time searching for a solution to the “Failed to load webapplication context class.” And while this might not be a satisfactory answer to the problem removing:

      log4jConfigLocation
      /WEB-INF/log4j.properties

      and

      org.springframework.web.context.ContextLoaderListener

      solved the problem and allowed me to run my application. I hope this helps.

  77. ChrisPhotonic said

    Hello,

    I found this guild while trying to get the red5recorder (simple red5 flash application that can record from a video camera to the server) working. I don’t see anything called WEB-INF in his download zip. I see he also charges 400 pounds for an install which is probably a 5 minute deal if there were any kind of install instructions or documentation.

    Is this guy trying to lead everyone off the path to get everything working? I’ve never added anything flash into my site a couple days ago.

    I’m looking to go though your setup process on his ‘source’ package, which seems to be missing the server configuration files.

    I was wondering if you had installed red5recorder before, and if you and any tips for someone just starting out, or even if you could point me in the right direction.

    Thanks!
    -Chris

    • jwamicha said

      Hi Chris,

      It’s been about 2 years since I last used red5. You would need to compile the red5recorder.mxml (and maybe BlinkApp.mxml?) into an .swf file for the website. You could try using ant and the build.xml file in red5_flexclient for a build example. Good luck!

  78. Wow that was odd. I just wrote an extremely long comment but after
    I clicked submit my comment didn’t appear. Grrrr… well I’m not
    writing all that over again. Anyway, just wanted to say superb blog!

  79. Whatsoever the explanations which have introduced you to
    this point. If you take the time to create a lively social circle, you are destined to meet
    more girls than you ever dreamed. I complaint I
    read all the time from guys is they may Never find funky chicks
    which likes playing video game a warm or hot environment much as they attain.

  80. “CREATE NEW JAVA RED5 APPLICATION Tsavo” was indeed a great blog.

    If merely there was even more personal blogs just like this amazing one in
    the web. Regardless, thank you for ur time, Jamel

  81. This excellent blog, “CREATE NEW JAVA RED5
    APPLICATION Tsavo” shows the fact that u actually understand exactly what u
    r communicating about! I really absolutely am in agreement.
    Thank you -Stephanie

  82. Isobel said

    constantly i used to read smaller articles or reviews that also clear their motive, and that is also happening with this article which I am
    reading here.

  83. Minna said

    Dwight Freeney, who was simply supposed to leave Indianapolis, spent 11 years using the Colts and while using
    exception of Reggie Wayne (who beats him by
    one year), was the longest tenured Colt. “She deserved a photo,” he
    said. The commercial success of Banksy prints allows the artist
    to search the globe and build political works highlighting issues in post-hurricane Katrina New Orleans, the Barcelona Zoo as well as
    the West Bank barrier separating Palestine from Israel.

  84. I have been exploring for a little for any high quality articles
    or blog posts in this kind of area . Exploring in Yahoo I at last
    stumbled upon this website. Reading this info So i’m glad to convey that I have a very good uncanny feeling I came upon exactly what I needed. I such a lot surely will make certain to don?t put out of your mind this site and give it a glance on a constant basis.

  85. 12BET คาสิโน said

    That is really attention-grabbing, You are an overly professional blogger.
    I’ve joined your rss feed and stay up for looking for more of
    your fantastic post. Additionally, I have shared your web site in my social networks

RSS feed for comments on this post · TrackBack URI

Leave a comment