我正在尝试通过我的应用播放YouTube视频来测试稍后需要链接的视频(还没有视频链接)。我正在尝试使用MPMoviePlayer从UIImageView到UIWebView的所有内容。它启动播放器,然后在几秒钟后停止,日志中包含以下内容:
_itemFailedToPlayToEnd:
{
kind = 1;
new = 2;
old = 0;
}
_itemFailedToPlayToEnd:(null)
我不确定会出现什么问题,因为我没有那么多将视频流式传输到我的应用中的经验。谢谢你的帮助。
-(void)playMovie:(id)sender
{
UIWebView *video1 = [UIWebView new];
video1.frame = CGRectMake(100, 100, 60, 60);
NSURL *url = [NSURL URLWithString:@"https://www.youtube.com/watch?v=w9bBQRWkV8M"];
MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(movieFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:self.player];
mp.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[self presentMoviePlayerViewControllerAnimated:mp];
[self.view addSubview:self.player.view];
[self.player setFullscreen:YES];
self.player.shouldAutoplay = YES;
[self.player prepareToPlay];
}