Lenny, Is Red5 logging any errors when you run this? I haven't had time yet to try it out, but from looking at it here in my email it looks correct.
Let us know some more info and perhaps we can help. BTW, this line is not needed by Red5 as it supports AMF3, unlike FMS: nc.objectEncoding = ObjectEncoding.AMF0 ; -Chris On 5/20/07, Lenny Sorey <[EMAIL PROTECTED]> wrote: > Hello All, > > Got a question about a Flex/FMS tutorial I am trying to use as a learning > guide in RED5. > > The example viewed is at : > > http://renaun.com/flex2/fms/VideoConferenceWDDJ/FlexVideoMain.html > > > > The code for this example is at: > http://renaun.com/flex2/fms/VideoConferenceWDDJ/srcview/ > > Im not using the asc code as this is being called in my application.java for > just connection. > I used this one because it appears to be pretty simple as far as a straight > forward Shared Object example. > > Can someone take a look at this and give me some guidance? I am not making > it to me Application.class file and am not connecting > to the client. > > Any responses are appreciated. > > Regards, > > Lenny > > I set up a new webapp for this example in red5 as videoconf > > I setup my application.java as follows: > > ****************************************************************************************************************************** > > > package org.red5.server.webapp.videoconf; > > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; > import org.red5.server.adapter.ApplicationAdapter; > import org.red5.server.api.IBandwidthConfigure; > import org.red5.server.api.IConnection ; > import org.red5.server.api.IScope; > //import org.red5.server.api.stream.IServerStream; > import org.red5.server.api.stream.IStreamCapableConnection; > import > org.red5.server.api.stream.support.SimpleConnectionBWConfig > ; > import org.red5.server.api.service.IPendingServiceCallback; > import org.red5.server.api.service.ServiceUtils; > import org.red5.server.api.so.ISharedObject; > > public class Application extends ApplicationAdapter { > > protected static Log log = LogFactory.getLog(Application.class.getName()); > > private IScope appScope; > // private IServerStream serverStream; > > /** [EMAIL PROTECTED] */ > @Override > public boolean appStart(IScope app) { > appScope = app; > //add users > > createSharedObject(appScope, "users_so", false); > log.info("@Application.java: appStart is called."); > > return true; > } > > /** [EMAIL PROTECTED] */ > @Override > public boolean appConnect(IConnection conn, Object[] params) { > // Trigger calling of "onBWDone", required for some FLV players > measureBandwidth(conn); > > > > //IScope myScope = Red5.getConnectionLocal().getScope(); > > ISharedObject users_so = getSharedObject(appScope, "users_so", false); > log.debug("appConnect is called: "+getSharedObject(appScope, "users_so", > false)); > > > return super.appConnect(conn, params); > } > > /** [EMAIL PROTECTED] */ > @Override > public void appDisconnect(IConnection conn) { > > super.appDisconnect (conn); > } > } > > > /*The Flex Client Side*/ > > <?xml version="1.0" encoding="utf-8"?> > <!-- > Copyright 2006 Renaun Erickson (http://renaun.com ) > > @ignore > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > xmlns="*" > initialize="haveCamera = ( Camera.getCamera() != null )" > layout="vertical" viewSourceURL="srcview/index.html"> > <mx:Script> > <![CDATA[ > import mx.collections.ArrayCollection; > import mx.controls.Alert ; > > [Bindable] > private var haveCamera:Boolean; > > [Bindable] > public var nc:NetConnection; > > public var users_so:SharedObject; > [Bindable] > public var dpUsers:ArrayCollection; > > /** > * This function creates the FMS connection and sets the Status event > handler > */ > public function createConnection():void > { > //Logger.debug( "MAIN:createConnection" ); > // Check the user name length > if( txtName.text.length > 0 ) { > // Create Connection and setup Events > nc = new NetConnection(); > nc.client = this; > nc.objectEncoding = ObjectEncoding.AMF0 ; > nc.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler ); > // A simple Identifier for the asc side > var identifier:String = txtName.text; > while( identifier.search( " " ) > 0 ) > identifier = identifier.replace( " ", "_" ); > nc.connect( "rtmp://10.2.0.10/videoconf", txtName.text, identifier ); > } else { > Alert.show( "Please provide a name for the video chat connection!" ); > } > } > > /** > * Waits for any status from the connection to FMS > */ > public function netStatusHandler( event:NetStatusEvent ):void > { > //Logger.debug( "MAIN:connectionSuccess:Success" ); > switch( event.info.code ) { > case "NetConnection.Connect.Success ": > clientID = nc.clientID; > // Connection succeeded now create components > connectComponents(); > // Change to Video view > vsMain.selectedChild = pnlVideo; > break; > case "NetConnection.Connect.Rejected": > Alert.show( "The number of users has been limited for this demo, > please try again in a few minutes.", "Restricted Usage" ); > break; > } > > } > > /** > * Method called to create the components > */ > public function connectComponents():void > { > //Logger.debug( "MAIN:connectComponents" ); > // Simple User shared object and event handling > SharedObject.defaultObjectEncoding = > flash.net.ObjectEncoding.AMF0; > users_so = SharedObject.getRemote("users_so", nc.uri, false); > users_so.addEventListener( SyncEvent.SYNC, usersSyncHandler ); > users_so.connect( nc ); > } > > /** > * Listens for any change to the users shared object > */ > public function usersSyncHandler( event:SyncEvent ):void > { > //Logger.debug( "MAIN:usersSyncHandler" + event.target.data ); > var results:Object = event.target.data; > var usersArray:Array = new Array(); > for( var a:String in results ) { > var obj:Object = new Object(); > obj.name = results[ a ]; > obj.identifier = a; > usersArray.push( obj ); > } > dpUsers = new ArrayCollection( usersArray ); > } > > /** > * Closes connections and handles the logout > */ > public function logout():void > { > //Logger.debug( "MAIN:connectComponents" ); > users_so.close(); > nc.close(); > dpUsers = null; > users_so = null; > nc = null; > vsMain.selectedChild = pnlLogin; > } > > ]]> > </mx:Script> > > <mx:ViewStack > id="vsMain" > width="100%" height="100%"> > <!-- Login Panel --> > <mx:Panel > id="pnlLogin" > title="Red5, Flex and FMS Video Conference Demo"> > <mx:Form> > <mx:FormItem label="Name:"> > <mx:TextInput > id="txtName" > enabled="{ haveCamera }" /> > </mx:FormItem> > <mx:Button > label="Submit" > click="createConnection()" > enabled="{ haveCamera }" /> > <mx:Label text="{ ( haveCamera ) ? '':'Now camera is found!' }" /> > </mx:Form> > </mx:Panel> > <!-- Video Panel --> > <mx:Panel > id="pnlVideo" > width="100%" height="100%" > title="Welcome { txtName.text }!" > layout="vertical"> > > <mx:Tile > height="100%" width="100%"> > <mx:Repeater > id="rpUsers" > dataProvider="{ dpUsers }"> > <VideoPod > nc="{ nc }" > isSender="{ rpUsers.currentItem.name == txtName.text }" > userItem="{ rpUsers.currentItem }" /> > </mx:Repeater> > </mx:Tile> > <mx:Label > width="100%" > text="Video Quality is set really low to not use up all my bandwidth!" > color="0xFF0000" /> > <mx:ControlBar> > <mx:Button > label="Logout" > click="logout()"/> > </mx:ControlBar> > </mx:Panel> > > </mx:ViewStack> > > </mx:Application> > > > /*End Flex client side */ > _______________________________________________ > Red5 mailing list > [email protected] > http://osflash.org/mailman/listinfo/red5_osflash.org > > _______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
