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

Learn how to use the WOWZCamera 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
More resources

Control a camera


The WOWZCamera class controls the capabilities that vary between the device's two cameras.

Determine camera capabilities

Use these WOWZCamera methods to identify the capabilities supported by a particular camera:

Method Description
FrameSizes Returns an array of the supported frame sizes.
hasTorch Returns true if a camera has a torch, or flash.
supportsFocusMode:WOWZCameraFocusModeLocked Returns true if the camera can lock the focus to the current lens position.
supportsFocusMode:WOWZCameraFocusModeAuto Returns true if the camera can auto-focus on a specified point location.
supportsFocusMode:WOWZCameraFocusModeContinuous Returns  true if the camera can continuously adjust the focus.
supportsFocusMode:WOWZCameraExposureModeLocked Returns true if the camera can lock the exposure to its current value.
supportsFocusMode:WOWZCameraExposureModeAuto Returns true if the camera can automatically adjust and lock the exposure to a specified value.
supportsFocusMode:WOWZCameraExposureModeContinuous Returns true if the camera can automatically adjust the exposure as needed.

The following example uses the hasTorch method:

// Enable the torch button if the current camera has a flash, or torch
self.torchButton.enabled = [self.goCoder.CameraPreview.camera hasTorch];

Control a camera flash

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

// Turn the flash on if it is off
if (!self.goCoder.cameraPreview.camera.isTorchOn)
  self.goCoder.cameraPreview.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;

More resources



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