18- Create Red5plugin Application

  1. Open eclipse, and open the Java EE perspective: Click on Window in the top nav, then Open Perspective, then Other, then Java EE.
  2. In the project explorer, right click, select New, click on Dynamic Web Project
  3. Type in a project name in the Project name field, for example "myApp".
    In the Target Runtime field, click the New button, select Red5 Server Runtime under Infrared5, then click Next ».
    For Default JRE:, select your 32-bit JRE in the list, for Runtime Directory put the path to your distribution, C:\Documents and Settings\Administrator\My Documents\Eclipse\red5_server\dist\r1. Then click Finish
    In the Configuration field, click the Modify button, check the Red5 Application Generation checkbox, and expand it and also check the box under it that says Red5 Application Generation. Then on the right side of the page, click the Runtimes tab, and select the Target Runtime that we just created. Then click OK.
    Then click Next >, then click Next >, then click Finish...and wait while it builds your workspace.

    NOTE: To find your Default JRE, look in your registry: Click on Start, then click on Run, type in regedit, expand HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Runtime Environment/1.6 and look at the JavaHome variable to see where your default JRE installed. On my machine, JavaHome is equal to C:\Program Files\Java|jre6, so I know that it is the 64-bit version of the JRE. So I do not want to use the default JRE...I want to use the other one in the dropdownlist (because eclipse wants the 32 bit version of eclipse).
  4. A message box will appear asking which version of the SDK you want to use for this project, check the radio button that says Use default SDK (currently "Flex 4") and click OK.
  5. You should notice that it created 2 projects: a server project and client project, called "myApp" and "myAppClient". In the server application, you will see that it has created a class called Application.java inside a package called org.red5.core. In the client application, you will see that it has created a file called myAppClient.mxml with some boilerplate code in it...which will connect to the server app, using the path rtmp://localhost/myApp.
    Also if you go into WebContent, then WEB-INF, you will see the standard red5 files:
    red5-web.properties
    red5-web.xml
    web.xml
  6. RUN THE SERVER: Right click on the server app (called "myApp"), select Run As, then select Run on Server.
    Check the radiobutton that says Manually define a new server
    For Server's Host Name, put "localhost".
    Under where it says Select the server type, under Infrared5, select Red5 Server Runtime.
    Then give it a name where it says Server name
    For Server Runtime Environment, select the Target Runtime that you created in step 2 above.
    Then click on Next >.
    For Auto Deploy Directory, put C:\Documents and Settings\Administrator\My Documents\Eclipse\red5_server\dist\r1\webapps, the path to the webapps directory inside your distribution.
    For Start Script, put C:\Documents and Settings\Administrator\My Documents\Eclipse\red5_server\dist\r1\red5-debug.bat, the path to the red5-debug.bat file inside your distribution.
    For Stop Script, put C:\Documents and Settings\Administrator\My Documents\Eclipse\red5_server\dist\r1\red5-shutdown.bat, the path to the red5-shutdown.bat file inside your distribution.
    Then click Next >, then click Finish, and wait while it compiles and runs our server app.

    NOTE: If you get an error, then run your red5-debug.bat and red5-debug.bat scripts to see if they have errors. You can edit them in notepad, and add the word "PAUSE" to the end of them to see the outputs of them and make sure there aren't any errors. You should remove the "PAUSE" statements, once you are sure they don't have errors. Click here to watch my video about how to correct the errors in these 2 files.
  7. RUN THE CLIENT: Expand the client app (called "myAppClient"), and right click on myAppClient.mxml, select Run As, then select Web Application. It should open a web browser (right click the yellow bar at the top and choose Allow Blocked Content then click Yes button), and there should be a message box that says "Successful Connection"...which means it worked!
« Back to Home