How to configure a broadcast with GoCoder SDK for iOS

You can use the WowzaConfig class in the Wowza GoCoder™ SDK for iOS 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
videoFrameSize The video resolution (width by height) in pixels. The default value is 640x480.
videoFrameRate The number of frames per second (fps). The default value is 30.
videoKeyFrameInterval The number of frames between keyframe insertions. The default value is 30.
videoBitate The video bitrate in bits per second (bps). The default value is 1500.

The following example demonstrates how to use the video parameters.

// Get a copy of the active config
WowzaConfig broadcastConfig = self.goCoder.config;

// Set the frame rate to 15 fps
broadcastConfig.videoFrameRate = 15;  
// Set the keyframe interval to 10 frames
broadcastConfig.videoKeyFrameInterval = 10;  
// Set the bitrate to 2.5 kbps
broadcastConfig.videoBitrate = 2500;

// Update the active config
self.goCoder.config = broadcastConfig;

Configure the audio

Use the following properties to configure the audio stream:

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

The following example demonstrates how to use the audio parameters.

// Get a copy of the active config
WowzaConfig broadcastConfig = self.goCoder.config;

// Set the sample rate to 22.1 kHz
broadcastConfig.audioSampleRate = 22100;  

// Update the active config
self.goCoder.config = broadcastConfig;

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
hostAddress The domain name or IP address of the destination. There isn't a default value.
portNumber The port number for the Wowza Streaming Engine server. The default value is 1935.
applicationName The name of the destination live streaming application. The default value is live.
streamName The name of the live stream that you're broadcasting. The default value is myStream.
username (If your application requires it) the source authentication username. There isn't a default value.
password (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.

// Get a copy of the active config
WowzaConfig broadcastConfig = self.goCoder.config;

// Set the hostname
broadcastConfig.hostAddress = @"live.someserver.net";
// Set the name of the stream
broadcastConfig.streamName = @"someStreamName";

// Update the active config
self.goCoder.config = broadcastConfig;

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
WZFrameSizePreset352x288 352x288 280 Kbps
WZFrameSizePreset640x480 640x480 1.5 Mbps
WZFrameSizePreset1280x720 (720p) 1280x720 3.75 Mbps
WZFrameSizePreset1920x1080 (1080p) 1920x1080 5 Mbps
WZFrameSizePreset3840x2160 (4K UHD) 3840x2160 8 Mbps

The following example demonstrates how to use a preset configuration.

// Get a copy of the active config
WowzaConfig broadcastConfig = self.goCoder.config;

// Set the defaults for 720p video
[broadcastConfig loadPreset:WZFrameSizePreset1280x720];

// Update the active config
self.goCoder.config = broadcastConfig;

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