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, and RTMP streams from another Wowza Streaming Engine server. 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 Adobe HDS, Apple HLS, Microsoft Smooth Streaming, or MPEG-DASH streaming, which require 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

IApplicationInstance.stopMediaCasterStream(streamName);

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 - RTMP streams pulled from another Wowza media server
  • 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.

Here are some example queries.

Start an RTSP stream named camera.stream:

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

Stop an RTSP stream named camera.stream:
 
appInstance.stopMediaCasterStream("camera.stream");

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

Stop a SHOUTcast stream named radio.stream:
 
appInstance.stopMediaCasterStream("radio.stream");

Start an RTMP stream named rtmp.stream from another Wowza Streaming Engine server:
 
appInstance.startMediaCasterStream("rtmp.stream", "liverepeater");

Stop an RTMP stream named rtmp.stream from another Wowza Streaming Engine server:
 
appInstance.stopMediaCasterStream("rtmp.stream");