• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMovieView stops playing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: NSMovieView stops playing
      • From: Esteban Uribe <email@hidden>
References: 
 >Re: NSMovieView stops playing (From: Esteban Uribe <email@hidden>)

  • Prev by Date: Re: NSMovieView stops playing
  • Next by Date: Re: NSMovieView stops playing
  • Previous by thread: Re: NSMovieView stops playing
  • Next by thread: Re: NSMovieView stops playing
  • Index(es):
    • Date
    • Thread