# Keep stream alive after unpublish using LoopUntilLive

**URL:** <https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095>\
**Category:** Wowza Streaming Engine\
**Tags:** wowza-streaming-server-java-api\
**Created:** [October 9, 2018, 4:38pm UTC](https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095 "2018-10-09T16:38:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Brewer](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@Jonathan\_Brewer](https://community.wowza.com/u/Jonathan_Brewer)\
**Post date:** [October 9, 2018, 4:38pm UTC](https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095/1 "2018-10-09T16:38:28Z")

</div>

Hello,

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: [https://www.wowza.com/docs/how-to-loop-a-pre-roll-until-a-live-stream-starts-loopuntillive](https://www.wowza.com/docs/how-to-loop-a-pre-roll-until-a-live-stream-starts-loopuntillive)

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?

Thanks.

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [October 9, 2018, 5:20pm UTC](https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095/2 "2018-10-09T17:20:25Z")

</div>

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

More detail on the source stream please. Thanks!

---

<div class="post-metadata">

**Author:** ![Jonathan\_Brewer](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@Jonathan\_Brewer](https://community.wowza.com/u/Jonathan_Brewer)\
**Post date:** [October 9, 2018, 6:14pm UTC](https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095/3 "2018-10-09T18:14:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [October 9, 2018, 7:04pm UTC](https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095/4 "2018-10-09T19:04:22Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [October 9, 2018, 8:08pm UTC](https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095/5 "2018-10-09T20:08:20Z")

</div>

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.

[https://www.wowza.com/support/open-ticket](https://www.wowza.com/support/open-ticket)

---

<div class="post-metadata">

**Author:** ![Edgars\_Kacerovskis1](https://avatars.discourse-cdn.com/v4/letter/e/dfb087/32.png) [@Edgars\_Kacerovskis1](https://community.wowza.com/u/Edgars_Kacerovskis1)\
**Post date:** [October 10, 2018, 2:58pm UTC](https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095/6 "2018-10-10T14:58:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [October 10, 2018, 2:59pm UTC](https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095/7 "2018-10-10T14:59:20Z")

</div>

Appreciate you sharing this @Edgars Kacerovskis.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Brewer](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@Jonathan\_Brewer](https://community.wowza.com/u/Jonathan_Brewer)\
**Post date:** [October 10, 2018, 9:20pm UTC](https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095/8 "2018-10-10T21:20:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Edgars\_Kacerovskis1](https://avatars.discourse-cdn.com/v4/letter/e/dfb087/32.png) [@Edgars\_Kacerovskis1](https://community.wowza.com/u/Edgars_Kacerovskis1)\
**Post date:** [October 11, 2018, 6:47am UTC](https://community.wowza.com/t/keep-stream-alive-after-unpublish-using-loopuntillive/52095/9 "2018-10-11T06:47:13Z")

</div>

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:  
ModuleLoopUntilLive  
streamPublisher  
(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).

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