
Part Three - Creating flash client
Milan Toth
Milan Toth is the Chief Flash Developer of Jasmin Media Group, he created one of the world's biggest flash media server system. He loves Eclipse and OS X, AS3 and JAVA, sci-fi and horror, metal and electronic.
Okay, server-side is ready, but we should test it somehow.
Create a new Actionscript project in Eclipse/Flex, and name it Red5FirstClient.
package
{
import flash.net.NetConnection;
import flash.net.ObjectEncoding;
import flash.events.NetStatusEvent;
import flash.display.Sprite;
public class Red5FirstClient extends Sprite
{
private var nc:NetConnection;
public function Red5FirstClient()
{
// new netconnection
nc = new NetConnection( );
// set encoding to old amf
nc.objectEncoding = ObjectEncoding.AMF0;
// netstatus event listening
nc.addEventListener( NetStatusEvent.NET_STATUS , netStatus );
// connect to red5, passing false as parameter
nc.connect( "rtmp://localhost/firstapp" , false );
}
private function netStatus ( event:NetStatusEvent ):void
{
trace( event.info.code );
if ( event.info.code == "NetConnection.Connect.Rejected" )
{
// trace reject message
trace( event.info.application );
}
}
}
}
Run menuitem -> Debug. Because we passed false as connection parameter, our red5 application will reject us, check the last line of red5/jvm log in terminal.
[INFO] 87028 pool-2-thread-8:( com.milgra.Application.appConnect ) Red5First.appConnect 1
so we were connected, let’s check the eclipse/flex console:
NetConnection.Connect.Rejected
you passed fals . . .
NetConnection.Connect.Closed
The server application rejected us, and it passed the rejection message also, it worked as we planned.
Let's change the connection parameter to true, and wonder happens:
nc.connect( "rtmp://localhost/firstapp" , true );
the result is:
NetConnection.Connect.Success
Our application is working!!!
Spread The Word
Related Links
35 Responses to "Getting started with red5 server" 
|
said this on 06 Jun 2007 5:13:54 PM CST
I get the following error
Cannot cast from Objec Red5FirstA line 2 And I needed to chan |
|
said this on 07 Jun 2007 8:12:10 AM CST
There seems to be a probl
Cannot Im just learning |
|
said this on 07 Jun 2007 9:21:33 AM CST
If you get the error abov
|
|
said this on 27 Jun 2007 2:42:20 AM CST
If you using a JDK < 5
try something like t boolean accept = &# |
|
said this on 29 Jun 2007 2:03:02 PM CST
when i run red5.bat in wi
Exception in thread &q |
|
said this on 23 Jul 2007 9:21:23 AM CST
Whether I pass "fals
|
|
said this on 24 Jul 2007 8:14:27 PM CST
This is a pretty bad tuto
|
|
said this on 26 Jul 2007 5:56:46 AM CST
To it was very helpful. U
|
|
said this on 02 Sep 2007 1:31:33 AM CST
LOVED IT!
However, i d webapp.virt |
|
said this on 27 Oct 2007 4:11:01 PM CST
I get the error
NetConne NetConnection.Connect.Cl I think Invalidap |
|
said this on 14 Nov 2007 4:48:48 AM CST
Also had the "Invali
|
|
said this on 22 Nov 2007 4:09:12 PM CST
NetConnection.Connect.Inv
Wa |
|
said this on 22 Jan 2008 11:04:38 AM CST
I have the same InvalidAp
|
|
said this on 07 Feb 2008 9:25:22 PM CST
It works.
I just added t webapp.virtualHosts= to Thanks! |
|
said this on 16 Feb 2008 9:41:49 AM CST
Red5 is a real alternativ
|
|
said this on 17 Feb 2008 12:53:59 PM CST
First I got the NetConnec
After editing the red5- NetConnection.Co Anyone el |
|
said this on 20 Feb 2008 4:47:56 PM CST
Very nice small tutorial.
|
|
said this on 21 Feb 2008 7:07:20 AM CST
Super :) got me start
For those getting |
|
said this on 26 Feb 2008 2:35:23 PM CST
Thanks Milan for a very u
I ran Anyway, i set the j |
|
said this on 10 Mar 2008 5:50:01 AM CST
I get the error:
NetConn NetConnection.Connect.C I open the Red5 2 java.lan Anyone els Thanks! |
|
said this on 21 Mar 2008 9:55:38 AM CST
It seems like one importa
|
|
said this on 24 Apr 2008 4:36:01 AM CST
Could you tell how to mak
It seems to me th |
|
said this on 24 Jun 2008 9:31:41 AM CST
Creating the jar file sol
|
|
said this on 22 Nov 2008 1:10:03 AM CST
Please help!! i keep gett
2008-11- java.lang.NoClassDefFou a at org.springframe at org.mortbay.jetty.h at org.mortba at org.mortbay.jet at org.mort at org. at org at at org.mortbay.jet at org.mortbay.comp at org.mortbay.j at org at |
|
said this on 05 May 2009 2:05:13 PM CST
It seems you are having p
|
|
said this on 08 Jan 2009 12:21:53 PM CST
I tried exporting the .ja
|
|
said this on 07 Mar 2009 1:34:07 AM CST
thanks for your great tut
i’m very m thank y |
|
said this on 07 Mar 2009 3:44:50 AM CST
same here.i've tried to c
rtmp://Myserver:5 rtmp://Myse I'm stil |
|
said this on 11 May 2009 6:37:05 PM CST
Thanks for the nice tutor
logback-classic-0.9. logback-core-0.9.8 slf4j-api-1.4.3.jar I discovered this aft |
|
said this on 03 Jun 2009 3:29:34 AM CST
If ANYONE ever runs into
|
|
said this on 03 Jun 2009 12:56:40 PM CST
The error was wit red5 7,
|
|
said this on 18 Jun 2009 12:26:46 AM CST
i m using netbeans
and i and when i build t |
|
said this on 16 Jul 2009 4:09:45 AM CST
Man,
what a nice tutor Now |
|
said this on 27 Oct 2009 10:04:41 PM CST
Hello,
I'm trying yo take care, lee |
|
said this on 04 Nov 2009 9:57:09 AM CST
Anyone getting this error
[ERROR] 2009-11-04 INFO | jvm 1 | INFO | jvm 1 | INFO | jvm 1 | 20 INFO | jvm 1 INFO | jvm 1 | INFO | jvm 1 | 200 Cannot I |


Author/Admin)