Class CameraControl
-
- All Implemented Interfaces:
public final class CameraControl
-
-
Field Summary
Fields Modifier and Type Field Description private CameraCaptureSessioncurrentCameraSessionprivate CaptureRequest.BuildercaptureRequestBuilderprivate CameraEnumerationAndroid.CaptureFormatcaptureFormatprivate ImageReaderimageReaderprivate final HandlercameraHandlerprivate final Contextcontext
-
Method Summary
Modifier and Type Method Description final CameraCaptureSessiongetCurrentCameraSession()final UnitsetCurrentCameraSession(CameraCaptureSession currentCameraSession)final CaptureRequest.BuildergetCaptureRequestBuilder()final UnitsetCaptureRequestBuilder(CaptureRequest.Builder captureRequestBuilder)final CameraEnumerationAndroid.CaptureFormatgetCaptureFormat()final UnitsetCaptureFormat(CameraEnumerationAndroid.CaptureFormat captureFormat)final ImageReadergetImageReader()Readers used as buffers for camera still shots final UnitsetImageReader(ImageReader imageReader)Readers used as buffers for camera still shots final HandlergetCameraHandler()final ContextgetContext()final BooleanisZoomSupported()Checks if digital zoom is supported by the current facing cameraID final BooleanisManualFocusSupported()Checks if manual focus is supported by the current facing cameraID final Range<Float>getManualFocusRange()Gets the manual focus range final UnitsetManualFocus(Float range)Sets the manual focus, will not zoom if its outside the zoom bounds The camera should support manual focus final BooleanisTapToFocusSupported()Checks if any focus mode is supported by the current facing cameraID final FloatgetMaxZoom()Gets maximum zoom value in for current camera session. final FloatgetMinZoom()Gets minimum zoom value in for current camera session. final UnitsetZoom(Float zoomValue)Sets the current zoom, will not zoom if its outside the zoom bounds final UnitresetZoom()Resets the current zoom final UnitsetTapToFocusAt(Float viewX, Float viewY, Integer viewWidth, Integer viewHeight, RendererCommon.ScalingType scalingType)Tap to focus, before calling this check isTapToFocusSupportedView's coordinate system (x, y)(0,0)----------------(viewWidth, 0) | | | | | | |------------------ | (0,viewHeight) (viewWidth, viewHeight) final UnitcaptureImageAtMaxResolution(HmsTypedActionResultListener<ImageCaptureModel> onImageCapture)Captures the highest resolution image that the local camera supports. final UnitcaptureImageAtMaxSupportedResolution(File savePath, Function1<Boolean, Unit> callback)Captures the highest resolution image that the local camera supports. final BooleanisFlashSupported()Checks if the camera has a flash device. final BooleanisFlashEnabled()Checks if the camera flash is enabled. final UnitsetFlash(Boolean enable)Enables or disable camera flash. -
-
Method Detail
-
getCurrentCameraSession
final CameraCaptureSession getCurrentCameraSession()
-
setCurrentCameraSession
final Unit setCurrentCameraSession(CameraCaptureSession currentCameraSession)
-
getCaptureRequestBuilder
final CaptureRequest.Builder getCaptureRequestBuilder()
-
setCaptureRequestBuilder
final Unit setCaptureRequestBuilder(CaptureRequest.Builder captureRequestBuilder)
-
getCaptureFormat
final CameraEnumerationAndroid.CaptureFormat getCaptureFormat()
-
setCaptureFormat
final Unit setCaptureFormat(CameraEnumerationAndroid.CaptureFormat captureFormat)
-
getImageReader
final ImageReader getImageReader()
Readers used as buffers for camera still shots
-
setImageReader
final Unit setImageReader(ImageReader imageReader)
Readers used as buffers for camera still shots
-
getCameraHandler
final Handler getCameraHandler()
-
getContext
final Context getContext()
-
isZoomSupported
final Boolean isZoomSupported()
Checks if digital zoom is supported by the current facing cameraID
-
isManualFocusSupported
final Boolean isManualFocusSupported()
Checks if manual focus is supported by the current facing cameraID
-
getManualFocusRange
final Range<Float> getManualFocusRange()
Gets the manual focus range
-
setManualFocus
final Unit setManualFocus(Float range)
Sets the manual focus, will not zoom if its outside the zoom bounds The camera should support manual focus
- Parameters:
range- should be between getManualFocusRange()
-
isTapToFocusSupported
final Boolean isTapToFocusSupported()
Checks if any focus mode is supported by the current facing cameraID
-
getMaxZoom
final Float getMaxZoom()
Gets maximum zoom value in for current camera session. If not supported ZOOM_DEFAULT_VALUE is returned
-
getMinZoom
final Float getMinZoom()
Gets minimum zoom value in for current camera session. If not supported ZOOM_DEFAULT_VALUE is returned
-
setZoom
final Unit setZoom(Float zoomValue)
Sets the current zoom, will not zoom if its outside the zoom bounds
- Parameters:
zoomValue- should be getMinZoom>= value <= getMaxZoom
-
setTapToFocusAt
final Unit setTapToFocusAt(Float viewX, Float viewY, Integer viewWidth, Integer viewHeight, RendererCommon.ScalingType scalingType)
Tap to focus, before calling this check isTapToFocusSupported
View's coordinate system (x, y)
(0,0)----------------(viewWidth, 0) | | | | | | |------------------ | (0,viewHeight) (viewWidth, viewHeight)
- Parameters:
viewX- should be the point in view's X coordinateviewY- should be the point in view's Y coordinateviewWidth- should be the current view's widthviewHeight- should be the current view's height
-
captureImageAtMaxResolution
final Unit captureImageAtMaxResolution(HmsTypedActionResultListener<ImageCaptureModel> onImageCapture)
Captures the highest resolution image that the local camera supports. This does not depend on publisher's resolution. Once the onImageCapture method returns, the image in the ImageCaptureModel will be closed and invalid for access. Do not store it, the resources need to be released.
- Parameters:
onImageCapture- a callback that resturns ImageCaptureModel.
-
captureImageAtMaxSupportedResolution
final Unit captureImageAtMaxSupportedResolution(File savePath, Function1<Boolean, Unit> callback)
Captures the highest resolution image that the local camera supports. This does not depend on publisher's resolution.
- Parameters:
savePath- File path where the captured image is to be savedcallback- Boolean.true if image was successfully captured and saved in the file provided, Boolean.false otherwise.
-
isFlashSupported
final Boolean isFlashSupported()
Checks if the camera has a flash device.
- Returns:
Boolean.true if camera has a flash device, Boolean.false otherwise.
-
isFlashEnabled
final Boolean isFlashEnabled()
Checks if the camera flash is enabled.
- Returns:
Boolean.true if camera flash is enabled, Boolean.false otherwise.
-
-
-
-