`我在开发用于在 ios5 Xcode 编程中运行 mp4 视频的代码时遇到问题。当我运行应用程序时,虽然clip2.mp4 文件在我的bundle 中,但会显示。请给我一个适当的解决方案
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *url = [[NSBundle mainBundle]
pathForResource:@"clip2"
ofType:@"mp4"];
player =[[MPMoviePlayerController alloc]
initWithContentURL:[NSURL fileURLWithPath:url]];
[player prepareToPlay];
[player play];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
//---play movie---
}
- (void) movieFinishedCallback:(NSNotification*) aNotification {
MPMoviePlayerController *play= [aNotification object];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:play];
/ / [player autorelease];
} `