Class CameraWrapper

  • All Implemented Interfaces:
    androidx.lifecycle.DefaultLifecycleObserver, androidx.lifecycle.LifecycleObserver

    public class CameraWrapper
    extends java.lang.Object
    implements androidx.lifecycle.DefaultLifecycleObserver
    Interfaces with the device's camera
    Since:
    2.0.0
    • Constructor Detail

      • CameraWrapper

        public CameraWrapper​(@NonNull
                             android.content.Context context,
                             @NonNull
                             CameraLocation cameraLocation,
                             @NonNull
                             IImageIterator imageIterator,
                             @Nullable
                             ISessionVideoRecorder videoRecorder)
        Constructor
        Parameters:
        context - Context
        cameraLocation - Location of the camera to use
        imageIterator - Image iterator – reads images from the camera and provides them to a session
        videoRecorder - Video recorder to use to record a video of the session (optional)
        Since:
        2.0.0
    • Method Detail

      • setPreviewSurface

        public void setPreviewSurface​(android.view.Surface surface)
        Set a surface on which to render the camera preview
        Parameters:
        surface - Surface on which to render the camera preview
        Since:
        2.0.0
      • setPreviewClass

        public void setPreviewClass​(java.lang.Class<?> previewClass)
        Set preview class – will be used to determine the available preview sizes
        Parameters:
        previewClass - Preview class
        Since:
        2.0.0
      • addListener

        public void addListener​(CameraWrapper.Listener listener)
        Add a listener
        Parameters:
        listener - Listener to add
        Since:
        2.0.0
      • removeListener

        public void removeListener​(CameraWrapper.Listener listener)
        Remove a listener
        Parameters:
        listener - Listener to remove
        Since:
        2.0.0
      • start

        public void start​(int width,
                          int height,
                          int displayRotation)
        Open the camera nad start a preview
        Parameters:
        width - Width of the view in which the camera preview will be rendered
        height - Height of the view in which the camera preview will be rendered
        displayRotation - Display rotation of the view in which the camera preview will be rendered
        Since:
        2.0.0
      • stop

        public void stop()
        Close the camera
        Since:
        2.0.0
      • getImageIterator

        public IImageIterator getImageIterator()
        Get image iterator
        Returns:
        Image iterator used to read images from the camera
        Since:
        2.0.0
      • setCapturedImageMinimumArea

        public void setCapturedImageMinimumArea​(int area)
      • getCapturedImageMinimumArea

        public int getCapturedImageMinimumArea()
      • onStart

        public void onStart​(@NonNull
                            androidx.lifecycle.LifecycleOwner owner)
        Specified by:
        onStart in interface androidx.lifecycle.DefaultLifecycleObserver
      • onStop

        public void onStop​(@NonNull
                           androidx.lifecycle.LifecycleOwner owner)
        Specified by:
        onStop in interface androidx.lifecycle.DefaultLifecycleObserver
      • onDestroy

        public void onDestroy​(@NonNull
                              androidx.lifecycle.LifecycleOwner owner)
        Specified by:
        onDestroy in interface androidx.lifecycle.DefaultLifecycleObserver