java.lang.Object
org.openpatch.scratch.extensions.recorder.Recorder
Direct Known Subclasses:
FFmpegRecorder, FrameRecorder, GifRecorder

public abstract class Recorder extends Object
The Recorder class provides a framework for recording frames to a file. It includes methods to start and stop the recording process, and an abstract method saveFrame() that must be implemented by subclasses to define the specific behavior for saving a frame.

This class is intended to be extended by other classes that provide concrete implementations for saving frames in different formats.

Example usage:


 public class MyRecorder extends Recorder {
     public MyRecorder(String path, String ext) {
         super(path, ext);
     }

     @Override
     public void saveFrame() {
         // Implementation for saving a frame
     }
 }
 

Note: The Recorder class uses the Applet class to register a method that is called after each frame is drawn. This ensures that frames are saved at the appropriate time during the recording process.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Recorder(String path, String ext)
    Constructs a new Recorder object with the specified file path and extension.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called after each frame is drawn.
    abstract void
    Saves the current frame.
    void
    Starts the recording process.
    void
    Stops the recording process.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Recorder

      public Recorder(String path, String ext)
      Constructs a new Recorder object with the specified file path and extension. If the provided path does not end with the specified extension, the extension is appended to the path.
      Parameters:
      path - the file path where the recording will be saved
      ext - the file extension to be used for the recording
  • Method Details

    • post

      public void post()
      Called after each frame is drawn. This method is registered with the Applet class to ensure that frames are saved at the appropriate time during the recording process.
    • saveFrame

      public abstract void saveFrame()
      Saves the current frame. This method should be implemented by subclasses to define the specific behavior for saving a frame.
    • start

      public void start()
      Starts the recording process.
    • stop

      public void stop()
      Stops the recording process.