我正在 iPad 上播放电影。如果我只是加载一个 mp4 文件,播放器不会自动启动 - 但对于 m3u8 示例,它坚持自动启动。有没有人遇到过这个?难道我做错了什么?
- (id)initWithVideo:(VideoDO*)video frame:(CGRect)rect {
NSURL* videoURL = [NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]; // With this URL, player starts automatically
self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
moviePlayer.shouldAutoplay = NO;
moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
moviePlayer.view.frame = rect;
moviePlayer.view.backgroundColor = [UIColor blackColor];
[moviePlayer prepareToPlay];
self.view = moviePlayer.view;
[moviePlayer stop];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieChangedLoadState:) name:MPMoviePlayerLoadStateDidChangeNotification object:moviePlayer];
return self;
}