'NSInvalidArgumentException',原因:'-[AVPlayerItem持续时间]:无法识别的选择器已发送 [英] 'NSInvalidArgumentException', reason: '-[AVPlayerItem duration]: unrecognized selector sent

查看:105
本文介绍了'NSInvalidArgumentException',原因:'-[AVPlayerItem持续时间]:无法识别的选择器已发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用AVPlayer播放MediaItem,然后尝试获取当前项目的持续时间,如下所示(持续时间是CMTime类型的对象):

I am trying to play a MediaItem using AVPlayer and later trying to get the duration of the current item like this (duration is an object of type CMTime):

duration = [[player currentItem] duration];

我在iPad上没有任何问题,但在iPod Touch中,出现以下错误.我还没有在iPhone中尝试过.

I get no issues in iPad but in iPod Touch, I get the following error. I haven't tried this in iPhone yet.

由于未捕获的异常而终止应用程序 'NSInvalidArgumentException',原因:'-[AVPlayerItem持续时间]: 无法识别的选择器已发送到实例0x186100'

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AVPlayerItem duration]: unrecognized selector sent to instance 0x186100'

任何指向此修复程序的指针将不胜感激.

Any pointers to the fix will be greatly appreciated.

推荐答案

您最有可能在装有iOS< iOS的iPod上对其进行测试. 4.3.

You're most likely testing this on an iPod with iOS < 4.3.

根据AVPlayerItem文档,duration仅在iOS 4.3或更高版本中可用.

According to the AVPlayerItem documentation, duration is only available in iOS 4.3 or later.

这篇关于'NSInvalidArgumentException',原因:'-[AVPlayerItem持续时间]:无法识别的选择器已发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆