Class SessionVideoRecorder

  • All Implemented Interfaces:
    android.media.MediaRecorder.OnErrorListener, androidx.lifecycle.DefaultLifecycleObserver, androidx.lifecycle.LifecycleObserver, ISessionVideoRecorder

    public class SessionVideoRecorder
    extends java.lang.Object
    implements ISessionVideoRecorder, android.media.MediaRecorder.OnErrorListener
    Session video recorder
    Since:
    2.0.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<android.view.Surface> getSurface()
      Get surface
      java.util.Optional<java.io.File> getVideoFile()
      Get a file in which to save the video
      void onDestroy​(androidx.lifecycle.LifecycleOwner owner)  
      void onError​(android.media.MediaRecorder mediaRecorder, int i, int i1)
      Called when an error occurs while recording.
      void setup​(android.util.Size videoSize, int rotationDegrees)
      Set up the video recorder
      void start()
      Start recording video
      void stop()
      Stop recording video
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface androidx.lifecycle.DefaultLifecycleObserver

        onCreate, onPause, onResume, onStart, onStop
    • Constructor Detail

      • SessionVideoRecorder

        public SessionVideoRecorder()
    • Method Detail

      • setup

        public void setup​(android.util.Size videoSize,
                          int rotationDegrees)
        Description copied from interface: ISessionVideoRecorder
        Set up the video recorder
        Specified by:
        setup in interface ISessionVideoRecorder
        Parameters:
        videoSize - Size of the raw video frames
        rotationDegrees - Rotation of the video in degrees
      • getVideoFile

        public java.util.Optional<java.io.File> getVideoFile()
        Description copied from interface: ISessionVideoRecorder
        Get a file in which to save the video
        Specified by:
        getVideoFile in interface ISessionVideoRecorder
        Returns:
        File in which to save the video
      • onDestroy

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

        public void onError​(android.media.MediaRecorder mediaRecorder,
                            int i,
                            int i1)
        Description copied from interface: android.media.MediaRecorder.OnErrorListener
        Called when an error occurs while recording.
        Specified by:
        onError in interface android.media.MediaRecorder.OnErrorListener
        Parameters:
        mediaRecorder - the MediaRecorder that encountered the error
        i - the type of error that has occurred:
        • MediaRecorder.MEDIA_RECORDER_ERROR_UNKNOWN
        • MediaRecorder.MEDIA_ERROR_SERVER_DIED
        i1 - an extra code, specific to the error type