O'Reilly logo

QuickTime for Java: A Developer's Notebook by Chris Adamson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required