Quote:
Originally Posted by dany_dev
what about posting the code of the "play" button? 
|
here the code that I use for video:
-(IBAction)playMovie

id)sender
{
UIButton *playButton = (UIButton *) sender;
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"flights_granada_1" ofType:@"mov"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlaybackComplete

name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController.view setFrame:CGRectMake(playButton.frame.origin.x,
playButton.frame.origin.y,
playButton.frame.size.width,
playButton.frame.size.height)];
[self.view addSubview:moviePlayerController.view];
//moviePlayerController.fullscreen = YES;
//moviePlayerController.scalingMode = MPMovieScalingModeFill;
[moviePlayerController play];
}
- (void)moviePlaybackComplete

NSNotification *)notification
{
MPMoviePlayerController *moviePlayerController = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController.view removeFromSuperview];
[moviePlayerController release];
}
This application, If Window-Based works good. But I need to put this video in a View inside a Tab Bar application. But the app crash =(