Wowza Community

Keep stream alive after unpublish using LoopUntilLive


I am streaming to mobile devices using HLS and am running into a problem where the connection will cut out as soon as a stream is unpublished. I would like to keep the connection alive in-bewteen publishes and thought this solution would work:

It works as expected when the stream starts and will loop the vod until a stream is published, and then switch to the new source. However, once that source is unpublished, the stream cuts out and does not switch back over to the vod. My smil file is the same as the one in the link above. Will a change to the smil file add this functionality or should I be looking at a different solution?


What type of cameras are being used for the published streams @Jonathan Brewer? Mobilephone? IP camera?

More detail on the source stream please. Thanks!

@Rose Power I am publishing from mobile using HaishinKit (RTMP) with the goal of transrating into lower bitrates and streaming over HLS. The idea is to have multiple phones able to publish to the same stream and provide uninterrupted transition between publishes. If no one is publishing, then a vod is looped until a publish starts. If a new user publishes over a current publish, then the stream switches to the newest publish.

What is the best workflow/stream setup to accomlpish this? Am I on the right track with the above module?

Many thanks for your help.

Oh I see, thanks for that info. Let me see what I can find out. You may need to walk through this with the engineers in a support ticket, but let me try first. Thanks!

The workflow you are following is correct and it should be switching over to the VOD when a source is unpublished.

I’ve been asked to have you submit a support ticket so the engineers here can run some tests on your config. Please give us an update in the forum when it is resolved if you don’t mind doing so.

Hello Jonathan,

I have set this type of workflow for one of my clients. So the idea is that you have one or more VOD video files looping and waiting for LIVE stream to start. When LIVE stream is started module replaces looping video with LIVE and when LIVE stream ends or gets disconnected for whatever reason it would play VOD video instead of nothing.

I had a problem where LIVE stream gets unpublished and it did not switch back to filler VOD video. In the end i found that the problem is not with different encoding profiles, bit-rates etc. but in different audio frequency (Hz). Live stream had 44100 Hz but the VOD was encoded @48 000 Hz.

When i aligned audio frequency on both LIVE and VOD (filler video) - i had no problem switching back and forth.

Appreciate you sharing this @Edgars Kacerovskis.

Thanks for the suggestion @Edgars Kacerovskis. I just tried playing around with matching up bitrates and sample rates for both the audio and video but it had no effect. Did you need to make any changes to the smil file?

OK. I’ll just explain how i have it configured and maybe you’ll see some difference in your configuration.

  1. In Application/Modules i have two modules configured - in this order:
    (when i had streamPublisher above the ModuleLoopUntilLive i had some problems with switching (don’t remember what they were exactly).

  2. Under Application/Properties/Custom add
    /Root/Application streamPublisherSmilFile String XXX.SMIL (this is where you type SMIL name where you have your filler VOD’S listed) you need to create this in /content directory. This SMIL (will start replacement streams when WowzaStreamingEngine service starts).

    My SMIL template:

    You can add more than one mp4 by adding

    Also you can add more streams (many “Bitrates”)

    /Root/Application loopUntilLiveOutputStreams String here you place (replacement stream) - you can add many stream just seperate them with comma -, etc.

    /Root/Application loopUntilLiveSourceStreams String here you post LIVE stream name ( that will replace when your LIVE goes live.

    Same story as replacement streams:, (just remember that you have to keep streams in order. First replacement stream will monitor to come online , second replacement will check etc.)

  3. Now you create another SMIL file (for playback) and in this SMIL read and or in two seperate SMIL’S if those are two different live streams.

    So if LIVE stream is OFF then VOD filler video will loop if LIVE comes online it will switch to LIVE and back to VOD when LIVE ends.

    Also one NOTE: i had to configure Application/Properties/Custom /Root/Application/LiveStreamPacketizer CalculateChunkIDBasedOnTimecode to FALSE - since timecode on LIVE and VOD filler are different and this gets Wowza confused.

    Hope this helps.