Wowza Community

Switching live streams accurately

Hi,

I have 2 live streams, currently two still images streamed by ffmpeg. I have compiled this example and made the small modification to get switches between the 2 live streams every 10 seconds.

My problem is that even though I am seeing the switches accurately logged every 10 seconds, in my player (using the test players on this site) I am seeing unpredictable switch times. It is sometimes 70s, sometimes 30s, sometimes just a quick blink for 1s, and so on. I assume this is related to the chunking and player buffering, however I would like to get a solution which allows me to switch from one live stream to an other in a precisely timed way.

Is there any way to fix this approach?

What does “setStartOnPreviousKeyFrame” mean, the term “previous” refers to what point in time?

Why is it necessary that this example keeps calling “provider.play(publisher)” in the loop?

Any help is appreciated, thanks!

Hi,

The simpler approach which should work better for you situation is to use play listing , so you put both streams into a playlist and switch between them. You can see how this works here

How-to-loop-a-pre-roll-until-a-live-stream-starts

The source code is found in the module collection. You will need to add your own switching calls, but you can do this by calling next on the active playlist.

Andrew

I’ve tried both examples and I have the same problem described here… a delay of over 30s between the logs of a stream switch and the actual switch happening on the player. Any hints?