Package com.banuba.sdk.input
Class CameraDevice
java.lang.Object
com.banuba.sdk.player.VerifyCloseable
com.banuba.sdk.input.CameraDevice
- All Implemented Interfaces:
Closeable
,AutoCloseable
The
CameraDevice
class used to capture video stream, and photos. It uses the standard CameraX as a camera.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
Interface for getting frames from video capture or photo capturestatic interface
Interface for getting errors -
Field Summary
Fields inherited from class com.banuba.sdk.player.VerifyCloseable
mIsClosed, mTag
-
Constructor Summary
ConstructorDescriptionCameraDevice
(android.content.Context context, androidx.lifecycle.LifecycleOwner lifecycleOwner) Creates a camera object but does not start it. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the new video capture listenervoid
close()
Returns the CameraDeviceConfigurator.float
Get the maximum zoom valuefloat
Get the minimum zoom valueboolean
Does the camera have a flashlightvoid
Removes the previously added video capture listenervoid
start()
Starts the camera if it has not been startedvoid
stop()
Stops the camera if it has not been stoppedvoid
takePhoto
(CameraDevice.ICapturedFrameInput photoInputCallback, CameraDevice.IErrorOccurred errorCallback) Takes a photo from the current camera and calls a callback when the photo is available for reading.Methods inherited from class com.banuba.sdk.player.VerifyCloseable
finalize
-
Constructor Details
-
CameraDevice
public CameraDevice(@NonNull android.content.Context context, @NonNull androidx.lifecycle.LifecycleOwner lifecycleOwner) Creates a camera object but does not start it.- Parameters:
context
- an application context. For the activity can be passed like this: 'this'lifecycleOwner
- activity or application life cycle. For the activity can be passed like this: 'MainActivity.this'
-
-
Method Details
-
hasFlashUnit
public boolean hasFlashUnit()Does the camera have a flashlight- Returns:
- true if there is a torch otherwise false
-
getMinZoomRatio
public float getMinZoomRatio()Get the minimum zoom value- Returns:
- min zoom value
-
getMaxZoomRatio
public float getMaxZoomRatio()Get the maximum zoom value- Returns:
- max zoom value
-
getConfigurator
Returns the CameraDeviceConfigurator. You need to manage the camera settings through it.- Returns:
- CameraDeviceConfigurator
- See Also:
-
addVideoCaptureListener
Add the new video capture listener- Parameters:
listener
- new video capture listener- See Also:
-
removeVideoCaptureListener
Removes the previously added video capture listener- Parameters:
listener
- previously added video capture listener- See Also:
-
takePhoto
public void takePhoto(@NonNull CameraDevice.ICapturedFrameInput photoInputCallback, @Nullable CameraDevice.IErrorOccurred errorCallback) Takes a photo from the current camera and calls a callback when the photo is available for reading.- Parameters:
photoInputCallback
- callback for processing the photo
-
start
public void start()Starts the camera if it has not been started -
stop
public void stop()Stops the camera if it has not been stopped -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classVerifyCloseable
-