nsinvalidargumentexception' reason 'an avp

2019-07-12 00:49发布

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

3条回答
成全新的幸福
2楼-- · 2019-07-12 01:24

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.

查看更多
不美不萌又怎样
3楼-- · 2019-07-12 01:26

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.

查看更多
乱世女痞
4楼-- · 2019-07-12 01:32

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

查看更多
登录 后发表回答