Control live streams with GoCoder SDK for Android

Wowza GoCoder is sunset and should only be used with existing Ultra-Low Latency (ULL) streams until that technology is also sunset.

Learn how to start, stop, and monitor a live stream broadcast with Wowza GoCoder™ SDK for Android.

Before you begin

Before adding the functionality below to your app, make sure you've set up the Wowza GoCoder SDK for your project:

  • Request a free license and download the latest version of the SDK.
  • Configure your Android Studio project to use the SDK.

See Download and install GoCoder SDK for Android for detailed instructions.

Start streaming

Use the startStreaming method in the WowzaGoCoder class to start a live stream.

//Make sure streaming isn't already active
if (!this.goCoder.isStreaming()) {
  // Validate the current broadcast config
  WOWZStreamingError configValidationError = this.goCoder.getConfig().validateForBroadcast();
  if (configValidationError != null) {
  } else {
    // Start the live stream
Note: If you start a broadcast and logs record a "Decreasing bitrate to..." message, it means you're using a bitrate that's too large for the current network conditions. The broadcaster will start buffering frames to preserve the quality of the playback and any recordings, but this will increase playback latency. To minimize latency, try using a lower bitrate instead.

Stop streaming

Use the endStreaming method in the WowzaGoCoder class to stop a live stream.

if (this.goCoder.isStreaming()) {
  // Stop the live stream

Monitor the status of the live stream

Use the statusCallback argument for the startStreaming and endStreaming methods to implement the WOWZBroadcastStatusCallback interface. This interface defines the following callbacks that are invoked for a live stream broadcast:

Status Description
BroadcastState.IDLE The stream is inactive. This is the status before and after the broadcast.
BroadcastState.READY The audio, video, and stream connection are successfully initialized.
BroadcastState.BROADCASTING The broadcast is actively streaming.

The following example shows successful status transitions and an error status:

// Methods implemented for the WOWZBroadcastStatusCallback interface

// A successful status transition has been reported by the GoCoder SDK  
WOWZBroadcastStatusCallback statusCallback = new WOWZBroadcastStatusCallback() {
  public void onSuccess(final WOWZBroadcastStatus goCoderStatus) {
    switch (state) {
      case BroadcastState.IDLE:, "Streaming is not active");

      case BroadcastState.READY:, "Ready to begin streaming");

      case BroadcastState.BROADCASTING:, "Streaming is active");

  // If an error is reported by the GoCoder SDK, display a toast message containing the details   
  public void onError(final WOWZBroadcastStatus goCoderStatus) {
    // Run this on the U/I thread
    new Handler(Looper.getMainLooper()).post(new Runnable() {
      public void run() {
        Toast.setText("Live Streaming Error: " + goCoderStatus.getLastError().getErrorDescription(), LENGTH_LONG).show();

// Begin streaming

More resources