[英]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.