ADC Home > Reference Library > Technical Q&As > QuickTime > Movie Basics >

Preroll Movies

It is of utmost importance that you preroll your movies using the PrerollMovie call. Failing to do so will introduce playback problems, especially when the movie starts. PrerollMovie will fill caches and buffers optimally to prevent initial playback stuttering.

Note that StartMovie will preroll the movie; also, the standard controller prerolls the movie whenever the user starts a movie using the keyboard or the mouse. In these situations, a possible second PrerollMovie call is redundant and will waste time and resources.

In all other cases, you should preroll the movie. For instance, it is your responsibility to call PrerollMovie if you are using SetMovieRate, or if you use McDoAction with mcActionPlay and a rate. Here's an example of how to use PrerollMovie:

OSErr DoPrerollMovie(Movie    theMovie)
{
    TimeValue         aTimeValue;
    TimeValue         aMovieDur;
    Fixed             aPreferredRate;
    OSErr            anErr = noErr;

    aTimeValue     = GetMovieTime(theMovie, nil);
    aMovieDur    = GetMovieDuration(theMovie);
    aPreferredRate = GetMoviePreferredRate(theMovie);

    anErr = PrerollMovie(theMovie, aTimeValue, aPreferredRate);

    return anErr;
}

[May 01 1995]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.