码迷,mamicode.com
首页 > 其他好文 > 详细

An AVPlayerItem cannot be associated with more than one instance of AVPlayer错误

时间:2015-08-05 11:59:45      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:

An AVPlayerItem cannot be associated with more than one instance of AVPlayer

 

 

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!