Wowza Community

Publish and play a live stream from API

Hello,

I would like to know how to do this: https://www.wowza.com/docs/how-to-set-up-live-streaming-using-a-native-rtp-encoder-with-sdp-file

In an automatized way. I mean I’ll have to create that kind of live streaming on-the-fly so I need a way to do that part where you access the http://[wowza-address]:8086/streammanager and start the stream but using the API.

I have checked the documentation but its so big (a great thing :D) but idk where to start if someone can give me a hint it would be appreciated.

Thanks!

You can use the MediaCaster API in a Wowza module or HTTProvider or ServerListener:

https://www.wowza.com/docs/how-to-use-the-wowza-streaming-engine-java-api-to-start-and-stop-mediacaster-streams

And there is another approach that might work for you here:

https://www.wowza.com/docs/how-to-monitor-content-folder-for-sdp-and-stream-files-to-start-publishing-streams-serverlistenerstartupstreamsmonitor)

Richard

Cool, you’re welcome. Glad that was right for you.

Richard

Here is a HTTProvider example with MediaCaster API usage:

https://www.wowza.com/docs/how-to-parse-post-or-get-variables-in-an-http-provider

In a Module you might have a IClient or IMediaStream or other parameter, and you can always get to the application instance somehow.

public void doSomething(IClient client, RequestFunction function,
		AMFDataList params) {
	
	IApplicationInstance appInstance = client.getAppInstance();
}

Richard

Adam,

A Wowza application starts when it is used in some way then will unload after a minute of inactivity, by default. You can increase Application.xml /ApplicationTimeout, or set it to “0” to never timeout once it is started, and you can use this method to start an application when Wowza starts:

https://www.wowza.com/docs/how-to-use-a-server-listener-to-load-and-lock-an-appinstance-serverlistenerloadandlockappinstances

Richard

You can use the MediaCaster API in a Wowza module or HTTProvider or ServerListener:

https://www.wowza.com/docs/how-to-use-the-wowza-streaming-engine-java-api-to-start-and-stop-mediacaster-streams

And there is another approach that might work for you here:

https://www.wowza.com/docs/how-to-monitor-content-folder-for-sdp-and-stream-files-to-start-publishing-streams-serverlistenerstartupstreamsmonitor)

Richard

Omg, this second approach is amazing, I would never find it if wasnt for you, tyvm.

I wonder if it works for Wowza Media Server 3?

Hey Richard,

What you posted there looks very helpful to me for my application (which is a enterprise java app that will be used to programmatically control wowza). I had stumbled across the MediaCaster API and it looks like exactly what I need.

What I don’t understand is how I would get a reference to my applications (my IApplicationInstance implementations) to begin with? Thanks in advance.

  • Adam

Richard,

Thanks for the reply. It looks like access to the applications is readily available when implementing a module. I’m going to start looking into the HTTPProvider interface next.

In regards to working with an implementation of IModuleOnApp: events are fired when an App starts and stops and thats when the onAppStart() and onAppStop() methods are called, correct?

When does Wowza consider an app to have ‘started’? ‘Stopped’? Does the app have to be actively streaming? Or is it simply that by virtue of being one of the defined/configured in the ‘conf’ directory it is ‘started’ when Wowza Media Server is started?

Is there a case when an app would be started after the server is running or stopped before the server is stopped?

Thanks in advance.

  • Adam