QuickTime for Java
| Company type | Software library |
|---|---|
| Industry | Multimedia software |
| Founded | 1999 |
| Founder | Apple Inc. |
| Fate | Deprecated by Apple |
| Headquarters | Cupertino, California , United States |
| Products | QuickTime for Java (QTJ) |
| Owner | Apple Inc. |
QuickTime for Java (QTJ) is a software library that allows Java applications running on Mac OS, Mac OS X, and Microsoft Windows to utilize multimedia capabilities by interfacing with the underlying native QuickTime framework. It facilitates functions such as capturing, editing, playing back, and exporting various media formats and codecs.
QTJ has been officially deprecated by Apple.
History
According to Owen W. Linzmayer in Apple Confidential 2.0, QTJ originated from Kaleida Labs, an Apple-IBM collaborative initiative, and stood out as one of the few successful outcomes from the $150 million investment. Initially developed under the codename "Biscotti," QTJ was introduced as a public beta in 1999. Subsequent releases were bundled by default with Mac OS and Mac OS X, while being optionally available alongside QuickTime for Windows.
QTJ 6.1
In 2003, Apple's update to Java 1.4.1 disrupted QTJ applications on Mac OS X due to a transition from the Carbon framework to Cocoa for AWT, coupled with the removal of the native Java bridge "JDirect," which QTJ relied upon. Although applications could still operate under Java 1.3.1, those dependent on features introduced in Java 1.4 encountered issues.
Apple addressed this by releasing QTJ version 6.1, which improved compatibility through a simplified set of GUI classes and an API redesign: developers were now expected to initiate with a Movie object and obtain GUI elements via a factory pattern instead of creating components directly. However, this update removed support for preview components associated with input devices such as webcams or camcorders.
Design
QTJ offers an object-oriented interface built atop the native C-based QuickTime library by mapping standard structs and functions into corresponding Java classes and methods—for instance, transforming the Movie struct into quicktime.std.movies.Movie, which includes methods like fromFile() and getTrackCount(). This design delivers a more refined object-oriented experience compared to other C-to-Java wrappers like JOGL.
In a similar vein, Apple’s Cocoa-based QTKit provides an Objective-C object-oriented abstraction over QuickTime.
Although Apple’s use of the top-level package name quicktime does not adhere to Java’s conventional reverse-domain naming scheme, it does not cause namespace conflicts due to Apple’s trademark rights.
As a Java wrapper around native QuickTime libraries, QTJ requires QuickTime to be installed on classic Mac OS (now unsupported), Mac OS X, or Windows platforms to operate properly.
Features
QTJ exposes most functionalities of the native QuickTime library, including:
- Playback capabilities
- Editing tools
- Capture functionality
- Graphic import/export
- Movie import/export
- Sample-level media access
Serving as a wrapper around QuickTime, QTJ supports an extensive array of media formats and codecs such as MPEG-1, MPEG-4, H.264, AAC, Sorenson Video, Flash, 3GPP, WAV, and AIFF. Due to QuickTime’s extensible nature, QTJ can also handle additional formats like DivX and Ogg Vorbis through third-party QuickTime components.
Code Example
The following sample illustrates how to use an AWT file-selection dialog to choose and play a media file:
<syntaxhighlight lang="java"> import java.io.File; import java.awt.*;
import quicktime.*; import quicktime.std.movies.Movie; import quicktime.app.view.QTFactory; import quicktime.io.*;
public class TrivialQTJPlayer extends Frame {
public static void main (String[] args) {
try {
QTSession.open();
Frame frame = new TrivialQTJPlayer();
frame.pack();
frame.setVisible(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public TrivialQTJPlayer()
throws QTException {
FileDialog fileDialog = new FileDialog(this, "TrivialJMFPlayer", FileDialog.LOAD);
fileDialog.setVisible(true);
File selectedFile = new File(fileDialog.getDirectory(), fileDialog.getFile());
OpenMovieFile openMovieFile = OpenMovieFile.asRead(new QTFile(selectedFile));
Movie movie = Movie.fromFile(openMovieFile);
Component component = QTFactory.makeQTComponent(movie).asComponent();
add(component);
movie.start();
}
} </syntaxhighlight>
In this example, the primary QTJ methods used are OpenMovieFile.asRead() and Movie.fromFile(), which load a QuickTime movie file, while QTFactory generates an AWT component to render the video. To incorporate playback controls such as a scrubber bar, developers would instantiate a MovieController component rather than embedding the movie directly.
Status and Outlook
The use of QTJ remains limited due to its dependency on Apple’s proprietary QuickTime framework, which is only supported on Mac and Windows operating systems. Without Apple extending QuickTime to other platforms like Linux, QTJ cannot function there.
On contemporary Windows machines employing no-execute (NX) memory protections, many QTJ features fail to operate correctly, triggering execution errors that hinder running demos or applications unless intricate adjustments are made. This issue restricts QTJ’s practicality for commercial software development targeting Windows users.
Since the launch of QTJ version 6.1 in 2003, Apple has issued only minor updates focused on bug fixes. Importantly, QuickTime 7 introduced new native APIs—covering aspects like metadata processing and advanced codecs with frame reordering—that QTJ does not encapsulate or support. Additionally, Apple removed capture preview classes present in earlier releases. Furthermore, QTJ relies on outdated native APIs such as QuickDraw, which Apple no longer endorses, thereby diminishing its appeal for long-term professional multimedia application development.
See also
- Java Media Framework
- Xuggler, a cross-platform Java library for video encoding and decoding
External links
- QuickTime for Java at Apple Developer Connection