Ios 有没有办法确定AVPlayer使用的编解码器?

Ios 有没有办法确定AVPlayer使用的编解码器?,ios,avfoundation,avplayer,Ios,Avfoundation,Avplayer,我已经浏览了AVPlayer、AVPlayerItem、AVAsset等的所有标题文档,没有找到任何可以用来收集AVPlayer当前使用的编解码器信息的内容。是否可以确定编解码器信息?您可以通过AVPlayerItem.tracks.assetTrack.formatDescriptions找到编解码器 差不多 func printFourCC(fcc:FourCharCode){ let字节:[CChar]=[ CChar((fcc>>24)和0xff), CChar((fcc>>16)和0x

我已经浏览了AVPlayer、AVPlayerItem、AVAsset等的所有标题文档,没有找到任何可以用来收集AVPlayer当前使用的编解码器信息的内容。是否可以确定编解码器信息?

您可以通过AVPlayerItem.tracks.assetTrack.formatDescriptions找到编解码器

差不多

func printFourCC(fcc:FourCharCode){
let字节:[CChar]=[
CChar((fcc>>24)和0xff),
CChar((fcc>>16)和0xff),
CChar((fcc>>8)和0xff),
CChar(fcc和0xff),
0]
let result=字符串(cString:字节)
让characterSet=characterSet.whitespaces
打印(结果。修剪字符(在:字符集中))
}
对于item.tracks中的轨迹{
如果let formats=track.assetTrack?.formatDescriptions为?[CMFormatDescription]{
格式中的格式{
printFourCC(CMFormatDescriptionGetMediaSubType(格式))
}
}
}

请记住,如果由于不支持编解码器,AVPlayer的currentItem无法添加任何资源曲目,则您将无法找到此内容。它只会默默地失败。