[Red5] connect()-attributes issues

Daniel Schweighöfer acid at acidforce.org
Fri Dec 12 09:51:22 PST 2008


Hi List,
 
my first post here, although I'm fascinated about your project for a year. Great Stuff! Keep on going! But now to my Problem:                        

 I'm going to build a video-streaming application for a customer-site where you can trade videos. I want the Flex-client to transfer a string, which it's loading via FlashVars to Red5.  
 
My first approach was to send this string as connect()-attribute, so I have the following Code in my Flex-application:
 
[lots of imports]
public class StreamTest extends Sprite
    {
 
        private var nc:NetConnection;
        private var ns:NetStream;
        private var items:Array;
        private var video:Video;
              private var text:String = "blubb";
                              
        public function StreamTest()
        {
 
            nc = new NetConnection( );
            nc.client = this;
            nc.objectEncoding = ObjectEncoding.AMF0;
            nc.addEventListener( NetStatusEvent.NET_STATUS , netStatus );
            nc.connect( "rtmp://CustomerSiteAdress/tnlStreamer",this.text);
 
          ...
          }
          ...
}
 
And on the server side, I have the following code, to access this value:

[A bunch of more imports, incl. ICastingAttributeStore]
public class Application extends ApplicationAdapter implements IScheduledJob, IPendingServiceCallback  {
   ...
   @Override
       public boolean appConnect(IConnection conn, Object[] params) {
            ...
            log.info( conn.getStringAttribute("text") );
            ...
      }
      ...
}
 
The client connects and function calls just happens fine. But the value I receive is "null" :/
 
So I've tried another approach, and tried a callback from an client method. This worked, but when I receive the result in the Application class from above in:
 
    public void resultReceived(IPendingServiceCall call){
              this.file = (String) call.getResult();
               log.info(this.file);
 
                //Dem Client mitteilen, welchen Stream er spielen moechte
              }
 
I didn't know, how to access the connection to invoke another client method. Is there an instance of the Application class for each connection, so that  I can use this.VariableWithConnectionInside in resultReceived()?
 
And can you please tell me, why i didn't get the value of the connect()-Attribute? This would help most, because it would be the best solution for me, I think.
 
    Cheers,
 
       Daniel

-- 

acidforce.org - IT-Services
Daniel Schweighöfer
Elsener Str. 4
33102 Paderborn

05251/ 364 22
0151/ 211 58 328
mailto: info at acidforce.org
http://www.acidforce.org




More information about the Red5 mailing list