Wowza Community

How to connect a .stream file to an application using URL query.

I am using Wowza Streaming Engine 4 (4.1.0 build12602), just upgraded from Wowza Media Server 3.6.3.

I need to be able to re-stream IP cameras on demand (not pre-configured and also without the need for restarting the server).

In Wowza Media Server 3, I used the .stream files for re-streaming the IP cameras. So whenever I wanted to receive a stream from a new camera I just created a ‘mycamera.stream’ file in the ‘applications/live/content/’ folder and then I could immediately play that stream in a player by setting the stream name to ‘mycamera.stream’.

This is important because I had control over which streams are being consumed from cameras at any given time using an external app (on the server) that creates the .stream files for me.

However. in Wowza Streaming Engine 4, I don’t have that control anymore, I must use the Wowza Streaming Engine Manager manually to start re-streaming the IP cameras.

First of all, I have been looking for a way of creating a .stream file (with a desired name like ‘mycam-01.stream’) using URL queries, but it seems that I can’t. That is ok because I can always just creat the file using a custom web api on the server that I can develop myself.

The problem is that in Wowza Streaming Engine 4, after a .stream file is created in the ‘content’ folder, I can’t just play the stream because it requires from me to connect the .stream file to an application. This is new and I no longer have control over creating streams of IP cameras dynamically. I have to use the Wowza Streaming Engine Manager to connect the generated .stream file to an application by opening the ‘Stream Files’ tab and clicking the ‘Connect to this stream’ button near the desired stream.

Is there a way to connect a .stream file to an application using a URL query? Or alternatively, is there a way to configure the server to connect automatically all created .stream files to a certain application (e.g. ‘live’)?

I am not sure but, I think I had a configuration in the old Wowza (WMS3) that tells the server to listen for created/deleted .stream files in folder ‘applications/live/content/’.

in WMS 3.6.3:

in ‘/conf/Server.xml’ I put:

com.wowza.wms.serverlistener.ServerListenerStartupStreamsMonitor

in ‘/conf/live/Application.xml’ I put:

startupStreamsMonitorStreamPrefix

mp4

startupStreamsMonitorMediaCasterType

liverepeater

startupStreamsMonitorExtensionFilter

.stream|.sdp

Again, I am not sure this what helped me achieving the automatic connection of .stream files to the ‘live’ application.

Can you please tell me how do I overcome my problem and connect dynamically generated .stream files to an application so it can be played immediately?

Much thanks!

Hi,

The server listener in Server.xml looks ok. Try removing the property definitions out of your Application.xml and add the following into the section at the bottom of /conf/Server.xml.

<Property>
	<Name>startupStreamsMonitorApplicationList</Name>
	<Value>live</Value>
</Property>
<!-- Stream prefix. Valid values are: flv and mp4 -->
<Property>
	<Name>startupStreamsMonitorStreamPrefix</Name>
	<Value>mp4</Value>
</Property>
<!-- MediaCaster type. Valid values are: rtp, rtp-record, shoutcast, shoutcast-record, liverepeater -->
<Property>
	<Name>startupStreamsMonitorMediaCasterType</Name>
	<Value>rtp</Value>
</Property>
<!-- Pipe  (|) delimited list of file extensions for which to search -->
<Property>
	<Name>startupStreamsMonitorExtensionFilter</Name>
	<Value>.stream|.sdp</Value>
</Property>

Restart Wowza and you should see the following entries in your access log file if the monitor is configured correctly (in this case, startupStreamsMonitorApplicationList is set to the application called ‘live’)

ServerListenerStartupStreamsMonitor: Add application instance: _defaultVHost_:live/_definst_
ServerListenerStartupStreamsMonitor#StartupStreamsAppInstance.init[_defaultVHost_:live/_definst_]: Monitoring folder: /usr/local/WowzaStreamingEngine/content 
ServerListenerStartupStreamsMonitor: Monitor thread started.

Paul

Thank you for the update and glad to hear you got this sorted.

Please let us know if you have any other questions in the future.

Kind regards,

Salvadore

Mando, this module is what you are looking for:

How to monitor content folder for .sdp and .stream files to start publishing streams (ServerListenerStartupStreamsMonitor)

Each Wowza application can (and in this case expects to) have its own “content” folder.

Regards,

Salvadore

Hi,

Thanks for your response!

I got this in the console log:

ERROR server comment - ServerUtils.loadServerListener: Error creating (com.wowza.wms.plugin.serverlistener.ServerListenerStartupStreamsMonitor) : java.lang.ClassNotFoundException: com.wowza.wms.plugin.serverlistener.ServerListenerStartupStreamsMonitor|at java.net.URLClassLoader$1.run(URLClassLoader.java:372)|at java.net.URLClassLoader$1.run(URLClassLoader.java:361)|at java.security.AccessController.doPrivileged(Native Method)|at java.net.URLClassLoader.findClass(URLClassLoader.java:360)|at java.lang.ClassLoader.loadClass(ClassLoader.java:424)|

INFO server comment - ServerListenerVariables.populateEnvironment: hardcoded INSTANCE_TYPE to A1. Microsoft

It seems like I’m missing the module: com.wowza.wms.serverlistener.ServerListenerStartupStreamsMonitor.

Do you know where I can download it? I tried googling this but there were only 2 search results without the file.

Thanks!

Ok the problem was that I wrote a wrong name for the plugin:

com.wowza.wms.plugin.serverlistener.ServerListenerStartupStreamsMonitor

it should be:

com.wowza.wms.serverlistener.ServerListenerStartupStreamsMonitor

I have followed this article: https://www.wowza.com/docs/how-to-monitor-content-folder-for-sdp-and-stream-files-to-start-publishing-streams-serverlistenerstartupstreamsmonitor

Thanks Paul!

I was having the same problem as amgman when I did my 3.6 to 4.2 upgrade. Thanks for the help on this one. I do want to take this concept one step farther if I can. Is there a way to do this on the individual application level? What I mean is I can add/remove a file from the content folder and StartupStreams.xml and run a “service WowzaStreamingEngine restart” from terminal. That starts up the stream and all is well. I would like to use a different content folder for each application (e.g. applications being live and live2 and so on) so that I can add .stream files to start them in different applications. Is this possible and if so what is the method to restart the application for this to take effect.

Ok to make sure I understand how this works. This bypasses the StartupStreams.xml and actively listens for each file. I will still need to add an entry into PushPublishMap.txt to get the outbound traffic started. Is there a way to stop the outbound stream when for example I comment out the correct line in PushPublishMap.txt?