This article describes how to use the Wowza Streaming Engine™ media server software ServerListenerStreamDemoPublisher server listener to publish a video-on-demand file as a live stream. The file will loop endlessly.
Note: This setup is basic and static. Other, more dynamic solutions are offered in the following articles:
- Add the following <ServerListener> to the <ServerListeners> list of [install-dir]/conf/Server.xml:
<ServerListener> <BaseClass>com.wowza.wms.module.ServerListenerStreamDemoPublisher</BaseClass> </ServerListener>
- Add the following property to the <Properties> container at the bottom of [install-dir]/conf/Server.xml:
<Property> <Name>streamDemoPublisherConfig</Name> <Value>appName=live,srcStream=mp4:sample.mp4,dstStream=myStream,sendOnMetadata=true</Value> </Property>
- Configure any of the following:
- appName – Application name, in the form application/appInstance (appInstance can be omitted).
- dstStream – Destination stream name.
- playlistRepeat – If true, the file or playlist is repeated. Formerly called repeat.
- publishDuration – Time, in seconds, the stream will publish (format: HH:MM:SS.mmm).
- publishPauseTime – If publishRepeat is set to true, the time, in seconds, the stream pauses before being republished (the format is HH:MM:SS.mmm, default is 1 second).
- publishRepeat – If true, the stream is re-published in a loop after the publishDuration time has elapsed (publishDuration must be greater than zero, default is false).
- random – If true and if using an M3U8 playlist, the items in the playlist are streamed in a random order.
- sendOnMetadata – If true, instructs the publisher to send onMetadata events.
- speed – Playback speed. This is a floating point value that can be negative (default is 1.0, be careful with this one - may not work in all cases).
- srcStream – Name of video file to stream as live content (MP4, MP3, FLV, and M3U8 files are supported).
- timeBetweenItems – Time, in milliseconds, between playlist items (default is 80 milliseconds).
- vhostName – Virtual host (VHost) name. If omitted, the stream will be created for all VHosts.
- You can publish multiple live streams by adding them to the property value as a list of entries delimited by the pipe (|) character. For example:
<Property> <Name>streamDemoPublisherConfig</Name> <Value>appName=live,srcStream=mp4:sample.mp4,dstStream=myStream,sendOnMetadata=true|appName=live,srcStream=mp4:sample.mp4,dstStream=myStream2,sendOnMetadata=true</Value> </Property>
- You can also publish a playlist of files by creating a text file in the [install-dir]/content folder with the .m3u8 file extension. This file should contain simple streams names on each line like this (for this example we will use the file name filelist.m3u8):
mp4:sample.mp4 mp4:file2.mp4 mp4:file3.mp4
- To play this playlist, use a streamDemoPublisherConfig value like this:
<Property> <Name>streamDemoPublisherConfig</Name> <Value>appName=live,srcStream=m3u8:filelist.m3u8,dstStream=myStream,random=false,timeBetweenItems=250</Value> </Property>
- To configure a stream to play for 10 seconds, pause for 2 seconds, and then repeat, use a streamDemoPublisherConfig value like this:
<Property> <Name>streamDemoPublisherConfig</Name> <Value>appName=live,srcStream=mp4:sample.mp4,dstStream=myStream,random=true,publishDuration=10,publishRepeat=true,publishPauseTime=2</Value> </Property>
- After configuring your VOD asset to play as a live stream, you can use your player or the test players on the Video Test Player webpage to verify that it's playing properly. For more information, see Test playback.