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 (""));
  int flags = StdQTConstants.createMovieFileDeleteCurFile |
      StdQTConstants.createMovieFileDontCreateResFile |
  movie.convertToFile (file, // file
                       StdQTConstants.kQTFileTypeMovie, // filetype,
                       StdQTConstants.kMoviePlayer, // creator
                       IOConstants.smSystemScript, // scriptTag


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:


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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.