Inside Macintosh: QuickTime Reference
| Previous | Chapter Contents | Chapter Top | Next |
QuickTime 4.1 introduces asynchronous movie loading.
With asynchronous movie loading, a call to NewMovieFromDataRef or NewMovieFromFile, for example, returns immediately, even if you're opening a large movie over a slow connection, such as a dial-up modem. This allows your application to make use of the download time for user interaction, housekeeping, or whatever you like. Then, as the data becomes available, the movie becomes playable. To the user, the introduction of asynchronous movie loading can mean a more responsive system. To the developer, it can mean more time to do things while a movie loads.
With movies loading asynchronously, the difference in user experience centers on the time before the movie data has actually been located and processed. Instead of a fully formed movie being immediately available and playable, the Player window displays the message Loading... until the movie resource is located or the file has been imported. At that point, the window can resize, auto play can occur if necessary, and other choices about the movie and the controller can be made.
The Movie Media Handler also takes advantage of this feature.
In the context of asynchronous movie loading, the following items should be noted:
Aside from a more responsive system, the fundamental change for the developer that asynchronous loading brings is that the NewMovieFrom... function will return a valid movie, but that movie may be completely empty, i.e., it may contain no tracks, user data, and so on. At some point, when the movie resource is found or the file has been imported all of this information is then available. A developer may need to defer querying of the movie for properties, Userdata, and other characteristics until that time.
To enable asynchronous loading when opening a movie, you pass the additional flag
newMovieAsyncOK = 1 << 8to NewMovieFromDataRef, NewMovieFromFile, and so on. Passing this flag does not require that the loading be performed asynchronously, but only allows it to be so.
Without newMovieAsyncOK, calling one of the NewMovieFrom... calls either returns a fully formed movie or an error -- blocking until either can be satisfied.
Inside Macintosh: QuickTime Reference
| Previous | Chapter Contents | Chapter Top | Next |