Using Movies in Your Event Loop
Your application needs to grant time to the Movie Toolbox to allow your movies to play. To do this, you call theMoviesTaskfunction from your main event loop. TheMoviesTaskfunction (described on page 2-110) instructs the Movie Toolbox to service all your active movies. CallMoviesTaskregularly so that your movie can play smoothly. You can use theUpdateMoviefunction to force your movie to be redrawn after it has been uncovered. It will not be redrawn until the next call toMoviesTask.Your application should call
UpdateMoviebetween the Window Manager'sBeginUpdateandEndUpdatefunctions. (For details onBeginUpdateandEndUpdate, see Inside Macintosh: Macintosh ToolBox Essentials Essentials.) Do not callMoviesTaskat this time. You will observe better display behavior if you callMoviesTaskat the end of your update processing.The code shown in Listing 2-13 demonstrates the use of the
UpdateMoviefunction in a Window Manager update sequence. For the Movie Toolbox to know that it has to display (or update) a movie whenMoviesTaskis called, you must callUpdateMovieas shown. If you are using the movie controller component and call theMCIsPlayerEventfunction, you do not need to callUpdateMoviein response to an update event. (See the chapter "Movie Controller Component" in Inside Macintosh: QuickTime Components, for details onMCIsPlayerEvent.)
The
- Note
- Contrary to normal update handling, where applications draw to the window in between calls to
BeginUpdateandEndUpdate, you should not callMoviesTask.![]()
UpdateMoviefunction tells the Movie Toolbox that a portion of the movie has been invalidated. However, it is not redrawn untilMoviesTaskis called.Listing 2-13 Handling movie update events
#include <Events.h> #include <ToolUtils.h> #include "Movies.h" void DoUpdate (WindowPtr theWindow, Movie theMovie) { BeginUpdate (theWindow); UpdateMovie (theMovie); EndUpdate (theWindow); } /* DoUpdate */
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help