Re: Help with this code
Re: Help with this code
- Subject: Re: Help with this code
- From: Bill Monk <email@hidden>
- Date: Sat, 22 Mar 2008 22:32:57 -0500
There's not enough context to tell what's really going on. )Also,
quicktime-dev may be a more useful list.)
But a few things stick out. As written, the if-test is meaningless
because no NSError is passed to the QTMethod.
movieWithQuickTimeMovie: may be failing, so you may be passing
garbage to setMovie, which crashes.
You can setMovie on the QTMovieView immediately. No need to wait for
a notification. The view will register for the notifications and
enable itself as appropriate. IOW may not need to register for that
notification at all.
(typed in Mail)
NSError *error = nil;
QTMovie *movie = [QTMovie movieWithQuickTimeMovie:[currentObject
theMovie]
disposeWhenDone:NO// Really? unless you call
// DisposeMovie on the oldstyle
// movie, should use YES.
error:&error]; // Without this, test below is meaningless
// don't register for notification here, don't yet know if movie is
valid
if (nil == error)
{
// [movie retain]; // don't need
// setMovie: will retain it, and it's OK to do here (assuming your
QTMovieView exists!)
[clipMovieView setMovie:movie];
// even needed?
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(loadStateChanged:)
name:QTMovieLoadStateDidChangeNotification
object:movie];
// if so, postNotificationName: is a handy shortcut
[NSNotificationCenter defaultCenter]
postNotificationName:@"QTMovieLoadStateDidChangeNotification"
object:movie]];
}
}
// needed?
-(void)loadStateChanged:(NSNotification *) notification
{
QTMovie *movie = [notification object];
long loadState = [[movie attributeForKey:QTMovieLoadStateAttribute]
longValue];
//if (loadState >= kMovieLoadStatePlaythroughOK) // 20000
; // nothing to do, at least as regards setMovie:
}
_______________________________________________
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