Re: Play a song with QTMovie
Re: Play a song with QTMovie
- Subject: Re: Play a song with QTMovie
- From: Dani <email@hidden>
- Date: Tue, 26 Jun 2007 23:47:20 +0200
Well then I've to make a loop, checking if the song is still playing?
I think the best option is use a NSNotification, but the problem is
that I don't know how it works.
El 26/06/2007, a las 23:43, Charles Steinman escribió:
If I recall, a movie is playing if its rate is not 0.
So you should be able to check [movie rate] != 0.
Cheers,
Chuck
--- Dani <email@hidden> wrote:
I've tried making a new Cocoa Application project
with Xcode, and now
it seems to work well, but now I don't know how to
check if a song is
currently playing or not.
I've make an interface with 2 buttons, one for start
playing a song
and another to stop current song, so I've got
something like this in
the @implementation file :
- (IBAction)play:(id)sender
{
src = @"/Users/bittercold/Desktop/deadbolt.aif";
snd = [[QTMovie alloc] initWithFile:src error:
NULL];
[snd play];
}
- (IBAction)stop:(id)sender
{
[snd stop];
}
and this in the @interface file:
@interface PlaySong : NSObject
{
NSString *src;
QTMovie *snd;
}
- (IBAction)play:(id)sender;
- (IBAction)stop:(id)sender;
@end
It's obvious that when I click the Play button for
the first time
it'll work, but if I press a second time, it'll
create a new instance
of QTMovie. Am I wrong? So, how can I check if
there's another song
currently playing to prevent creating a new one?
Thanks
______________________________________________________________________
______________
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden