Learn how to use the WOWZCamera and WowzaGoCoder classes in the Wowza GoCoder™ SDK for iOS to control cameras and microphones on a device.
Before you begin
Before adding the functionality below to an app, make sure you've set up the Wowza GoCoder SDK for your project:
- Request a free license and download the latest version of the SDK.
- Configure your Xcode project to use the SDK.
See Download and install GoCoder SDK for iOS for detailed instructions.
The WOWZCamera class controls the capabilities that vary between the device's two cameras.
Use these WOWZCamera methods to identify the capabilities supported by a particular camera:
|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];
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;
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;