Results 1 to 6 of 6

Thread: haw to close all streams for a particular application instance

  1. #1
    Join Date
    Jul 2011
    Posts
    13

    Default haw to close all streams for a particular application instance

    Hi,

    I am trying to close all streams for a praticular applicationinstance and it seems to work fine when i am publishing on rtmp but not on rtmpt
    here is the code i am using:
    IApplicationInstance appInstance = client.getAppInstance();

    //get all the streams running on this app-instance
    MediaStreamMap streamMap = appInstance.getStreams();

    List<IMediaStream> streams = streamMap.getStreams();

    getLogger().info("shuting down clients connected to this appinstance:");
    Iterator<IMediaStream> streamsIterator = streams.iterator();
    while(streamsIterator.hasNext() )
    {
    IMediaStream current_stream = streamsIterator.next();
    getLogger().info("current_stream Name:" + current_stream.getName());
    current_stream.getClient().setShutdownClient(true);
    }

    any ideas why current_stream.getClient().setShutdownClient(true);
    is not shuting down the client that is publishing on rtmpt?
    please note i am using wowza 2.

    thanks

  2. #2
    Join Date
    Dec 2007
    Posts
    22,013

    Default

    Probably the client is gone but not cleaned up yet by Wowza pingTimeout mechanism. I would try to handle that. RTMPT connections are more fragile.

    Richard

  3. #3
    Join Date
    Jul 2011
    Posts
    13

    Default

    I am publishing from flash media encoder (on rtmpt) and after the current_stream.getClient().setShutdownClient(true) ;
    code is executed,client is not disconnecting at all, it's still publishing as if nothing happend.

    can you please explaing a bit more on Wowza pingTimeout mechanism.
    is there any example.

    ideally i need to shut down the client imediately whether its rtmp or rtmpt.

    thanks

  4. #4
    Join Date
    Dec 2007
    Posts
    22,013

    Default

    Your code above is closing all streams, incoming and outgoing. The ones with the first error you mentioned were probably lost Flash clients that were playing the stream. There is one stream for each client, and closing an incoming stream does not close the stream of any of the clients that were subscribed to it.

    You can get just incoming streams with IApplicationInstance.getPublishStreamNames()

    As for shutting down FMLE like this, I have not been able to do. FMLE just re-connects over and over. But I think it can be done with HTTP calls, at least that is what is indicated here (but that I haven't tested):
    http://stackoverflow.com/questions/3...actionscript-3

    Richard

  5. #5
    Join Date
    Jul 2011
    Posts
    13

    Default

    can you please explain what is the difference between:

    current_stream.getClient().shutdownClient();
    current_stream.getClient().getClient().setShutdownClient(true);

    current_stream.close();
    current_stream.shutdown();
    current_stream.clear();
    current_stream.stopPublishing();

    as long as the stream is stoped once, i can handle the attempt to reconnect on the server-side.
    rtmpt seems to not stop becouse it relies on the http sessionID and i suppose server provides any other available connection on the pool.
    so i would think that removing the session for this connection would force the client to create a new session before beign able to publish again

  6. #6
    Join Date
    Dec 2007
    Posts
    22,013

    Default

    Use this one:
    current_stream.getClient().setShutdownClient(true);
    Richard

Similar Threads

  1. cupertino stream close does not close connection
    By urgentkettle in forum Server-side Modules and Code Samples Discussion
    Replies: 5
    Last Post: 03-18-2012, 03:04 PM
  2. double close comment in Application.xml
    By optics in forum AddOn: Wowza nDVR
    Replies: 1
    Last Post: 11-20-2011, 07:33 AM

Posting Permissions

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