org.opensourcephysics.media.core
Interface VideoRecorder

All Known Implementing Classes:
GifVideoRecorder, ImageVideoRecorder, ScratchVideoRecorder

public interface VideoRecorder

This defines methods for creating a video from a series of images.

Version:
1.0
Author:
Douglas Brown

Method Summary
 void addFrame(java.awt.Image image)
          Adds a video frame to the current video.
 void createVideo()
          Creates a new video to which frames can be added.
 void createVideo(java.lang.String fileName)
          Creates a new video with the specified file name.
 java.lang.String getFileName()
          Gets the current file name.
 Video getVideo()
          Gets the current video.
 void reset()
          Discards the current video and resets the recorder to a ready state.
 java.lang.String saveVideo()
          Saves the video to the current file.
 java.lang.String saveVideo(java.lang.String fileName)
          Saves the video to the specified file.
 java.lang.String saveVideoAs()
          Saves the video to a file selected with a chooser.
 void setFileName(java.lang.String path)
          Sets the file name.
 void setFrameDuration(double millis)
          Sets the time duration per frame for subsequent added frames.
 void setSize(java.awt.Dimension dimension)
          Sets the size of the video.
 

Method Detail

createVideo

void createVideo()
                 throws java.io.IOException
Creates a new video to which frames can be added.

Throws:
java.io.IOException

createVideo

void createVideo(java.lang.String fileName)
                 throws java.io.IOException
Creates a new video with the specified file name.

Parameters:
fileName - name of the file to which the video will be written
Throws:
java.io.IOException

setSize

void setSize(java.awt.Dimension dimension)
Sets the size of the video.

Parameters:
dimension - the dimensions of the new video

setFrameDuration

void setFrameDuration(double millis)
Sets the time duration per frame for subsequent added frames.

Parameters:
millis - the duration per frame in milliseconds

addFrame

void addFrame(java.awt.Image image)
              throws java.io.IOException
Adds a video frame to the current video.

Parameters:
image - the image to be drawn on the video frame.
Throws:
java.io.IOException

getVideo

Video getVideo()
               throws java.io.IOException
Gets the current video. Ends editing.

Returns:
the active video as a Video object
Throws:
java.io.IOException

saveVideo

java.lang.String saveVideo()
                           throws java.io.IOException
Saves the video to the current file.

Returns:
the full path of the saved file
Throws:
java.io.IOException

saveVideo

java.lang.String saveVideo(java.lang.String fileName)
                           throws java.io.IOException
Saves the video to the specified file.

Parameters:
fileName - the file name to be saved
Returns:
the full path of the saved file
Throws:
java.io.IOException

saveVideoAs

java.lang.String saveVideoAs()
                             throws java.io.IOException
Saves the video to a file selected with a chooser.

Returns:
the full path of the saved file
Throws:
java.io.IOException

getFileName

java.lang.String getFileName()
Gets the current file name. May be null.

Returns:
the path of the current destination video file

setFileName

void setFileName(java.lang.String path)
Sets the file name. May be null.

Parameters:
path - the file name

reset

void reset()
Discards the current video and resets the recorder to a ready state.