Re: NSMovieView stops playing
Re: NSMovieView stops playing
- Subject: Re: NSMovieView stops playing
- From: Ben Haller <email@hidden>
- Date: Sat, 10 May 2003 02:37:22 -0700
I've been using NSMovie and QT APIs in the following way.
soundPlayer = [[NSMovie alloc] initWithURL:[NSURL
fileURLWithPath:soundAtPath] byReference:YES];
SetMovieVolume([soundPlayer QTMovie], kFullVolume ); //kFullVolume is
of value 256.0 and max sound output.
StartMovie([soundPlayer QTMovie]);
The only obvious problem here is that you basically leak until the
movie is done playing.
If you autorelease soundPlayer it will kill the sound upon release.
You may want to have an NSTimer check occasionally to see if the movie
is still playing and clean up when it is done.
You can check if the movie is still playing with the following:
IsMovieDone([soundPlayer QTMovie]);
And you can stop the movie with:
StopMovie([soundPlayer QTMovie]);
And go back to the start of the movie with:
GoToBeginningOfMovie([soundPlayer QTMovie]);
Very interesting indeed. I've just been experimenting with putting
in "MoviesTask(NULL, 0);" somewhere that gets called a lot, and so far
(more testing yet to be done) it seems to alleviate the problem of the
sounds stopping playing. Somebody in a different thread about
NSMovieView said that MoviesTask() didn't need to be called when using
the Cocoa APIs, but I decided to try it anyway, and it seems to be
working for me.
Although MoviesTask() seems to be fixing my bug for me, I may switch
to your non-NSMovieView-based way of doing things anyway; it seems a
little cleaner and less likely to have weird problems, since it goes
more directly to the lower levels. Are you calling MoviesTask in the
way you're doing things, or is that unnecessary?
Thanks!
Ben Haller
Stick Software
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.