I've implemented a stream switching application using this example
This works well bar one issue. When I swap streams, I end up showing about 1 seconds worth of 'extra' content from the new stream, i.e. content that was being streamed before the switch.
For example :
* Two inputs, one a looping mp4, one a camera stream.
* The (Wowza) application is setup to show the looping video.
* I wave at the camera then immediately run a command to switch the output stream to the camera.
* The output stream switches from the looping mp4 to the camera, and shows me waving.
I had hoped that the swap should swap the stream in realtime, i.e. any content sent prior to the swap would not be shown. However, it would seem Wowza is buffering (or some such) the input stream, leading to the approximate 1s delay.
To test this, when requesting a switch I introduced a Thread.sleep(1000L) in my code, and this fixes the issue. However, clearly this only works if the delay is consistent across streams and across the hardware hosting Wowza.
So two questions:
i) Is the delay consistent?
ii) If not, is there a way to programmatically measure the delay, so I can introduce a corresponding delay in stream switching?