How to control a camera and microphone with GoCoder SDK for iOS

Learn how to use the WZCamera class and WowzaGoCoder classes in the Wowza GoCoder™ SDK for iOS to control cameras and microphones on a device.

Contents


Control a camera Control a microphone

Control a camera


Use the WZCamera class to control camera capabilities that may vary from one camera to another.

Note: Most camera configuration options that don't vary by camera are controlled by the WZCamera class.

Determine camera capabilities

The WZCamera class uses the following methods to determine the capabilities supported by a particular camera.

FrameSizes Returns an array of the frame sizes supported by the camera.
hasTorch Returns true if a camera has an associated flashlight (torch).
supportsFocusMode:WZCameraFocusModeLocked Returns true if the camera supports locking the focus to the current lens position.
supportsFocusMode:WZCameraFocusModeAuto Returns true if the camera supports auto-focusing to a specified point location.
supportsFocusMode:WZCameraFocusModeContinuous Returns  true if the camera supports continuously adjusting the focus.
supportsFocusMode:WZCameraExposureModeLocked Returns true if the camera supports locking the exposure at its current value.
supportsFocusMode:WZCameraExposureModeAuto Returns true if the camera supports automatically adjusting and locking the exposure to a specified value.
supportsFocusMode:WZCameraExposureModeContinuous Returns true if the camera supports automatically adjusting the exposure as needed.

The following example uses the hasTorch method:

// Enable the torch button if the current camera has a flashlight (aka torch)
self.torchButton.enabled = [self.goCoderCameraPreview.camera hasTorch];

Control a camera flashlight

Use the torchOn property to turn the flashlight on and off.

// Turn the torch on if it is not already enabled
if (!self.goCoderCameraPreview.camera.isTorchOn)
  self.goCoderCameraPreview.camera.torchOn = YES;

Control a microphone


Use the audioMuted property of the WowzaGoCoder class to mute or pause audio while streaming.

// Mute the audio stream if it isn't already
if (!self.goCoder.audioMuted)
  self.goCoder.audioMuted = newMutedState;

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