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

    You can add a server listener that monitors an application's content folder for added and deleted .sdp and .stream files. When a new file is detected, the stream manager is used to start the stream. When a file is removed, the stream manager is used to stop the stream. This article describes the configuration.

    Configure your application for live streaming using one of the following tutorials:


    Next:

    1. Edit [install-dir]/conf/Server.xml and make the following changes:

      1. Add the following <ServerListener> to the <ServerListeners> list:
        <ServerListener>
        	<BaseClass>com.wowza.wms.serverlistener.ServerListenerStartupStreamsMonitor</BaseClass>
        </ServerListener>
      2. Add the following properties to the <Properties> container at the bottom of the file:
        <!-- Pipe (|) delimited list of application names for which to monitor: [vhostName]:[application]/[appInstance] -->
        <!-- This can be shorted to [application] assuming using _defaultVHost_ and _definst_ as the vhost and appInstance names -->
        <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>
        Note: Modify the properties as needed for your streaming setup.
    2. Edit [install-dir]/conf/live/Application.xml and make the following changes:

      1. Create a non-shared content folder for the live application by setting the Streams/StorageDir property as follows:
        <StorageDir>${com.wowza.wms.context.VHostConfigHome}/applications/${com.wowza.wms.context.Application}/content</StorageDir>
      2. Add the following properties to the <Properties> container at the bottom of the Application.xml file (be sure to get the correct <Properties> container - there are several in the file):
        <!-- 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>
        Notes:
        • Modify the properties as needed for your streaming setup.

        • The values specified here override the values specified in [install-dir]/conf/Server.xml.
    3. Create the folder [install-dir]/applications/live/content. This folder is the folder that will be monitored for new .sdp and .stream files.

    4. Start Wowza Media Server.


    With the above configuration in place, streams are automatically started and stopped as .sdp and .stream files are added and removed from the [install-dir]/applications/live/content folder.

    Notes:
    • This system can monitor more than one application at a time. Set the startupStreamsMonitorApplicationList to a pipe (|) delimited list of applications for which you want monitoring to occur. For example, to monitor the applications live1 and live2 set startupStreamsMonitorApplicationList as follows:
      <Property>
      	<Name>startupStreamsMonitorApplicationList</Name>
      	<Value>live1|live2</Value>
      </Property>
    • The application instances that are monitored will be loaded but not unloaded. This is so the stream monitor can continue to start and stop streams while the Wowza Media Server is running.


    If you're having problems or want to discuss this article, post in our forum.