Package trackers

Class ScreenRecorder

java.lang.Object
trackers.ScreenRecorder

public class ScreenRecorder extends Object
This class is the screen recorder.
  • Field Details

    • state

      int state
      This variable indicates the state of the screen recorder. 0: initial state; only startAction enabled 1: started, not paused; stopAction and pauseAction enabled 2: started, paused; only resumeAction enabled
    • frameRate

      int frameRate
      This variable indicates the frame rate of the screen recorder.
    • recorder

      private org.bytedeco.javacv.FrameRecorder recorder
    • grabber

      private org.bytedeco.javacv.FrameGrabber grabber
    • timeList

      private final ArrayList<String[]> timeList
    • csvWriter

      private com.opencsv.CSVWriter csvWriter
    • isRecording

      boolean isRecording
    • clipNumber

      private int clipNumber
      This variable indicates the current clip number.
    • frameNumber

      private int frameNumber
      This variable indicates the current frame number.
    • dataOutputPath

      private String dataOutputPath
    • instance

      private static ScreenRecorder instance
  • Constructor Details

    • ScreenRecorder

      public ScreenRecorder()
  • Method Details

    • getInstance

      public static ScreenRecorder getInstance()
    • createEncoder

      private void createEncoder() throws IOException
      Create the encoder using FFmpegFrameGrabber and FFmpegFrameRecorder.
      Throws:
      IOException
    • startRecording

      public void startRecording() throws IOException
      Start recording the screen. Reset the clip number and invoke recordScreen().
      Throws:
      IOException
    • stopRecording

      public void stopRecording() throws IOException
      Stop recording the screen. Write the time list to the CSV file.
      Throws:
      IOException
    • pauseRecording

      public void pauseRecording() throws IOException
      Pause recording the screen. Write the time list to the CSV file and increment the clip number.
      Throws:
      IOException
    • resumeRecording

      public void resumeRecording()
      Resume recording the screen. Invoke recordScreen().
    • recordScreen

      private void recordScreen() throws AWTException, IOException
      Record the screen. Use Timer to schedule the recording with the given frame rate.
      Throws:
      AWTException
      IOException
    • setDataOutputPath

      public void setDataOutputPath(String dataOutputPath)
      Set the data output path.
      Parameters:
      dataOutputPath - The data output path.