Loop a pre-roll until a live stream starts with a Wowza Streaming Engine Java module

By creating a server-side stream, you can loop another video as a filler video in place of a live stream that isn't available. For this to work, you must create a server-side stream that has the video that will be used in place of the live stream. Then you can use the Stream Publisher ModuleLoopUntilLive application module for Wowza Streaming Engine™ media server software to detect when the live stream is available and switch from the filler video to the live stream. When the live stream ends, it will switch back to the filler video.


For developers


Wowza Streaming Engine 4.0.0 or later is required.

At least one server-side stream must be configured on the Streaming Engine live application. There are various methods to do this; however, this article shows how to do this by using a single stream that's configured by following the instructions in Schedule streaming with a Wowza Streaming Engine Java module.

You can also create server-side streams by using the stream class. See Do basic server-side publishing with the stream class and Wowza Streaming Engine Java API.

Note: This module uses an internal Application Instance level property to reference each of the server-side streams created by the Stream Publisher. If you use the stream class to create a server-side stream, then your implementation must create this property when the stream is created and remove it when the stream is closed.  
Name: <name of the server side stream>
Value: <The Stream class instance>
Type: com.wowza.wms.stream.publish.Stream


  1. Download wse-plugin-streampublisher.zip.
  2. Extract the contents from the downloaded (zipped) package, and then copy the lib/wse-plugin-streampublisher.jar file from the package to the lib folder in your Wowza Streaming Engine installation ([install-dir]/lib).
  3. Restart Wowza Streaming Engine.
Note: The ModuleLoopUntilLive application module is included in the StreamPublisher module download package. StreamPublisher lets you use a server listener and application module to create a schedule of streams and playlists. For more information, see Schedule streaming with Wowza Streaming Engine (StreamPublisher).


To enable this module, add the following module definition to your application. See Configure modules for details.

Fully Qualified Class Name
ModuleLoopUntilLive Loops filler video until live video is available. com.wowza.wms.plugin.streampublisher.ModuleLoopUntilLive


After enabling the module, you can adjust the default settings by adding the following properties to your application. See Configure properties for details.

/Root/Application loopUntilLiveSourceStreams String myStream See Notes below. This is the list of live source streams that are published to the application. The source can be a single stream name or a comma-separated list of names (for example: myStream, myOtherStream). (default: myStream)
/Root/Application loopUntilLiveOutputStreams String Stream1 See Notes below. This is the list of server-side streams created by the Stream Publisher. The source can be a single stream name or a comma-separated list of names (for example: Stream1, Stream2). (default: Stream1)
/Root/Application loopUntilLiveReloadEntirePlaylist Boolean true (Optional) If the server-side stream has multiple items, setting to true ensures that all items are reloaded and that playback starts from the next item in the list. If set to false, only the item that was playing at the time the live stream started is reloaded. (default: true)
/Root/Application loopUntilLiveHandleMediaCasters Boolean true (Optional) If the live stream is a MediaCaster stream, special care is needed to ensure that it switches at the correct time when the MediaCaster is ready and receiving a stream. Setting to true ensures that this happens. If set to false, the switch occurs when the MediaCaster is created and will switch back after it's destroyed. (default: true)
  • The loopUntilLiveSourceStreams and loopUntilLiveOutputStreams properties must include the same number of names in each list. The first name in each list will map to the first name in the other list, the second will map to the second, and so on. This allows you to configure multiple source and output streams for an application.
  • The stream names listed in the loopUntilLiveOutputStreams property are used for playback.

Stream Publisher configuration

The following example SMIL file is used by the Stream Publisher to create a single output stream called Stream1. (For more information, see Schedule streaming with Wowza Streaming Engine (StreamPublisher).) It will play sample.mp4 in a loop. When a live source stream (myStream) is published, the output stream will switch to the live source if the previous source used ModuleLoopUntilLive and the default settings shown above.


        <stream name="Stream1"></stream>

        <playlist name="pl1" playOnStream="Stream1" repeat="true" scheduled="2009-12-11 16:00:00">
            <video src="mp4:sample.mp4" start="0" length="20"/>

For developers

  • Get the source code on GitHub