Author: yapollo. Li
Mail: yapollo.li@gmail.com
MSN: ok7758521ok@hotmail.com
What is red5 used? I believe Baidu knows it all, but the detailed entry-level information is not quite Doha. I recently have a red5 project, so I will study it.
Sort out the demo process in Linux and share it with you. The details are as follows:
Installation Process in Linux:
Required Software
1. JDK: jdk-1_5_0_16-linux-i586.bin (I use this version, remember it must be 1.5)
2. Apache ant: apache-ant-1.7.1-bin.tar.gz (I'm using this version)
3. SVN: subversion-1.3.2.tar.gz (SVN installation is mainly used for SVN latest red5)
4. red5
Installation steps:
1. Install JDK
Wget official website download jdk-1_5_0_16-linux-i586.bin
# Chmod + x jdk-1_5_0_16-linux-i586.bin
#./Jdk-1_5_0_16-linux-i586.bin
Java environment variable settings
VI/etc/profile
After opening the file, press the I key and add:
J ava_home =/usr/Java/jdk1.6.0 _ 02
Path = $ java_home/bin: $ path
Classpath =.: $ java_home/lib/tools. jar: $ java_home/lib/dt. Jar
Export java_home path classpath
After writing this article, you need to write a helloworld program compiled with javac.
2. install Apache ant
Wget http://apache.mirror.transip.nl/ant/binaries/apache-ant-1.7.0-bin.tar.gz
Tar-zxf apache-ant-1.7.0-bin.tar.gz
Sudo mv apache-ant-1.7.0/opt/ant # You don't need this
Export ant_home =/opt/ant
Sudo ln-S/opt/ANT/bin/ANT/usr/bin/ant # Cut-You socould now be able to use ant
3. Install red5
SVN Co http://red5.googlecode.com/svn/java/server/trunk red5
Below is the compilation
CD red5
/Opt/ANT/bin/ant prepare
/Opt/ANT/bin/ant Dist
Run
CD Dist
Sh red5.sh
If it succeeds, netstat-l will see ports 5080 and 1935 open.
The following is a detailed Demo Application Development pull
First, create a new MyApp directory under the DOC/template/MyApp directory under the red5 directory cp to the Dist/webapps/directory
There is a WEB-INF/directory in this directory, and my directory is as follows:
-Bash-3.00 $ ls
Classes log4j. properties red5-web.properties red5-web.xml SRC web. xml
It must be such a structure.
Classes and SRC are manually created drops.
And the two directories must have the same structure.
Create the my directory in SRC and create the application. Java file in the my directory.
Package my;
Import org. red5.server. Adapter. applicationadapter;
Public class application extends applicationadapter {
Public double add (double A, double B ){
Return A + B;
}
}
Then save and compile it.
Javac-classpath specifies your red. Jar location application. Java
Upload the generated class file CP to the my directory in the classes of the upper level.
Below are the settings for Web. xml
Modify webapprootkey settings:
<Context-param>
<Param-Name> webapprootkey </param-Name>
<Param-value>/MyApp </param-value>
</Context-param>
Red5-web.xml settings
Modify web. Handler settings:
<Bean id = "Web. Handler"
Class = "My. Application"
Singleton = "true"/>
Restart the red5 service ant server.
Test code for flash: Create an as2.0
And then add the following code to the first frame:
VaR NC = new netconnection ();
NC. Connect ("rtmp: // ip address/MyApp ");
NC. onresult = function (OBJ ){
Trace ("this result is" + OBJ );
};
NC. Call ("add", NC, 1, 2 );
Red5 Error Log location Dist/log/error. Log
If the test fails, you can find the cause of failure here.
Materials I have referenced
Http://osflash.org/red5/linux-install
Http://uu9.cn/blogview.asp? Logid = 221
If you do not understand the details, you can email to me.