Monitor, start, and stop .sdp and .stream files in a Wowza Streaming Engine live application

Use the Wowza Streaming Engine™ media server software ServerListenerStartupStreamsMonitor server listener to monitor a live application's content folder for added and deleted .sdp and .stream files. When a new file is detected, the stream manager starts the stream. When a file is removed, the stream manager stops the stream. This article describes the configuration.

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: [vhost-name]:[application-name]/[app-instance] -->
    <!-- This can be shorted to [application-name] assuming using _defaultVHost_ and _definst_ as the vhost and application instance names -->
    <Property>
        <Name>startupStreamsMonitorApplicationList</Name>
        <Value>live1|live2</Value>
    </Property>
    <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>
    <!-- The following property is only available in Wowza Streaming Engine 4.1.1 or later -->
    <!-- Enable the detection of modified files. If enabled, affected streams will be stopped and restarted when modifications are detected.-->
    <Property>
        <Name>startupStreamsMonitorFileModification</Name>
        <Value>true</Value>
    </Property>
    Note: Modify the properties as needed for your streaming setup.

Next, edit [install-dir]/conf/[application-name]/Application.xml and make the following changes:

  1. Create a non-shared content folder for your 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 as there are several in the file:
    <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>
    <!-- The following property is only available in Wowza Streaming Engine 4.1.1 or later -->
    <!-- Enable the detection of modified files. If enabled, affected streams will be stopped and restarted when modifications are detected.-->
    <Property>
        <Name>startupStreamsMonitorFileModification</Name>
        <Value>true</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/[application-name]/content. This folder will be monitored for new .sdp and .stream files.
     
  4. Start Wowza Streaming Engine.
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/[application-name]/content folder.
 
Note: 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 Wowza Streaming Engine is running.