• 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: QTKit quickie
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QTKit quickie


  • Subject: Re: QTKit quickie
  • From: Tim Monroe <email@hidden>
  • Date: Wed, 6 Jul 2005 10:50:05 -0700


On Jul 6, 2005, at 10:34 AM, Matt Neuburg wrote:

That's fine, and I've no objection to it. But then when Tiger's QTKit came
along, I thought: so surely this will provide (if I may put it this way
non-prejudicially) a "pure Cocoa" way of doing something so simple as
playing a sound at a specified volume. So I tried to create a QTKit analogy
to the above, like this:


    QTMovie* mov;
    mov = [QTMovie movieWithFile:s error:nil];
    [mov setVolume: whatever];
    // [moviePlayer setMovie:mov];
    [mov play];

It doesn't work (no sound emerges). But if I have an outlet to a QTMovieView
called "moviePlayer" and I uncomment the commented line, it works just fine.
The QTMovieView needn't be visible (or have any controller or even any
size), but still, this seems like excessive overhead just for the sake of
controlling the sound volume.


Hence, my question. Thx again for any comments - m.

So my previous suspicion was right. In this line:

mov = [QTMovie movieWithFile:s error:nil];

you are creating an autoreleased object. Once you reenter the run loop, it's disposed of. The reason your code works when you assign the movie to a movie view is that the movie view retains the QTMovie object. And the retained QTMovie gets idled through the normal idling mechanism built into QTMovie, hence the movie plays.


You just need to change your code to do this:

    QTMovie* mov;
    mov = [[QTMovie alloc] initWithFile:s error:nil];
    [mov setVolume: whatever];
    [mov play];

which works as expected.


Tim Monroe QuickTime Engineering email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: QTKit quickie
  • Next by Date: NSUserDefaultsController and NSTextField
  • Previous by thread: Re: QTKit quickie
  • Next by thread: Re: QTKit quickie
  • Index(es):
    • Date
    • Thread