我想知道如何在我的应用程序加载时播放视频,然后使用MPMoviePlayerController
. 我正在将视频加载到viewDidLoad
. 视频播放完毕后如何跳转到下一页?
示例代码在这里:
- (void)viewDidLoad
{
NSLog(@"Welcome to Home Page");
[super viewDidLoad];
self.parentViewController.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg-image-new.png"]];
NSBundle * bundle =[NSBundle mainBundle];
NSString * moviepath = [bundle pathForResource:@"opening_ani" ofType:@"mp4"];
NSURL * movieurl = [[NSURL fileURLWithPath:moviepath]retain];
MPMoviePlayerController * themovie = [[MPMoviePlayerController alloc]initWithContentURL:movieurl];
themovie.view.frame=CGRectMake(0, 0, 1024, 768);
[self.view addSubview:themovie.view];
[themovie play];
[themovie setShouldAutoplay:NO];
}