Start and stop MediaCaster streams with the Wowza Streaming Engine Java API

MediaCaster provides a way to start and stop RTMP and RTSP/RTP streams on-demand in Wowza Streaming Engine™ media server software, allowing you to re-stream IP camera streams (RTSP/RTP streams), SHOUTcast/Icecast streams, streams from native RTP or MPEG-TS encoders, HLS streams, and RTMP streams.

MediaCaster pulls a stream from a source and makes it available on-demand to all supported player technologies. When the first request is received from a player for a given stream, MediaCaster connects to the source and makes the stream available to the player. When the last player stops watching the stream, MediaCaster waits for a timeout period. If no other players request the stream, the stream is stopped until another request is made.

Note: MediaCaster doesn't work for MPEG-DASH streaming, which requires packetization.
You can use the Wowza Streaming Engine Java API to start and stop MediaCaster streams as part of the IApplicationInstance interface. The utility method
IApplicationInstance.startMediaCasterStream(streamName, mediaCasterType);

starts a MediaCaster stream.

The utility method


stops a MediaCaster stream.

The streamName parameter is the name of the stream you're starting or stopping, including the .stream file extension.

The mediaCasterType parameter defines the type of stream. Valid mediaCasterType values are:

  • liverepeater - Streams pulled using the RTMP protocol or via the WOWZ protocol from another Wowza Streaming Engine instance.
  • rtp -IP camera streams, both RTSP and RTP, and for streams from native RTP and MPEG-TS encoders
  • shoutcast - SHOUTcast/Icecast streams
  • rtp-record and shoutcast-record - Re-stream and record RTP and SHOUTcast/Icecast streams, respectively.
  • applehls - HLS streams pulled from a live source.
  • mpegtstcp - MPEG-TS streams pulled from a live source over TCP.
  • srt - Accept SRT connections.

Here are some example queries.

Start an RTSP stream named

appInstance.startMediaCasterStream("", "rtp");

Stop an RTSP stream named

Start a SHOUTcast stream named
appInstance.startMediaCasterStream("", "shoutcast");

Stop a SHOUTcast stream named

Start an RTMP stream named from any source that allows RTMP playback:
appInstance.startMediaCasterStream("", "liverepeater");

Stop an RTMP stream named from any source that allows RTMP playback: