# Is there a way to switch the input live stream?

**URL:** <https://community.wowza.com/t/is-there-a-way-to-switch-the-input-live-stream/38909>\
**Category:** Wowza Streaming Engine\
**Created:** [July 9, 2012, 6:08pm UTC](https://community.wowza.com/t/is-there-a-way-to-switch-the-input-live-stream/38909 "2012-07-09T18:08:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yunfan\_lin](https://avatars.discourse-cdn.com/v4/letter/y/ce7236/32.png) [@yunfan\_lin](https://community.wowza.com/u/yunfan_lin)\
**Post date:** [July 9, 2012, 6:08pm UTC](https://community.wowza.com/t/is-there-a-way-to-switch-the-input-live-stream/38909/1 "2012-07-09T18:08:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Tit\_Petric](https://avatars.discourse-cdn.com/v4/letter/t/439d5e/32.png) [@Tit\_Petric](https://community.wowza.com/u/Tit_Petric)\
**Post date:** [July 10, 2012, 9:49am UTC](https://community.wowza.com/t/is-there-a-way-to-switch-the-input-live-stream/38909/2 "2012-07-10T09:49:04Z")

</div>

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 😉

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.

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [July 10, 2012, 1:51pm UTC](https://community.wowza.com/t/is-there-a-way-to-switch-the-input-live-stream/38909/3 "2012-07-10T13:51:34Z")

</div>

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-schedule-streaming-with-wowza-streaming-engine-streampublisher)

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

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [July 11, 2012, 1:51pm UTC](https://community.wowza.com/t/is-there-a-way-to-switch-the-input-live-stream/38909/4 "2012-07-11T13:51:47Z")

</div>

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](https://www.wowza.com/docs/how-to-control-stream-class-streams-dynamically-modulestreamcontrol)

Richard

---

<div class="post-metadata">

**Author:** ![yunfan\_lin](https://avatars.discourse-cdn.com/v4/letter/y/ce7236/32.png) [@yunfan\_lin](https://community.wowza.com/u/yunfan_lin)\
**Post date:** [July 10, 2012, 6:27pm UTC](https://community.wowza.com/t/is-there-a-way-to-switch-the-input-live-stream/38909/5 "2012-07-10T18:27:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![yunfan\_lin](https://avatars.discourse-cdn.com/v4/letter/y/ce7236/32.png) [@yunfan\_lin](https://community.wowza.com/u/yunfan_lin)\
**Post date:** [July 12, 2012, 8:41pm UTC](https://community.wowza.com/t/is-there-a-way-to-switch-the-input-live-stream/38909/6 "2012-07-12T20:41:37Z")

</div>

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