简体   繁体   English

nsinvalidargumentexception'reason'avplayeritem无法与多个avplayer实例关联'

[英]nsinvalidargumentexception' reason 'an avplayeritem cannot be associated with more than one instance of avplayer'

I am using 我在用

MPMoviePlayerController 的MPMoviePlayerController

for play video and in this I used custom seek bar to jump video. 对于播放视频,在此我使用自定义搜索栏来跳转视频。 but when I continuously do the seeking forward and rewind then application crashed and throw below error: 但是当我不断地进行前进和后退时,应用程序崩溃并抛出以下错误:

nsinvalidargumentexception' reason 'an avplayeritem cannot be associated with more than one instance of avplayer' nsinvalidargumentexception'reason'avplayeritem无法与多个avplayer实例关联'

So please suggest. 所以请建议。

Thanks 谢谢

Had same issue, try setting ContentURL after Setting the SourceType like below, 有同样的问题,尝试在设置SourceType之后设置ContentURL,如下所示,

moviePlayerController_ = [[MPMoviePlayerViewController alloc] init];
moviePlayerController_.movieSourceType = MPMovieSourceTypeStreaming;
[moviePlayerController_.moviePlayer setContentURL:url];

Source: devforums.apple.com/message/467199 资料来源: devforums.apple.com/message/467199

Had same experience. 有相同的经验。 realized movieSourceType was set incorrectly. 实现的movieSourceType设置不正确。 For example, movieSourceType was set to MPMovieSourceTypeStreaming when it should have been MPMovieSourceTypeFile for a movie embedded in the bundle. 例如,movieSourceType设置为MPMovieSourceTypeStreaming,它应该是嵌入在包中的电影的MPMovieSourceTypeFile。

I had the same problem and in my case the problem is that I couldn't tell if the movie is a file or a stream (the URL doesn't tell), so I set it to MPMovieSourceTypeUnknown and that also solved the problem. 我有同样的问题,在我的情况下问题是我无法判断电影是文件还是流(URL没有告诉),所以我将它设置为MPMovieSourceTypeUnknown ,这也解决了问题。 It has that value by default but if you start playing a movie of either type, it internally changes the type to either stream or file and if you now change the URL without setting the correct type or manually setting type back to MPMovieSourceTypeUnknown , you'll get an exception. 它默认具有该值,但如果您开始播放任一类型的电影,它会在内部将类型更改为流或文件,如果您现在更改URL而不设置正确的类型或手动将类型设置回MPMovieSourceTypeUnknown ,您将会得到一个例外。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AVPlayerItem不能与多个AVPlayer实例相关联 - An AVPlayerItem cannot be associated with more than one instance of AVPlayer' 应用此错误消息检查网络后,应用程序崩溃:AVPlayerItem无法与多个AVPlayer实例关联 - App crashes after checking network with this error message : An AVPlayerItem cannot be associated with more than one instance of AVPlayer NSInvalidArgumentException',原因:'无法使用nil模型创建NSPersistentStoreCoordinator' - NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model' 异常'NSInvalidArgumentException',原因:'-[AnnotationView setCoordinate:]:无法识别的选择器已发送到实例 - exception 'NSInvalidArgumentException', reason: '-[AnnotationView setCoordinate:]: unrecognized selector sent to instance 多个委托监听uisearchbar的实例 - more than one delegate listen to an instance of uisearchbar 无法将多个UIBarButtonItem添加到RightBarButtonItems - Cannot add more than one UIBarButtonItem to RightBarButtonItems NSInvalidArgumentException原因: - [CLLocation distanceFromLocation:] - NSInvalidArgumentException reason:-[CLLocation distanceFromLocation:] 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[__ NSCFType next]:无法识别的选择器已发送至实例' - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType next]: unrecognized selector sent to instance ' iOS:“ NSInvalidArgumentException”,原因:“-[__ NSCFString sortedArrayUsingFunction:context:]:无法识别的选择器已发送到实例。 - iOS: 'NSInvalidArgumentException', reason: '-[__NSCFString sortedArrayUsingFunction:context:]: unrecognized selector sent to instance. 疯狂的MAPKit错误“ NSInvalidArgumentException”,原因:“ ***-[UISwipeGestureRecognizer removeFromSuperview]:无法识别的选择器已发送到实例 - Crazy MAPKit bug 'NSInvalidArgumentException', reason: '*** -[UISwipeGestureRecognizer removeFromSuperview]: unrecognized selector sent to instance
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM