Dan Rossi wrote:
Hi firstly, im trying to send a sharedobject to the server to notify that the broadcaster app im building is in preview mode publishing, this will allow some standalone clients to preview a live stream before it goes live. Im having some trouble sending it to the server which then in streamPublishStart i can first check if a sharedobject previewing setting has been set before notifying the clients to switch to the live stream. Here is what i have on the client

Hi it doesnt seem that im able to send properties to a remote shared object at all, ive kludged together a system thats working using a callback on the server to set it

public boolean isPreviewing(boolean previewMode)
    {
        ISharedObject so = getSharedObject(scope, "broadcaster",true);
        so.setAttribute("previewing", previewMode);
        return true;
    }


then in my streamPublishStart method

public void streamPublishStart(IBroadcastStream stream) {

        IConnection current = Red5.getConnectionLocal();
       
        ISharedObject so = getSharedObject(current.getScope(), "broadcaster",true);
   
       
        if (so.getAttribute("previewing").equals(false))
        {
       
            log.info("stream broadcast start: "+stream.getPublishedName());
           
            Iterator<IConnection> it = scope.getConnections();
            while (it.hasNext()) {
                IConnection conn = it.next();
               
                if (conn.equals(current))
                    // Don't notify current client
                    continue;
               
               
                if (conn instanceof IServiceCapableConnection) {
                    ((IServiceCapableConnection) conn).invoke("onBroadcast", new Object[]{stream.getPublishedName()}, this);
                    log.info("sending notification to "+conn);
                }
            }
        } else {
            log.info("stream preview broadcast start: " + stream.getPublishedName());
        }
       
    }

and on the client end

nc.call("isPreviewing", new Responder(previewResult,previewResult), true);

is this appropriate at all for my scenario or is there a better way ?


_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to