我正在尝试播放 MP4 文件MPMoviePlayerController
(也尝试了两个 m4v 文件,同样的问题),最后让视频播放器出现,但它只是保持加载。这是我的代码,在按下按钮时执行:
NSString *videoFile = [[NSBundle mainBundle] pathForResource:@"attn8" ofType:@"mp4" inDirectory:@""];
NSURL *url = [NSURL fileURLWithPath:videoFile isDirectory:NO];
player = [[MPMoviePlayerController alloc] initWithContentURL:url];
player.movieSourceType = MPMovieSourceTypeFile;
//put on a whim from another answer, made no difference
[self.view addSubview:[player view]];
player.fullscreen = true;
[player prepareToPlay];
[player play];