Saving a Movie to a File

Once a user has performed a number of edits and has a finished project, she presumably needs to save the movie to disk. In QuickTime, many different actions can be thought of as “saving” a movie. Perhaps the simplest and most flexible option is to let the user decide.

How do I do that?

The SaveableQTEditor uses a QTFile to keep track of where a movie was loaded from (null in the case of a new movie). This is used by the doSave( ) method to indicate where the saved file goes:

public void doSave( ) throws QTException {
  // if no existing file, then prompt for one
  if (file =  = null) {
      file = new QTFile (new File ("simplemovie.mov"));
  }
  int flags = StdQTConstants.createMovieFileDeleteCurFile |
      StdQTConstants.createMovieFileDontCreateResFile |
      StdQTConstants.showUserSettingsDialog;
  movie.convertToFile (file, // file
                       StdQTConstants.kQTFileTypeMovie, // filetype,
                       StdQTConstants.kMoviePlayer, // creator
                       IOConstants.smSystemScript, // scriptTag
                       flags);
}

Note

Compile and run this example with ant run-ch03-saveableqteditor.

When the user hits the Save menu item, she’ll see the QuickTime Save As dialog as shown in Figure 3-3.

QuickTime Save As dialog

Figure 3-3. QuickTime Save As dialog

This dialog’s Export selector gives the user four choices:

Movie

Saves a QuickTime reference movie , a tiny (typically 4 or 8 KB) file that contains just references (pointers) to the media in their original locations ...

Get QuickTime for Java: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.