For text chat rooms, as well as multiple screen interaction, we understand a lot more, I know there are two kinds of sockets and XMPP protocol.
If we use Red5, a streaming media server based on Flash, in the development of live video, or voice chat rooms, we can use RTMP,RTSP.
One, what is the main feature of the Red5
Red5 is similar to the Macromedia Company's FMS, a Java based Open-source streaming media server that provides streaming media services based on Flash. It is written by the Java language and uses rtmp as a streaming media transport protocol, which is fully compatible with FMS. It has streaming flv, MP3 files, real-time recording client streams for FLV files, shared objects, real-time video playback, remoting and other functions. After replacing the FMS with RED5, the client does not have to change to function properly.
Two, Red5 install
The code is as follows |
Copy Code |
1, download Address: http://www.red5.org/downloads/red5/1_0_1/ 2, install Java 1.6 # yum Install java-1.6.0-openjdk Java-1.6.0-openjdk-devel 3, install Red5 # tar ZXVF red5-1.0.1.tar.gz # MV Red5-server-1.0/usr/local/red5 # Cd/usr/local/red5 #./red5.sh
|
The system used is CentOS 6.5, installation is no problem
4, create Red5 script
The code is as follows |
Copy Code |
[Root@localhost red5-server-1.0]# Cat/etc/init.d/red5 #!/bin/bash # for RedHat and cousins: # chkconfig:2345 85 85 # DESCRIPTION:RED5 Flash Streaming Server # Processname:red5 # Created By:sohail Riaz (sohaileo@gmail.com)
Prog=red5 Red5_home=/usr/local/red5 daemon= $RED 5_home/$PROG. Sh pidfile=/var/run/$PROG. PID
# Source Function Library . /etc/rc.d/init.d/functions
[-r/etc/sysconfig/red5] &&. /etc/sysconfig/red5
Retval=0
Case "$" in Start Echo-n $ "Starting $PROG:" CD $RED 5_home $DAEMON >/dev/null 2>/dev/null & Retval=$? If [$RETVAL-eq 0]; Then Echo $! > $PIDFILE touch/var/lock/subsys/$PROG Fi [$RETVAL-eq 0] && Success $ "$PROG Startup" | | Failure $ "$PROG startup" Echo ;; Stop Echo-n $ "Shutting down $PROG:" Killproc-p $PIDFILE Retval=$? Echo [$RETVAL-eq 0] && rm-f/var/lock/subsys/$PROG ;; Restart) $ stop $ start ;; Status Status $PROG-P $PIDFILE Retval=$? ;; *) echo $ "Usage: $ {Start|stop|restart|status}" Retval=1 Esac
Exit $RETVAL |
third, test Red5 streaming Media server
1, publish a streaming media
We can go to the next Adobe Flash Media Encoder, enter RTMP://IP address/live in FML, stream name up, like 111
We can also use Red5 's own publishing tool to publish a stream
A), open http://localhost:5080/demos/publisher.html
b), connecting the Red5 streaming media server
If 19:56:05:873-netconnection.connect.success appears on the right, Red5 starts normally and can connect
c), releasing a red5 stream
Why do you choose audio here,
Instead of video, it's because the computer doesn't have a camera. Point start appears with the following contents
When you select Allow, after clicking Publish, if the 20:04:23:836-publish-netstream.publish.start appears on the right, the release stream is successful.
2, with SWFObject connection, testing
Add the following code, so.addvariable (' file ', ' rtmp://localhost/live/111 ');
Rtmp://localhost/live Streaming Media server, 111 is the name of one of the streams.
When I speak, everyone else can hear you.