Control a camera Control a microphone
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 WZCameraView class.
The WZCamera class uses the following methods to determine the capabilities supported by a particular camera.
|getSupportedFrameSizes()||Returns an array of the frame sizes supported by the camera.|
|hasCapability(WZCamera.TORCH)||Returns true if a camera has an associated flashlight (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.|
The following example configures the WZCamera.TORCH method:
// Enable the torch button if the current camera has a flashlight (aka torch) WZCamera activeCamera = this.goCoderCameraView.getCamera(); mBtnTorch.setEnabled(activeCamera.hasCapability(WZCamera.TORCH));
Use the isTorchOn and setTorchOn methods, respectively, to determine the state of the camera's flashlight and to turn it on and off.
// Turn the torch on if it is not already enabled WZCamera activeCamera = this.goCoderCameraView.getCamera(); if (!activeCamera.isTorchOn()) activeCamera.setTorchOn(mBtnTorch.toggleState());
Use the muteAudio method of the WowzaGoCoder class to mute or pause audio while streaming.
// Mute the audio stream if it isn't already if (!this.goCoder.isMuted()) this.goCoder.muteAudio = newMutedState;
If you're having problems or want to discuss this article, post in our forum.