Re: QTKit quickie
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