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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfaceInterface for getting frames from video capture or photo capturestatic interfaceInterface for getting errors -
Field Summary
Fields inherited from class com.banuba.sdk.player.VerifyCloseable
mIsClosed, mTag -
Constructor Summary
ConstructorsConstructorDescriptionCameraDevice(android.content.Context context, androidx.lifecycle.LifecycleOwner lifecycleOwner) Creates a camera object but does not start it.CameraDevice(android.content.Context context, androidx.lifecycle.LifecycleOwner lifecycleOwner, Player player) Private use only -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the new video capture listenervoidclose()Returns the CameraDeviceConfigurator.voidRemoves the previously added video capture listenervoidstart()Starts the camera if it has not been startedvoidstop()Stops the camera if it has not been stoppedvoidtakePhoto(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'
-
CameraDevice
public CameraDevice(@NonNull android.content.Context context, @NonNull androidx.lifecycle.LifecycleOwner lifecycleOwner, @Nullable Player player) Private use only
-
-
Method Details
-
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classVerifyCloseable
-