Controlling the Camera and Mic

Controlling the camera

The WZCamera class is used to interface with a device camera. While many of the camera configuration options, such as setting the frame size, are controlled through the WZCameraView class, WZCamera is used for control of capabilities that may vary from one camera to another.

Determining a camera's capabilities

The table below describes the properties of the WZCamera class that can be used to determine the capabilities supported by a particular camera.

frameSizes An array of the frame sizes supported by the camera
hasTorch True if the camera has an associated flashlight, or torch.
supportsFocusMode:WZCameraFocusModeLocked Returns true if the camera supports locking the focus at the lens' current position.
supportsFocusMode:WZCameraFocusModeAuto Returns true if the camera supports auto focusing and locking it at a specified screen location.
supportsFocusMode:WZCameraFocusModeContinuous Returns true if the camera supports automatically adjusting the focus as needed.
supportsFocusMode:WZCameraExposureModeLocked Returns true if the camera supports locking the exposure at it's current value.
supportsFocusMode:WZCameraExposureModeAuto Returns true if the camera supports automatically adjusting the exposure and locking it at a specified screen location.
supportsFocusMode:WZCameraExposureModeContinuous Returns true if the camera supports automatically adjusting the exposure as needed.
// Enable the torch button if the current camera has a flashlight (aka torch)
self.torchButton.enabled = [self.goCoderCameraPreview.camera hasTorch];

The table below describes the methods of the WZCamera class that can be used to determine the capabilities supported by a particular camera.

getSupportedFrameSizes() Returns an array consisting of the frame sizes supported by the camera
hasCapability(WZCamera.TORCH) Returns true if the camera has an associated flashlight, or torch.
hasCapability(WZCamera.FOCUS_MODE_AUTO) Returns true if the camera supports auto focusing to a specified point location.
hasCapability(WZCamera.FOCUS_MODE_CONTINUOUS) Returns true if the camera supports continuously adjusting the focus.
// Enable the torch button if the current camera has a flashlight (aka torch)
WZCamera activeCamera = this.goCoderCameraView.getCamera();
mBtnTorch.setEnabled(activeCamera.hasCapability(WZCamera.TORCH));

Controlling a camera's flashlight

The torchOn property is used to turn a camera's flashlight on or off.

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

The isTorchOn and setTorchOn methods are used to determine the state of a camera's flashlight and to turn it on or off.

// Turn the torch on if it is not already enabled
WZCamera activeCamera = this.goCoderCameraView.getCamera();
if (!activeCamera.isTorchOn())
    activeCamera.setTorchOn(mBtnTorch.toggleState());

Controlling the microphone

The audioMuted property of the WowzaGoCoder class is used to mute, or pause, audio from being sent while streaming.

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

The muteAudio method of the WowzaGoCoder class can be used to mute, or pause, audio from being sent while streaming.

// Mute the audio stream if it isn't already
if (!this.goCoder.isMuted())
    this.goCoder.muteAudio = newMutedState;