我在网上看到有人提到过这个问题,但还没有找到答案。
我正在使用ALMovieplayercontroller库。一切都正常,但当我尝试播放YouTube视频时,它会给我报错。
_itemFailedToPlayToEnd: { kind = 1; new = 2; old = 0; }
编辑
- (void)setContentURL:(NSURL *)contentURL {
self.movieSourceType = MPMovieSourceTypeStreaming;
[super setContentURL:contentURL];
[[NSNotificationCenter defaultCenter] postNotificationName:ALMoviePlayerContentURLDidChangeNotification object:nil];
[self play];
}
这是我的代码
ALMoviePlayerControls *movieControls = [[ALMoviePlayerControls alloc] initWithMoviePlayer:self.moviePlayer style:ALMoviePlayerControlsStyleDefault];
//[movieControls setAdjustsFullscreenImage:NO];
[movieControls setBarColor:[UIColor colorWithRed:195/255.0 green:29/255.0 blue:29/255.0 alpha:0.5]];
[movieControls setTimeRemainingDecrements:YES];
//assign controls
[self.moviePlayer setControls:movieControls];
[self.view addSubview:self.moviePlayer.view];
self.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
//THEN set contentURL
[self.moviePlayer setContentURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=NaosmAGx8NM"]];
我找不到这个问题的解决方案。
请帮忙。