我已将此代码添加到该viewDidLoad
方法中:
NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@"myvid" ofType:@"m4v"];
NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
MPMoviePlayerController* moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
moviePlayer.controlStyle = MPMovieControlStyleNone;
[self.view insertSubview: moviePlayer.view aboveSubview: self.view];
[moviePlayer play];
它不起作用!如何在 iOS 的视图背景中播放视频?(使用故事板)