开发者

AVPlayerItem 'asset' property always nil in iOS 4.2

According to the Apple documentation, the 'asset' property of an AVPlayerItem should be available and return a valid object in iOS 4.0 onward. I have found that in iOS 4.2 that the 'asset' property of an AVPlayerItem object is always nil. Example code:

CMTime t开发者_JS百科heDuration = kCMTimeInvalid;
AVPlayerItem* theItem = anAVPlayer.currentItem;
AVAsset* theAsset = nil;

if ([AVPlayerItem instancesRespondToSelector:@selector(duration)]) {
    // On iOS 4.3 we get here...
    theDuration = [theItem duration];
} else if ([AVPlayerItem instancesRespondToSelector:@selector(asset)]) {
    // On iOS 4.2 we get here...
    theAsset = [theItem asset];

    if (theAsset) {
        // Unfortunately, we do not get here as theAsset is nil...
        theDuration = [theAsset duration];
    }
}

Has anyone else seen this?


I can confirm that in my case, on a 4.2.1 iPad, that this property does in fact hold a value. In this screenshot my debugger is sitting on the line in question.

AVPlayerItem 'asset' property always nil in iOS 4.2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜