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

≡放荡痞女 提交于 2019-12-24 04:10:43

问题


I am using

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'

So please suggest.

Thanks


回答1:


Had same issue, try setting ContentURL after Setting the SourceType like below,

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

Source: devforums.apple.com/message/467199




回答2:


Had same experience. realized movieSourceType was set incorrectly. For example, movieSourceType was set to MPMovieSourceTypeStreaming when it should have been MPMovieSourceTypeFile for a movie embedded in the bundle.




回答3:


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. 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.



来源:https://stackoverflow.com/questions/12071138/nsinvalidargumentexception-reason-an-avplayeritem-cannot-be-associated-with-mo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!