CocoaDev

Edit AllPages

Here is some sample code to load a movie (anything that QuickTime supports) and start playing it (only audio though).

Please note, NSMovie and NSMovieView are obsolete in favor of QTMovie.

The timer (which checks for the end of the movie) is added to the current run loop, so that when the window is resizing, and other GUI stuff is happening, the movie keeps playing. This is important if you want to have smooth playback. The QuickTime functions used are StartMovie(), StopMovie(), IsMovieDone() and MoviesTask(). MoviesTask is used to keep playing the movie.