Class VideoRecorderAppState

java.lang.Object
com.jme3.app.state.AbstractAppState
com.jme3.app.state.VideoRecorderAppState
All Implemented Interfaces:
AppState

public class VideoRecorderAppState extends AbstractAppState
A Video recording AppState that records the screen output into an AVI file with M-JPEG content. The file should be playable on any OS in any video player.
The video recording starts when the state is attached and stops when it is detached or the application is quit. You can set the fileName of the file to be written when the state is detached, else the old file will be overwritten. If you specify no file the AppState will attempt to write a file into the user home directory, made unique by a timestamp.
  • Constructor Details

    • VideoRecorderAppState

      public VideoRecorderAppState()
      Using this constructor the video files will be written sequentially to the user's home directory with a quality of 0.8 and a framerate of 30fps.
    • VideoRecorderAppState

      public VideoRecorderAppState(float quality)
      Using this constructor the video files will be written sequentially to the user's home directory.
      Parameters:
      quality - the quality of the jpegs in the video stream (0.0 smallest file - 1.0 largest file)
    • VideoRecorderAppState

      public VideoRecorderAppState(float quality, int framerate)
      Using this constructor the video files will be written sequentially to the user's home directory.
      Parameters:
      quality - the quality of the jpegs in the video stream (0.0 smallest file - 1.0 largest file)
      framerate - the frame rate of the resulting video, the application will be locked to this framerate
    • VideoRecorderAppState

      public VideoRecorderAppState(File file)
      This constructor allows you to specify the output file of the video. The quality is set to 0.8 and framerate to 30 fps.
      Parameters:
      file - the video file
    • VideoRecorderAppState

      public VideoRecorderAppState(File file, float quality)
      This constructor allows you to specify the output file of the video as well as the quality
      Parameters:
      file - the video file
      quality - the quality of the jpegs in the video stream (0.0 smallest file - 1.0 largest file)
    • VideoRecorderAppState

      public VideoRecorderAppState(File file, float quality, int framerate)
      This constructor allows you to specify the output file of the video as well as the quality.
      Parameters:
      file - the video file
      quality - the quality of the jpegs in the video stream (0.0 smallest file - 1.0 largest file)
      framerate - the frame rate of the resulting video, the application will be locked to this framerate
  • Method Details

    • getFile

      public File getFile()
    • setFile

      public void setFile(File file)
    • getQuality

      public float getQuality()
      Get the quality used to compress the video images.
      Returns:
      the quality of the jpegs in the video stream (0.0 smallest file - 1.0 largest file)
    • setQuality

      public void setQuality(float quality)
      Set the video image quality from 0(worst/smallest) to 1(best/largest).
      Parameters:
      quality - the quality of the jpegs in the video stream (0.0 smallest file - 1.0 largest file)
    • initialize

      public void initialize(AppStateManager stateManager, Application app)
      Description copied from interface: AppState
      Called by AppStateManager when transitioning this AppState from initializing to running.
      This will happen on the next iteration through the update loop after AppStateManager.attach(com.jme3.app.state.AppState) was called.

      AppStateManager will call this only from the update loop inside the rendering thread. This means is it safe to modify the scene graph from this method.

      Specified by:
      initialize in interface AppState
      Overrides:
      initialize in class AbstractAppState
      Parameters:
      stateManager - The state manager
      app - The application
    • cleanup

      public void cleanup()
      Description copied from interface: AppState
      Called by AppStateManager when transitioning this AppState from terminating to detached. This method is called the following render pass after the AppState has been detached and is always called once and only once for each time initialize() is called. Either when the AppState is detached or when the application terminates (if it terminates normally).
      Specified by:
      cleanup in interface AppState
      Overrides:
      cleanup in class AbstractAppState