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 an 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.

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>
      <!-- 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.
  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 as 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>
      <!-- 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/live/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/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 Wowza Streaming Engine is running.