O'Reilly logo

Mac OS X for Java Geeks by Will Iverson

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

The SimplePlayer Application

As discussed in the last chapter, using these APIs is the best way to get a feel for them. To demonstrate QuickTime, look at the SimplePlayer example. This player can load and play a variety of media formats, including QuickTime movies and MP3 audio files. Additionally, the application allows you to export files to other formats, demonstrating that facet of the QuickTime API. As they are put to use in SimplePlayer, try to recognize the key classes and methods from the last section.

The source for this application, shown in Example 10-1, is surprisingly concise. Much of this code is actually spent in setup and user interface. The actual QuickTime APIs used are fairly simple to understand.

Example 10-1. The SimplePlayer application

package com.wiverson.macosbook.quicktime; import quicktime.std.movies.Movie; import java.awt.event.*; import quicktime.QTException; import quicktime.io.QTFile; import java.awt.FileDialog; import java.awt.Frame; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JDialog; public class SimpleMoviePlayer extends javax.swing.JFrame implements quicktime.std.StdQTConstants, quicktime.Errors, quicktime.io.IOConstants { public static void main(String args[]) { try { // Required to initialize the QuickTime environment. // Performs checks to ensure QuickTime is installed and // also loads and sets up QuickTime. quicktime.QTSession.open( ); SimpleMoviePlayer myPlayer = new SimpleMoviePlayer("Simple ...

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