Publish live streams using server side API (without .stream files)

Hi!

How can we publish a stream without .stream file?

I search through the forum and articles, and saw couple of similiar questions, but no answer.

What we would like to achieve, is Wowza reading configuration from remote server and publishing/unpublishing streams according to the data. So lets say it gets the following (pseudo)data:

{

“stream1”:“rtmp://server1/app1/stream1.stream”,

“stream2”:“udp://127.0.0.1:6550”

}

and now we want to publish those streams. Could not find any method that would accept plain URL instead of .stream file.

Many thanks, Alex.

Hi Alex,

You can use the Streamname Alias Addon or the Alias API

Richard

I corrected previous to show the Alias API rather than MediaCaster API, but you will need that, or the alias addon, too.

You need to alias the stream URLs for most players and most uses. A URL stream name will work in Wowza test players, but not in most or any commercial players.

This is what you need to do:

UDP/RTSP source > pull with Wowza MediaCaster > Alias (addon or api) resolver > Stream Class Publisher.

String streamname = "udpsource"
MediaCasterStreamMap mediaCasterMap = appInstance.getMediaCasterStreams();
MediaCasterStreamItem mediaCasterItem = mediaCasterMap.acquire(streamName);
publisher.setStreamSource(streamname);
publisher.publishStream();

To support the above with the StreamNameAlias addon, you would have a rule in the stream alias file like this:

udpsource=udp://127.0.0.1:6350

Richard

Alex,

I mention using the alias addon which involved configuration files, but you can use the alias api instead.

Richard

Cool! Thanks for the update, Alex.

Richard

Hi Alex,

the resolveStreamAlias methods normally only get called once when the mediaCaster first starts and doesn’t get called when it resets.

The simplest way would be to stop & start the mediaCaster when the url changes. This will ensure that the method is called properly.

It is possible to manually change the url after a reset occurs but just before the new connection is made but it can be a complicated process.

Roger.

Hi Richard,

thank you for reply. Those were the first articles we examined. But once again, those methods operate stream names only, no option to provide stream URL.

We need something like that:

publisher.setStreamSource(“udp://127.0.0.1:6350”);

publisher.publishStream();

if you see what i mean. Stream name does not matter, we can change it with Alias or whatever else, what matters is actual data source for the stream being published.

Many thanks, Alex.

It once again invoke a necessarity to have some preconfigured files. We try to avoid it to have fully dynamical system, where streams configuration can be automatically changed on the fly with commands from remote server.

Lets say there is a server that implements business logic and rules, and numerous Wowzas that read configuration from there (or being notified by Server about updates) and change streams accordingly. Remove old ones, create new ones, change source URLs.

So far the closest option we found is to read the configuration from remote Server, update stream files from Java code, and use MediaCaster to stop/start updated stream file. But we look forward to better option that does not involve files and just allow to create and delete streams from code?

Many thanks, Alex.

Thank you Richard, looks like we got there with alias API.

MediaCasterStreamManager starts stream, URL resolved by IMediaStreamNameAliasProvider2 to URL1.

Now update came, logic in AliasProvider changed, it would resolve same stream to URL2.

Is there any method to force stream to re-request URL from AliasProvider and connect to new URL, or it needs to be fully stoped and started again from MediaCasterStreamManager?

Thanks!