Some QuickTime functions take a ‘short flags’ as parameter, for example NewMovieFromHandle
or NewMovieFromDataRef
:
- Easily preview Mermaid diagrams
- Live update when editing in your preferred editor
- Capture screenshots with customizable margins
- Create PNG from the Terminal
- Free download on the Mac App Store
OSErr NewMovieFromDataRef (
Movie *m,
short flags,
short *id,
Handle dataRef,
OSType dataRefType
);
These functions may interact with the user in various ways. For example to display a progress dialog when searching for a data ref:
or to display an error dialog if the function cannot resolve a data ref:
In some cases you want to run these functions from a thread and thus you don’t want that QuickTime displays a dialog. Otherwise you application may crash. Here come the flags that you can pass as a parameter.
The Technical Q&A QA1164 explain how to disable QuickTime error dialogs when opening or tasking a movie. It is written:
Starting with QuickTime 6, you can pass the flag newMovieDontInteractWithUser to the various NewMovie… API variants (NewMovieFromFile , NewMovieFromDataRef , etc.) to disable dialogs that may be presented when opening or tasking a movie.
To avoid that QuickTime displays a dialog, you then pass the flag newMovieDontInteractWithUser
as a parameter to these functions and you expect to never see a dialog… But that’s not the case!
The flag newMovieDontInteractWithUser
seems to prevent any dialog excepted the dialogs that appear when resolving a data ref. For these dialogs there is an extra flag called newMovieDontAskUnresolvedDataRefs
. I filled a bug (rdar://6584666) but I doubt Apple will fix it.
newMovieDontAskUnresolvedDataRefs – Controls whether the Movie Toolbox asks the user to locate files. If you set this flag to 0, the Movie Toolbox asks the user to locate files that it cannot find on available volumes. If the Movie Toolbox cannot locate a file even with the user’s help, the function returns a valid movie identifier and sets the current error value to couldNotResolveDataRef.
As a conclusion, when you use the QuickTime API and you want to be sure to never see a dialog, you should pass the flags newMovieDontInteractWithUser | newMovieDontAskUnresolvedDataRefs
.