Wowza Community

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 streams = streamMap.getStreams();

getLogger().info(“shuting down clients connected to this appinstance:”);

Iterator 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

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

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/3138777/how-to-control-start-stop-encoding-flash-media-encoder-using-actionscript-3

Richard

Use this one:

current_stream.getClient().setShutdownClient(true);

Richard

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

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

1 Like