public class WZCamera extends Object
WZCamera
class provides an interface for accessing and controlling a camera device.
The method WZCameraView.getDeviceCameras()
can be used to retrieve a list of all cameras.Modifier and Type | Field and Description |
---|---|
static int |
DIRECTION_BACK
Identifier for a back facing camera returned by
getDirection() |
static int |
DIRECTION_FRONT
Identifier for a front facing camera returned by
getDirection() |
static int |
DIRECTION_INDETERMINATE
Identifier for a camera with an indeterminate direction or where direction is not applicable
|
static int |
FOCUS_MODE_AUTO
An identifier used with the
hasCapability(int) method to detect support for auto focus |
static int |
FOCUS_MODE_CONTINUOUS
An identifier used with the
hasCapability(int) method to detect support for continuous video focus |
static int |
FOCUS_MODE_OFF
An identifier used with the
setFramerate(int) method to turn off all focus modes |
static int |
TORCH
An identifier used with the
hasCapability(int) method to detect the presence of a torch (i.e. |
Modifier and Type | Method and Description |
---|---|
void |
continuePreview() |
static String |
directionString(int direction) |
static WZCamera[] |
getAvailableDeviceCameras()
Returns an array of
WZCamera object instances for each camera detected and accessible on the current device. |
int |
getCameraId()
Returns an id for the camera, unique to each camera on the device.
|
static String |
getCameraInfo()
Returns a human readable list of the cameras detected and the capabilities of each.
|
static WZCamera[] |
getDeviceCameras()
Returns an array of
WZCamera object instances for each camera detected on the current device. |
static WZCamera[] |
getDeviceCameras(boolean availableOnly)
Returns an array of
WZCamera object instances for each camera detected, and optionally accessible, on the current device. |
static WZCamera[] |
getDeviceCameras(boolean availableOnly,
boolean withCapabilities)
Returns an array of
WZCamera object instances for each camera detected, and optionally accessible, on the current device. |
int |
getDirection()
Returns the direction the camera is facing
|
int |
getFocusMode()
Returns the camera's active focus mode
|
int |
getFramerate()
Returns the current framerate setting for the camera.
|
WZSize |
getFrameSize()
Returns the active preview frame size or the last frame size used when the preview display was active
|
WZError |
getLastError() |
static int |
getNumberOfDeviceCameras()
Returns the number of cameras detected on the current device.
|
WZSize |
getOptimalPreviewSize(WZSize requestedSize)
Returns the best frame size supported by the device for previewing video
with the specified frame size
|
WZSize |
getOptimalPreviewSize(WZSize requestedSize,
WZSize minimumSize)
Returns the best frame size supported by the device for previewing video
with the specified frame size that is equal to or larger than the specified minimum size
|
Camera |
getPlatformDevice()
Get the interface to the native platform's camera interface
|
WZSize |
getPreferredVideoFrameSize()
Returns the frame size the device reported as the preferred video frame size
|
WZStatus |
getStatus() |
WZMediaConfig[] |
getSupportedConfigs()
Generates an array of configuration instances representing the preview frame sizes supported by this camera device
|
WZSize[] |
getSupportedFrameSizes()
Returns a list of preview frame sizes supported by the camera
|
SurfaceTexture |
getSurfaceTexture()
Returns the surface texture used as the output for the camera's preview
|
boolean |
hasCapability(int capabilityId)
Provides an interface to interrogate device support of various capabilities
|
boolean |
isAvailable()
Indicates if the camera can be opened by the current application
|
boolean |
isBack()
Indicates if the camera is a back facing camera
|
boolean |
isDirectional()
Indicates if the camera is a front or back facing camera
|
boolean |
isFront()
Indicates if the camera is a front facing camera
|
boolean |
isPreviewing()
Indicates if this camera's output is being actively being displayed
|
boolean |
isTorchOn()
Indicates if the camera's "torch" is currently turned on
|
boolean |
open() |
void |
pausePreview() |
void |
release()
AVAILABLE ONLY FOR OPEN CAMERAS
|
void |
setFocusMode(int focusMode)
Sets the camera's active focus mode
|
void |
setFocusPoint(float x,
float y,
int focusAreaSize)
Turns on auto focus mode and sets the focus point to the screen coordinate x, y
|
int |
setFramerate(int framerate) |
WZSize |
setFrameSize(WZSize requestedFrameSize) |
boolean |
setSurfaceTexture(SurfaceTexture surfaceTexture)
Sets the surface texture used as the output for the camera's preview
|
void |
setTorchOn(boolean torchOn)
Turns the camera's torch (aka flashlight) on or off
|
static WZSize |
sizeToWzSize(Camera.Size cameraSize)
Converts an instance of Android's Camera.Size to an instance of GoCoder SDK's WZSize
|
boolean |
startPreview(Context context,
WZSize previewFrameSize,
int framerate) |
boolean |
startPreview(Context context,
WZSize previewFrameSize,
WZSize minimumFrameSize,
int framerate) |
void |
stopPreview()
AVAILABLE ONLY FOR CAMERAS WHOSE PREVIEW IS ACTIVE
|
WZDataMap |
toDataMap() |
String |
toString() |
RectF |
toViewCoords(View view,
Rect cameraRect)
Converts camera coordinates to coordinates for the specified view
|
public static final int DIRECTION_FRONT
getDirection()
public static final int DIRECTION_BACK
getDirection()
public static final int DIRECTION_INDETERMINATE
public static final int TORCH
hasCapability(int)
method to detect the presence of a torch (i.e. flashlight)public static final int FOCUS_MODE_AUTO
hasCapability(int)
method to detect support for auto focuspublic static final int FOCUS_MODE_CONTINUOUS
hasCapability(int)
method to detect support for continuous video focuspublic static final int FOCUS_MODE_OFF
setFramerate(int)
method to turn off all focus modespublic static String directionString(int direction)
public static int getNumberOfDeviceCameras()
public static WZCamera[] getDeviceCameras(boolean availableOnly, boolean withCapabilities)
WZCamera
object instances for each camera detected, and optionally accessible, on the current device.availableOnly
- If set to true, the returned array will contain instances for only those camera that could be
successfully opened for access.withCapabilities
- If set to true, the camera's will be interrogated at this time for it's full set of features. This is ordinarily only done
the first time the camera is opened for preview. Doing so here can cause performance issues when starting the camera previewWZCamera
object instancespublic static WZCamera[] getDeviceCameras(boolean availableOnly)
WZCamera
object instances for each camera detected, and optionally accessible, on the current device.availableOnly
- If set to true, the returned array will contain instances for only those camera that could be
successfully opened for access.WZCamera
object instancespublic static WZCamera[] getDeviceCameras()
WZCamera
object instances for each camera detected on the current device.WZCamera
object instancesfor detal on the the camera interface
public static WZCamera[] getAvailableDeviceCameras()
WZCamera
object instances for each camera detected and accessible on the current device.WZCamera
object instancesfor detal on the the camera interface
public static String getCameraInfo()
public static WZSize sizeToWzSize(Camera.Size cameraSize)
cameraSize
- an instance of Android's Camera.Sizepublic int getCameraId()
public WZStatus getStatus()
public WZError getLastError()
public Camera getPlatformDevice()
public boolean isAvailable()
public boolean isDirectional()
public int getDirection()
DIRECTION_FRONT
, WZCamera##DIRECTION_FRONT
or public boolean isFront()
public boolean isBack()
public boolean isPreviewing()
public SurfaceTexture getSurfaceTexture()
public boolean setSurfaceTexture(SurfaceTexture surfaceTexture)
surfaceTexture
- the surface texture to be used as the output for the camera's previewpublic WZSize[] getSupportedFrameSizes()
public WZMediaConfig[] getSupportedConfigs()
public WZSize getPreferredVideoFrameSize()
public WZSize getOptimalPreviewSize(WZSize requestedSize)
requestedSize
- the requested frame size for displaypublic WZSize getOptimalPreviewSize(WZSize requestedSize, WZSize minimumSize)
requestedSize
- the requested frame size for displayminimumSize
- the minimum frame size to be consideredpublic boolean hasCapability(int capabilityId)
capabilityId
- a specifier indicating the capability,
one of TORCH
, FOCUS_MODE_AUTO
, or FOCUS_MODE_CONTINUOUS
public boolean open()
public boolean startPreview(Context context, WZSize previewFrameSize, int framerate)
public boolean startPreview(Context context, WZSize previewFrameSize, WZSize minimumFrameSize, int framerate)
public void release()
public WZSize getFrameSize()
public void stopPreview()
public void pausePreview()
public void continuePreview()
public int getFramerate()
public int setFramerate(int framerate)
public boolean isTorchOn()
public void setTorchOn(boolean torchOn)
torchOn
- specify true to turn the torch on, false to turn it offpublic int getFocusMode()
FOCUS_MODE_OFF
, FOCUS_MODE_AUTO
, or FOCUS_MODE_CONTINUOUS
public void setFocusMode(int focusMode)
focusMode
- FOCUS_MODE_OFF
or FOCUS_MODE_CONTINUOUS
public void setFocusPoint(float x, float y, int focusAreaSize)
x
- the x position of the focus point on the display screeny
- the y position of the focus point on the display screenpublic RectF toViewCoords(View view, Rect cameraRect)
view
- The view to mapcameraRect
- A rectangle in camera coordinatespublic WZDataMap toDataMap()
© 2016 Wowza Media Systems, LLC. All rights reserved. Terms | Privacy | Trademarks | Legal