Finally found a way to change SharedObject on sever side when flash 
client disconnects (close standalone flash window or browser with 
embeded flash) notifying all the remainig of clients (sorry for my 
english...).
I've been searching about it for days. I'm a newbie on that matters, but 
hope someone like me find it usefull. The code:


package ...;

import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IClient;
import org.red5.server.api.IScope;
import org.red5.server.api.so.ISharedObject;

public class Application extends ApplicationAdapter {

    public boolean appJoin(IClient client, IScope app){
            log.debug("CURRENT CLIENTS " + getClients().size());
            log.debug("CLIENT " + client + " JOINS APP "+app);
            if (!hasSharedObject("users"))
                    createSharedObject("users",false);
            // The first client is a webcam publisher, thats why dont 
count it
            if (getClients().size() > 0) {
                    ISharedObject so = getSharedObject("users");
                    so.setAttribute("users", getClients().size());
            }
            return true;
    }

    public void appLeave(IClient client, IScope app){
            log.debug("CURRENT CLIENTS " + getClients().size());
            log.debug("CLIENT " + client + " LEAVES APP "+app);
            ISharedObject so = getSharedObject("users");
            so.setAttribute("users", (getClients().size()) - 1);
    }
}

on flash client, after connection only do:

so = SharedObject.getRemote("users", nc.uri, false);
so.onSync = function(list) {
    if (so.data.users != undefined)
        users.text = "users online: " + so.data.users;
}
so.connect(nc);



Hope helps somebody. Bye




Manolo R.G. escribió:
> hello everyone
>
> Does anyone knows how to modify a sharedobject member (ie. users_online) 
> when a flash client disconnect from an app?
>
> thanks in advance
>
> _______________________________________________
> 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

Reply via email to