Results 1 to 10 of 10

Thread: How to call IMediaStream::registerCallback?

  1. #1
    Join Date
    Nov 2011
    Posts
    14

    Default How to call IMediaStream::registerCallback?

    Also what is the difference between registerCallback, registerOnStatus and registerOnPlayStatus?

    Thanks a lot.

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Do you mean to do this in Flash client:

    On NetStream:
    var clientObj:Object = new Object();
    clientObj.clientsideCallBackFunction(data:Object):void
    {
    trace(data.message);
    });
    
    netstream.client = clientObj;
    netstream.play("somevideo.flv");
    On NetConnection
    var clientObj:Object = new Object();
    clientObj.clientsideCallBackFunction(data:Object):void
    {
    trace(data.message);
    });
    
    netconnection.client = clientObj;
    netconnection.connect("rtmp://[wowza-address]:1935/[app-name]");

    Take a look at the ServerSideModules example that ships with Wowza.

    Richard

  3. #3
    Join Date
    Nov 2011
    Posts
    14

    Default

    IMediaStreamActionNotify has onPublish & onUnPublish but it doesn't have NetStream.Record.Start & NetStream.Record.Stop equivalent. I need to track these two events. Wonder if any of IMediaStream::registerCallback, IMediaStream::registerOnStatus and IMediaStream::registerOnPlayStatus can do the trick. Thanks.

  4. #4
    Join Date
    Nov 2011
    Posts
    14

    Default

    tried this:

    on server side, I call registerCallback, registerOnStatus & registerOnPlayStatus as in the following code
    public void onMediaStreamCreate(IMediaStream stream)
    {
    stream.addClientListener(this);
    //NetStream.Record.Start
    //NetStream.Record.Stop
    //NetStream.Publish.Start
    stream.registerCallback("onCallback", this);
    stream.registerOnStatus(this);
    stream.registerOnPlayStatus(this);
    }

    The callback doesn't seem to be called.
    public void onCallback(IMediaStream stream, com.wowza.wms.request.RequestFunction function, AMFDataList params)
    {
    getLogger().info("IMediaStreamCallbacknCallback");
    if (params != null)
    getLogger().info(" " + params.toString());
    }

    guess the three methods aren't supposed to be used this way.

    How to get notified of events NetStream.Record.Start & NetStream.Record.Stop?

  5. #5
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Use NetStream NetStatusEvent handler. You can refer to examples that ship with Wowza, the in the client (Flash) and clientFlex folders

    Richard

  6. #6
    Join Date
    Nov 2011
    Posts
    14

    Default

    Can you do the same on server side? I found that when IMediaStreamActionNotify:nUnPublish is invoked, isRecord seems always false. Run out of idea how to get onRecordStart and onRecordStop sort of events. Thank you so much for your quick responses.

  7. #7
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    If the application StreamType is "live-record", then recording starts when onPublish runs.

    Richard

  8. #8
    Join Date
    Nov 2011
    Posts
    14

    Default

    StreamType is live-lowlatency and I use LiveStreamRecord Module to start and stop recording. I only need to get time stamps for start and stop of recordings. What do you suggest? Thanks a lot.

  9. #9
    Join Date
    Nov 2011
    Posts
    14

    Default

    BTW, need to do these on server side and want to get time stamp as accurate as possible. Sometimes, client unpublishes streams without stop recording.

  10. #10
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Yvonne,

    The LiveStreamRecord package comes with source, so you can build and add what you need

    Richard

Similar Threads

  1. Stream vs. IMediaStream
    By piotrb in forum General Forum
    Replies: 1
    Last Post: 05-01-2012, 02:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •