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 parameters Use the configuration presets

Configure the stream parameters

Configure the video

Use the following properties to configure the video stream:

Parameter Description
setVideoFrameSize The video resolution (width by height) in pixels. The default value is 640x480.
setVideoFrameRate The number of frames per second (fps). The default value is 30.
setVideoKeyFrameInterval The number of frames between keyframe insertions. The default value is 30.
setVideoBitate The video bitrate in bits per second (bps). The default value is 1500.

The following example demonstrates how to use the video parameters.

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

// 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 properties to configure the audio stream:

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

The following example demonstrates how to use the audio parameters.

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

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

Configure the connection parameters

Use the following properties to configure the connection to your Wowza Streaming Engine server or the Wowza Streaming Cloud service:

Parameter 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 value is 1935.
setApplicationName The name of the destination live streaming application. The default value is live.
setStreamName The name of the live stream that you're broadcasting. The default value is myStream.
setPsername (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 demonstrates how to use the connection parameters.

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

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

Use configuration presets

Alternatively, you can preconfigure your broadcast with the following presets, which are designed for common frame sizes:

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

The following example demonstrates how to use a preset configuration.

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

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