How to configure a broadcast with GoCoder SDK for Android

Learn how to use the WowzaConfig class in the Wowza GoCoder™ SDK for Android to configure properties for a live streaming broadcast. There are three primary categories of properties: video, audio, and connection parameters for the Wowza Streaming Cloud™ service and Wowza Streaming Engine™ media server software.

Contents


Configure the stream Use the configuration presets
More resources

Configure the stream

Configure the video

Use the following methods to configure the video stream:

Method Description
setVideoFrameSize The frame size of the video, in pixels. The default is 640x480.
setVideoFrameRate The number of frames per second (fps). The default is 30.
setVideoKeyFrameInterval The number of frames between keyframes. The default is 30.
setVideoBitate The video bitrate in bits per second (bps). The default is 1500.

The following example shows how to use the video methods:

// Create a configuration instance
WOWZBroadcastConfig broadcastConfig = new WOWZBroadcastConfig();

// Set the frame rate to 15 fps
broadcastConfig.setVideoFramerate(15);
// Set the bitrate to 2500 bps
broadcastConfig.setVideoBitrate(2500);

Configure the audio

Use the following methods to configure the audio stream:

Method Description
setAudioSampleRate The audio sample rate in hertz (Hz). The default is 44100.
setAudioChannels The number of audio channels. The default is 2.
setAudioBitrate The audio bitrate in bits per second (bps). The default is 64000.

The following example shows how to use the audio methods:

// Create a configuration instance
WOWZBroadcastConfig broadcastConfig = new WOWZBroadcastConfig();

// Set the sample rate to 22.1 kHz
broadcastConfig.setAudioSampleRate(22100);

Configure the connection

Use the following methods to configure the connection to your Wowza Streaming Engine server or Wowza Streaming Cloud live stream:

Method Description
setHostAddress The domain name or IP address of the destination. There isn't a default value.
setPortNumber The port number for the Wowza Streaming Engine server. The default is 1935.
setApplicationName The name of the destination live streaming application. The default is live.
setStreamName The name of the live stream that you're broadcasting. The default is myStream.
setUsername (If your application requires it) the source authentication username. There isn't a default value.
setPassword (If your application requires it) the password associated with the source authentication username. There isn't a default value.

The following example shows how to use the connection parameters:

// Create a configuration instance
WOWZBroadcastConfig broadcastConfig = new WOWZBroadcastConfig();

// Set the hostname
broadcastConfig.setHostAddress("live.someserver.net");
// Set the name of the stream
broadcastConfig.setStreamName("conventionCoverage");

Use the configuration presets

Alternatively, you can configure your broadcast with one of the following presets, which use standard frame sizes:

Preset Frame Size Bitrate
WOWZMediaConfig.FRAME_SIZE_320x240 320x240 280 Kbps
WOWZMediaConfig.FRAME_SIZE_640x480 640x480 1.5 Mbps
WOWZMediaConfig.FRAME_SIZE_960x540 960x540 1.5 Mbps
WOWZMediaConfig.FRAME_SIZE_1280x720 1280x720, or 720p 3.75 Mbps
WOWZMediaConfig.FRAME_SIZE_1920x1080 1920x1080, or 1080p 5 Mbps
WOWZMediaConfig.FRAME_SIZE_3840x2160 3840x2160, or UHD 4K 8 Mbps

The following example shows how to use a frame-size preset:

// Update the active config to the defaults for 720p video
broadcastConfig.set(WOWZMediaConfig.FRAME_SIZE_1280x720);

More resources



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