Wowza Community

Is there a way to switch the input live stream?

I have more than one input live stream from other source.

Is it possible to set only 1 output stream from wowza server and when it is needed I can switch between the input live streams to publish the selected one to the output stream?

If I remember correctly, yes, it is possible, but it requires some development work.

I would start with implementing the IServerNotify interface, override public void onServerInit(IServer) and use something along those lines (far from functional example:)

List VirtualHosts = VHostSingleton.getVHostNames(); // … list of virtual hosts

IVHost vhost = VHostSingleton.getInstance(VHostName); // get vhost instance

Stream s = Stream.createInstance(vhost, AppName, StreamName); // create stream name (this is your “1 output stream”)

s.play(FileName, 0, -1, true); // just play something, in my case its a video clip

I’m sure there are better examples if you search around the forums. All I’d have to do with above is figure out how to stream live stream sources and how to control the streaming. That, I hope, should be possible :wink:

The most important function for this is Stream.play. You will probably call this when ever you want to change the input for this output stream that is created.

Right, use Stream class streams. Here are a couple of other examples to look at:

https://www.wowza.com/docs/how-to-schedule-streaming-with-wowza-streaming-engine-streampublisher

https://www.wowza.com/docs/how-to-switch-streams-using-stream-class-streams

Richard

If you know exactly what sequence you want to stream, you can just use the scheduler, the first link. If you want to be able to switch dynamically in any way you will have to have a controller of some type, most likely a Flash RTMP application that one person will operate to modify the stream that everyone can see. That is quite involved but there is a starting place in this example:

https://www.wowza.com/docs/how-to-control-stream-class-streams-dynamically-modulestreamcontrol

Richard

Thanks you all

but i still have a few questions(i am a noob:<).

the example use ActionScript to switch the stream,does that mean the switch action is controlled by the user?or if the switch action is done all user will see the switched stream?

What I want to achieve is the server side control the switch and the client side would think it as a normal single live stream.

Thanks for the reply, I will look into it:)