Results 1 to 6 of 6

Thread: Live Stream Switching & Previewing

  1. #1

    Default Live Stream Switching & Previewing

    Hi guys.

    Having looked around the Wowza site, I haven't been able to figure out if what we'd like to do is possible. We're trying to achieve the following:

    - Multiple live streams are ingested by Wowza.
    - A single live stream is produced from Wowza, this will be one of the ingested streams as switched by our app. The switching could occur multiple times during a live event.

    So far so vanilla, I believe we can achieve this using (we'll need to do the control over HTTP, but I should be able to adapt the example to do this.)

    However, we'd like to be able to preview all of the ingested streams. In this way, the person co-ordinating the live event can check a stream is ready before switching it into the client viewed stream. I haven't been able to figure out if it's possible to view a stream if it hasn't been set as the live stream in the example above. Could you clarify if this is possible please?

    Many thanks,


  2. #2


    Hi Henry,

    Yes that is possible. You can use the original source stream names in the player.

    When a stream is switched, the timing may not be exactly as expected because of player buffering. It would be best to set the buffer to 0 on the preview player. This will ensure you are viewing the latest frames.

    Also see the following example, it has a more complete set of commands for controlling the streams.

    If you need finer control over the switching, you can access the Publishing Provider API directly. This is the api that the Stream class uses.


  3. #3


    That's great, thanks for clearing that up Roger. You guys give top rate support !



  4. #4


    Hi Roger.

    I've got this up and running, but I seem to be having a few issues.

    I've setup 3 input streams (two live streams, one looping MP4) and one output stream which is sourced from a playlist. There's a playlist associated with each input stream, so essentially I've implemented as per this example.

    The problem I have is that although I can get an RTMP stream output from all 4 streams, I only seem to get an HLS stream output from one of them. It seems to depend on which playlist I initially open. A typical failure entry in the log is:

    WARN    server  comment 2014-02-19      13:25:44        -       -       -       -       -       1199.285        -       -       -       -       -       -       -       -       HTTPStreamerAdapterCupertinoStreamer.onPlaylist[livedesktop/ZrhTNFe9Gr4_aac/playlist.m3u8?wowzasessionid=1]: Not valid stream name [1][_defaultVHost_:livedesktop/_definst_/ZrhTNFe9Gr4_aac]: _defaultVHost_:livedesktop/_definst_/streamH47uP_aac
    This is from making a request to: which is the URL of the stream associated with the playlist.

    Whilst it would be nice to have an HLS stream for all output streams, it's only really important for me to have an HLS stream from the playlist sourced stream. I've attached the code (from a Wowza module I wrote) for the method I call before we start our live event.

    Do you have any idea what I'm doing wrong?



    	private void setupLiveStreams(IVHost vHost, IHTTPRequest httpRequest, IHTTPResponse httpResponse) throws MissingParameterException {
    		String applicationName = readRequiredParameter(httpRequest, "applicationName");
    		IApplication application = vHost.getApplication(applicationName);
    		IApplicationInstance applicationInstance = application.getAppInstance("_definst_");
    		String outputStreamName = readRequiredParameter(httpRequest, "outputStreamName");
    		String inputStreamName = readRequiredParameter(httpRequest, "inputStreamName");
    		writeLog("Starting streaming from inputStreamName: " + inputStreamName + " to outputStreamName: " + outputStreamName);
    		Playlist inputStreamPlaylist = new Playlist(inputStreamName + "_source_playlist");	
    		inputStreamPlaylist.addItem(inputStreamName, -2, -1);	
    		// FIXME: filename should be included in request.
    		Playlist pauseStreamPlaylist = new Playlist(inputStreamName + "_paused_playlist");	
    		pauseStreamPlaylist.addItem("mp4:waiting.mp4", 0, -1);	
    		Playlist encoderStreamPlaylist = new Playlist(inputStreamName + "_encoder_playlist");	
    		encoderStreamPlaylist.addItem(inputStreamName + "_encoder", -2, -1);	
    		Stream outputStream = Stream.createInstance(applicationInstance, outputStreamName);
    		applicationInstance.getProperties().setProperty(outputStreamName, outputStream);
    		applicationInstance.getProperties().setProperty(inputStreamPlaylist.getName(), inputStreamPlaylist);
    		applicationInstance.getProperties().setProperty(pauseStreamPlaylist.getName(), pauseStreamPlaylist);
    		applicationInstance.getProperties().setProperty(encoderStreamPlaylist.getName(), encoderStreamPlaylist);
    		// Start streaming from playlist to stream.;
    		writeSuccess(200, httpResponse, "Successfully setup live streams.");

  5. #5


    In fact, if I change the the line :;
    (the penultimate line in the code above)

    I get an HLS stream from the playlist based output stream, but then not from the source input stream (i.e. 'inputStreamName' in the code above)

    Why does the playlist I start on affect whether or not I get an HLS stream from the playlist based output stream?

  6. #6



    The reason you are getting that error is because you are requesting a stream that is not currently being published.

    Make sure the stream defined by inputStreamName is actually running at the time you switch to that playlist.

    You can also put everything into one playlist and then just switch to that item when you are ready. As long as you have a static mp4 file in your playlist then it will run that if there are no live sources.

    See class in the api documentation that comes with Wowza. It has methods for controlling which items get played.

    How to dynamically control Stream class streams is an example of a few of these methods.


Similar Threads

  1. Help please!! I can't see the live streaming in Mac & iPhone & iPad
    By timtang1982 in forum Live Streaming and Encoder Discussion
    Replies: 3
    Last Post: 08-27-2013, 06:24 AM
  2. switching live input steams to 1 output stream at sever
    By cblzaccie1 in forum Wowza Streaming Engine functionality
    Replies: 2
    Last Post: 05-11-2013, 04:25 PM
  3. Once more about switching between "live live" stream and "file-based live" stream
    By mudropolk in forum Live Streaming and Encoder Discussion
    Replies: 11
    Last Post: 04-25-2012, 06:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts