获取视频的尺寸
2018-08-29 本文已影响0人
CYC666
层级关系
AVPlayerLayer - AVPlayer - AVPlayerItem - presentationSize
直接取AVPlayerItem对象的presentationSize是不行的,返回的都是0 0
正解:通过监听presentationSize的变化,获取正确的尺寸
1、添加观察者

2、在观察者响应方法里获取尺寸

层级关系
AVPlayerLayer - AVPlayer - AVPlayerItem - presentationSize
直接取AVPlayerItem对象的presentationSize是不行的,返回的都是0 0
正解:通过监听presentationSize的变化,获取正确的尺寸
1、添加观察者
2、在观察者响应方法里获取尺寸