Package com.appliedrec.verid.ui2
Class VerIDSessionInView<T extends android.view.View & ISessionView>
- java.lang.Object
-
- com.appliedrec.verid.ui2.VerIDSessionInView<T>
-
- All Implemented Interfaces:
CameraWrapper.Listener
,ISessionView.SessionViewListener
,IVerIDSession<VerIDSessionInViewDelegate>
,java.lang.Iterable<FaceBounds>
public class VerIDSessionInView<T extends android.view.View & ISessionView> extends java.lang.Object implements IVerIDSession<VerIDSessionInViewDelegate>, ISessionView.SessionViewListener, java.lang.Iterable<FaceBounds>, CameraWrapper.Listener
Session that uses a session view to render the camera preview and detected face- Since:
- 2.0.0
-
-
Constructor Summary
Constructors Constructor Description VerIDSessionInView(VerID verID, VerIDSessionSettings sessionSettings, T sessionView)
ConstructorVerIDSessionInView(VerID verID, VerIDSessionSettings sessionSettings, T sessionView, IStringTranslator stringTranslator)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CameraWrapper
getCameraWrapper()
java.util.Optional<VerIDSessionInViewDelegate>
getDelegate()
androidx.lifecycle.LiveData<FaceCapture>
getFaceCaptureLiveData()
androidx.lifecycle.LiveData<FaceDetectionResult>
getFaceDetectionLiveData()
long
getSessionIdentifier()
androidx.lifecycle.LiveData<VerIDSessionResult>
getSessionResultLiveData()
T
getSessionView()
VerIDSessionSettings
getSettings()
VerID
getVerID()
java.util.Iterator<FaceBounds>
iterator()
void
onCameraError(VerIDSessionException error)
Called when opening the camera or starting a preview failsvoid
onCameraPreviewSize(int width, int height, int sensorOrientation)
Called when the camera determines its preview size based on the dimensions of the containing viewvoid
onPreviewSurfaceCreated(android.view.Surface surface)
Called when camera preview surface is createdvoid
onPreviewSurfaceDestroyed()
Called when camera preview surface is destroyedvoid
setDelegate(VerIDSessionInViewDelegate delegate)
Set session delegatevoid
start()
Start the sessionvoid
stop()
Stop the session
-
-
-
Constructor Detail
-
VerIDSessionInView
public VerIDSessionInView(@NonNull VerID verID, @NonNull VerIDSessionSettings sessionSettings, @NonNull T sessionView, @NonNull IStringTranslator stringTranslator)
Constructor- Parameters:
verID
- Instance of VerIDsessionSettings
- Session settingssessionView
- Session viewstringTranslator
- String translator- Since:
- 2.0.0
-
VerIDSessionInView
public VerIDSessionInView(VerID verID, VerIDSessionSettings sessionSettings, T sessionView)
Constructor- Parameters:
verID
- Instance of VerIDsessionSettings
- Session settingssessionView
- Session view- Since:
- 2.0.0
-
-
Method Detail
-
getSessionIdentifier
public long getSessionIdentifier()
- Specified by:
getSessionIdentifier
in interfaceIVerIDSession<T extends android.view.View & ISessionView>
- Returns:
- Unique identifier for the session
- Since:
- 2.0.0
-
start
public void start()
Start the session- Specified by:
start
in interfaceIVerIDSession<T extends android.view.View & ISessionView>
- Since:
- 2.0.0
-
stop
public void stop()
Stop the session- Since:
- 2.0.0
-
getDelegate
public java.util.Optional<VerIDSessionInViewDelegate> getDelegate()
- Specified by:
getDelegate
in interfaceIVerIDSession<T extends android.view.View & ISessionView>
- Returns:
- Session delegate
- Since:
- 2.0.0
-
setDelegate
public void setDelegate(VerIDSessionInViewDelegate delegate)
Set session delegate- Specified by:
setDelegate
in interfaceIVerIDSession<T extends android.view.View & ISessionView>
- Parameters:
delegate
- Session delegate- Since:
- 2.0.0
-
getVerID
public VerID getVerID()
- Specified by:
getVerID
in interfaceIVerIDSession<T extends android.view.View & ISessionView>
- Returns:
- Instance of
VerID
used for face detection and recognition - Since:
- 2.0.0
-
getSettings
public VerIDSessionSettings getSettings()
- Specified by:
getSettings
in interfaceIVerIDSession<T extends android.view.View & ISessionView>
- Returns:
- Session settings
- Since:
- 2.0.0
-
getSessionView
public T getSessionView()
- Returns:
- Session view
- Since:
- 2.0.0
-
getCameraWrapper
public CameraWrapper getCameraWrapper()
- Returns:
- Camera wrapper
- Since:
- 2.0.0
-
getSessionResultLiveData
public androidx.lifecycle.LiveData<VerIDSessionResult> getSessionResultLiveData()
- Returns:
- Session result live data
- Since:
- 2.0.0
-
getFaceDetectionLiveData
public androidx.lifecycle.LiveData<FaceDetectionResult> getFaceDetectionLiveData()
- Returns:
- Face detection live data
- Since:
- 2.0.0
-
getFaceCaptureLiveData
public androidx.lifecycle.LiveData<FaceCapture> getFaceCaptureLiveData()
- Returns:
- Face capture live data
- Since:
- 2.0.0
-
onPreviewSurfaceCreated
@RestrictTo(LIBRARY_GROUP) public void onPreviewSurfaceCreated(android.view.Surface surface)
Description copied from interface:ISessionView.SessionViewListener
Called when camera preview surface is created- Specified by:
onPreviewSurfaceCreated
in interfaceISessionView.SessionViewListener
- Parameters:
surface
- Surface used to render camera preview
-
onPreviewSurfaceDestroyed
@RestrictTo(LIBRARY_GROUP) public void onPreviewSurfaceDestroyed()
Description copied from interface:ISessionView.SessionViewListener
Called when camera preview surface is destroyed- Specified by:
onPreviewSurfaceDestroyed
in interfaceISessionView.SessionViewListener
-
iterator
@RestrictTo(LIBRARY_GROUP) @NonNull public java.util.Iterator<FaceBounds> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T extends android.view.View & ISessionView>
-
onCameraPreviewSize
@RestrictTo(LIBRARY_GROUP) public void onCameraPreviewSize(int width, int height, int sensorOrientation)
Description copied from interface:CameraWrapper.Listener
Called when the camera determines its preview size based on the dimensions of the containing view- Specified by:
onCameraPreviewSize
in interfaceCameraWrapper.Listener
- Parameters:
width
- Preview widthheight
- Preview heightsensorOrientation
- Camera sensor orientation on the device
-
onCameraError
@RestrictTo(LIBRARY_GROUP) public void onCameraError(VerIDSessionException error)
Description copied from interface:CameraWrapper.Listener
Called when opening the camera or starting a preview fails- Specified by:
onCameraError
in interfaceCameraWrapper.Listener
- Parameters:
error
- Session exception that caused the failure
-
-