How to create an application from red5 of Windows Installation Edition

Source: Internet
Author: User
[D5 tutorial] how to create an application from red5 of win installation Edition Program Source: http://www.d5power.com/

Today, the company needs to install a red5 server to develop programs. We found that red5 0.6 has been officially released. I previously wrote an article about using SVN for extraction, and then set up the red5 ProjectArticle. Generally, developers do not need to modify red5 programs, but only need to build their own applications. Now we will record the establishment process and hope to help you. This article is suitable for users who first came into contact with red5 (under the win platform) and did not know how to start building their own applications.

Process:

1. download the latest Red 5 http://osflash.org/Red5

2. Install red5. Install jre before installing red5. You must specify the JRE directory when installing red5.

3. go to the red5 installation directory and find the DOC/templates Directory, which stores a standard red5 Application Template MyApp and copies it to the webapps directory in the red5 installation directory, and rename it your favorite folder name. For example, if you want to develop a chat program, you can change MyApp to mychat. This name is the name of the service to be connected later.

4. Create a new folder in the WEB-INF SRC to store the programSource codeCreate a new classes folder to store the compiled files.

5. open eclipse, specify the workspace as webapps under the red5 installation directory, and create a new project named mychat. at this time, you should find that all the files in mychat have been loaded in. First, we should designate the src directory as the sourceCodeDirectory, right-click SRC, select build path-> use as source folder from the pop-up menu, and specify it as a code folder. Next, specify the target directory of the Project, right-click the project name, select Properties, select Java bulid path, select the source tag, and select the classes directory in the following browse, specify it as the target directory. Select libraries and click Add external jars to include red5.jar in the red5 installation directory.

6. At this time, there should be a WEB-INF/src on the left side of eclipse, and we will start writing our first project code here. Right-click it and choose new> package from the shortcut menu to create a new package. For example, the package name can be Org. d5.first, and then in the generated Org. right-click the d5.first package and choose new> file, and enter the file name application. java. Enter the following code in the created file:

Package org. d5.first;

Import org. red5.server. Adapter. applicationadapter;

Public class application extends applicationadapter {

Public String login (){
Return "Welcome to chat servers ";
}

}

7. Configure. Edit the WEB-INF under the red5-web.xml and find the bean id = "Web. handler, change the xxx position in class = "XXX" to Org. d5.first. application. Delete the bean id = "server. Handler... The whole sentence, because we cannot use this stuff for the moment. Edit web. XML, find webapprootkey, and change the value in the param-value label to/mychat. Edit the red5-web.properties and change the first sentence to webapp. contextpath =/mychat

8. compile the project

9. Restart the red5 Server

10. Create a new file in flash and enter the following code:

NC = new netconnection ();
NC. Connect ("rtmp: // localhost/mychat ");

NC. onresult = function (OBJ ){
Trace (OBJ );
}
NC. Call ("login", NC );

Run the program and the result is welcome to chat servers. The first red5 application was born, haha :)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.