There are several different tool sets available for playing movies in QuickTime. The high-level tool sets all make use of a movie controller component; these components do most of the work required to play the movie, such as setting up any streams or buffers, resizing the movie, and redrawing the movie when it is moved or part of it is uncovered.
A movie controller component can include a human interface, allowing the user to start, stop, rewind, scrub, and adjust the sound volume, without you having to write any supporting code. This user interface need not be displayed, however.
You can override or augment any of the movie controller component functions with your own code by installing a callback function using MCSetActionFilterWithRefCon, and you can call any of the movie controller component’s functions directly from your code (in response to input from your own custom user interface, for example). For details, see “Working Directly with Movie Controller Components.”
There are low-level commands in the Movie Toolbox that you can also use to control movies. This is usually neither necessary nor desirable, however, as it adds considerably to the complexity of your application. It also increases the risk that your application will not be able to take advantage of new features as they are added to QuickTime. If you use a movie controller component, the control code is updated with new versions of QuickTime and generally takes advantage of new features.
You can also enable a simple editing interface in a movie controller, giving the user the ability to perform cut-and-paste movie editing without requiring you to write supporting code. For more information, see QuickTime Movie Basics.
Once you have attached a movie controller component to your movie, to play the movie all you have to do is grant time to the controller.
In QuickTime 7 and later on Mac OS X, you can display the movie using an HIMovieView; the operating system automatically grants time to the controller as needed. You can create and initialize an HIMovieView using Interface Builder, greatly simplifying your code.
In QuickTime 6 and later on Mac OS X, you can display the movie using a Carbon movie controller. While somewhat more limited and more complex to set up than an HIMovieView, a Carbon movie controller also gets the processing time it needs automatically.
In older versions of QuickTime for Mac OS X, you can use a Carbon timer to generate an event whenever the movie needs processor time; you set a callback procedure that responds to this event by granting time to the controller and resetting the timer.
For versions of QuickTime running on Windows, or on Mac OS 9, you must periodically give idle time to the movie controller in your run loop.
Important: A movie controller component is not the same thing as the standard movie control bar. The standard movie control bar is one optional feature of movie controller components. You can use a movie controller component with any kind of interface, or no interface at all.
Note: Before you can play a movie, you need to either create a movie or get one from an external source. See “Getting a Movie” and QuickTime Movie Creation Guide.
Playing a Movie Using HIMovieView
Playing a Movie Using a Carbon Movie Control
Playing a Movie Using a Movie Controller Component
Working Directly with Movie Controller Components
Bypassing the Movie Controller
Last updated: 2005-08-11