Stream Class Example

This article shows a Stream class example.

  1. Compile the following server listener in the Wowza IDE:
    import com.wowza.wms.server.*;
    import com.wowza.wms.vhost.*;
    public class StreamPublisher implements IServerNotify {
    	public void onServerCreate(IServer server)
    	public void onServerInit(IServer server)
    		IVHost vhost = VHostSingleton.getInstance(VHost.VHOST_DEFAULT);
    		Stream stream1 = Stream.createInstance(vhost, "live", "Stream1");"mp4:sample.mp4", 5, 5, true);"mp4:sample.mp4", 50, 5, false);"mp4:sample.mp4", 150, 5, false);
    		Stream stream2 = Stream.createInstance(vhost, "live", "Stream2");"mp4:sample.mp4", 0, -1, true);
    	public void onServerShutdownComplete(IServer server)
    	public void onServerShutdownStart(IServer server)
  2. Add the server listener to /conf/Server.xml /ServerListeners:
  3. Create a Wowza application named live and change the Application.xml /StreamType to live.
  4. To play, open:
    [install-dir]/examples/LiveVideoStreaming/FlashRTMPPlayer/player.html (Wowza Media Server 3.5 and later)

    [install-dir]/examples/LiveVideoStreaming/client/live.html (prior version of Wowza Media Server)

    Server: rtmp://[wowza-ip-address]/live
    Stream: Stream1 (or Stream2)

Originally Published: 10-03-2010.

If you're having problems or want to discuss this article, post in our forum.