- (void)play
{
NSError *error = nil;
NSURL *url = [NSURL URLWithString:@"http://87.98.222.14:7030"];
NSDictionary *movieAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
url, QTMovieURLAttribute,
[NSNumber numberWithBool:YES], QTMovieOpenForPlaybackAttribute,
nil];
movie = [[QTMovie alloc] initWithAttributes:movieAttrs error:&error];
if (!movie || error)
NSLog(@"Couldn't init movie: %@", [error localizedDescription]);
else
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loadStateDidChange:) name:QTMovieLoadStateDidChangeNotification object:movie];
}
- (void)loadStateDidChange:(NSNotification *)notif
{
QTMovieLoadState state = [[movie attributeForKey:QTMovieLoadStateAttribute] integerValue];
if (state == QTMovieLoadStateError)
NSLog(@"error: %@", [[movie attributeForKey:QTMovieLoadStateErrorAttribute] localizedDescription]);
else if (state >= QTMovieLoadStatePlayable)
[movie play];
}