标签:
An AVPlayerItem cannot be associated with more than one instance of AVPlayer
如果出现这个问题可以在初始化的时候不设置ContentURL
moviePlayerController_ = [[MPMoviePlayerViewController alloc] init]; moviePlayerController_.movieSourceType = MPMovieSourceTypeStreaming; [moviePlayerController_.moviePlayer setContentURL:url];
原代码:(dingdone)
NSString *titleStr = [mediaDic objectForKey:kMediaVideoTitleKey];
NSURL *vodurl = [mediaDic objectForKey:kMediaVideoUrlKey];
HGMoviePlayerViewController *mediaPlayerController = [[HGMoviePlayerViewController alloc] initWithFrame:self.view.bounds contentURL:vodurl initialType:HGMoviePlayerControlStyleFullScreen withController:nil];
[mediaPlayerController alwaysHideComment:YES];
[mediaPlayerController alwaysHideShare:YES];
mediaPlayerController.contentTitle = titleStr;
[AppNavigationController presentViewController:mediaPlayerController animated:YES completion:^{
}];
播放MP4文件会闪退,改为
NSString *titleStr = [mediaDic objectForKey:kMediaVideoTitleKey];
NSURL *vodurl = [mediaDic objectForKey:kMediaVideoUrlKey];
HGMoviePlayerViewController *mediaPlayerController = [[HGMoviePlayerViewController alloc] initWithFrame:self.view.bounds contentURL:nil initialType:HGMoviePlayerControlStyleFullScreen withController:nil];
[mediaPlayerController setContentURL:vodurl];
[mediaPlayerController play];
[mediaPlayerController alwaysHideComment:YES];
[mediaPlayerController alwaysHideShare:YES];
mediaPlayerController.contentTitle = titleStr;
[AppNavigationController presentViewController:mediaPlayerController animated:YES completion:^{
}];
闪退问题解决,黄底部分是修改的代码。
An AVPlayerItem cannot be associated with more than one instance of AVPlayer错误
标签:
原文地址:http://www.cnblogs.com/shanyimin/p/4704051.html