Difference between IMediaStream and Stream

Hi,

I have confusion about IMediaStream that create in standard broadcasting and Stream create from Wowza:

Stream stream = Stream.createInstance(appInstance, streamName);

I use Stream in Playlist but sometimes I can’t stop it.

After my Stream.stop() Stream is available yet but not exist in list of appInstance.getPublishStreamNames().

Which measure I must use? How object Stream livecycle in Wowza?

thanks

Carlo

Carlo,

Try stream.close() to stop an Stream class stream.

Richard

Hi Carlo,

IMediaStream is the interface that is used to interact with all streams on the server. Each of the different stream types on the server implement the IMediaStream interface.

Stream (com.wowza.wms.stream.publish.Stream) is a server side created live stream that you can then insert other live or vod sources into. Internally, it has it’s own IMediaStream object available in stream.getPublisher().getStream();

If you create a Stream but never add any valid sources to it then using stream.close(); may not close it down properly because the underlying publisher thread would not have started running.

If you try to create another stream using the same name, it will fail because the stream name is still in use.

You can use the following method to shut down the stream completely.

// close the stream and wait for the publisher thread to end and destroy the publisher.
stream.closeAndWait();
// get a reference to the publisher.  If the thread never started, the publisher will still exist so close the publisher.
Publisher publisher = stream.getPublisher();
if(publisher != null)
{
    publisher.close();
}

Roger.

1 Like

Thanks a lot

carlo