- (IBAction)btnFilePress:(id)sender {
NSString *path = [[NSBundle mainBundle] pathForResource:@"Moviecountdownwithsound" ofType:@"mp4"];
if (path) {
MovieURL = [NSURL fileURLWithPath:path];
}
//MPMoviePlayerController *thePlayer = [[MPMoviePlayerController alloc] initWithContentURL:MovieURL]; //ver 3.x
MPMoviePlayerViewController *thePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:MovieURL];
//thePlayer.scalingMode = MPMovieScalingModeAspectFit; //ver 3.x
thePlayer.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
thePlayer.moviePlayer.shouldAutoplay = YES;
[thePlayer shouldAutorotateToInterfaceOrientation:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:thePlayer];
//[thePlayer play]; //ver 3.x
[self.navigationController presentModalViewController:thePlayer animated:NO];
}
- (void)myMovieFinishedCallback:(NSNotification *)aNotification {
MPMoviePlayerController *thePlayer = [aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:thePlayer];
[thePlayer release];
}
- (IBAction)btnStreamPress:(id)sender {
NSString *path = @"http://movies.apple.com/media/us/iphone/2010/tours/apple-iphone4-design_video-us-20100607_r848-9cie.mov";
if (path) {
MovieURL = [NSURL URLWithString:path];
}
//MPMoviePlayerController *thePlayer = [[MPMoviePlayerController alloc] initWithContentURL:MovieURL]; //ver 3.x
MPMoviePlayerViewController *thePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:MovieURL];
//thePlayer.scalingMode = MPMovieScalingModeAspectFit; //ver 3.x
thePlayer.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
thePlayer.moviePlayer.shouldAutoplay = YES;
[thePlayer shouldAutorotateToInterfaceOrientation:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:thePlayer];
//[thePlayer play]; //ver 3.x
[self.navigationController presentModalViewController:thePlayer animated:NO];
}
'Object-C' 카테고리의 다른 글
키보드 사라지게 하기 (0) | 2010.10.22 |
---|---|
NSNotificationCenter (0) | 2010.10.10 |
MapView (0) | 2010.10.09 |
XML (0) | 2010.10.09 |
SQLITE (0) | 2010.10.08 |