- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
得到这个代码:
videoSize = [[AVPlayerItem playerItemWithAsset:asset] presentationSize];
//nslogs -> 高度:000 宽度 000
这个被弃用了:
videoSize = [asset naturalSize];
//nslogs -> 高度:360 宽度 480
为什么会这样?我不明白。
最佳答案
已解决:
NSArray* allVideoTracks = [movieAsset tracksWithMediaType:AVMediaTypeVideo];
if ([allVideoTracks count] > 0) {
AVAssetTrack* track = [[movieAsset tracksWithMediaType:AVMediaTypeVideo]objectAtIndex:0];
CGSize size = [track naturalSize];
}
这让我很开心,希望它对其他人有用...
关于iphone - iOS 6 : AVPlayerItem PresentationSize returning zero - (naturalSize method Deprecated on iOS 5),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14466842/
我试图在不加载图像的情况下获取图像的 NaturalWidth 和 NaturalHeight,以加快处理速度。有没有办法做到这一点?谢谢! 编辑:我被告知要分享一些代码,但我真的不知道要分享什么。
我需要有关视频的 naturalSize 的信息,而无需在我的 ViewController 加载时在 moviePlayer 中播放它。我在设备中有该文件,我知道它的路径我只需要知道它的 natur
我使用 [此处][1] 中的代码在使用 UIImagePickerController 拍摄的视频上附加图像。 视频是纵向的,播放正常,但是一旦我使用 AVURLASSet,它就会变成横向而不是纵向,
我播放视频 m3u8。 我尝试使用let videoAssetSource = AVAsset(url: videoURL) 但 videoAssetSource.tracks(withMediaTy
我在检查视频方向时遇到了很大的问题。有一个代码可以检查视频文件是否处于纵向模式: private func checkIfVideoIsPortrait(videoURL: NSURL) -> Boo
所以我需要使用 Vuetify v-img 获取页面中显示的图像的大小。我试图通过这样做来获得 naturalHeight 和 naturalWidth 的大小: //markup //method
'naturalSize' 不可用:从 iOS 7 及更早版本开始弃用的 API 在 Swift 中不可用 let videoAsst = AVAsset() videoAsst.as
我正在使用 AVFoundation,从用户的库中导入视频。 我需要真实视频的尺寸。在我的 iPhone 7 上进行屏幕录制后,视频大小应该是 (750.0, 1334.0)。使用 AVAsset t
得到这个代码: videoSize = [[AVPlayerItem playerItemWithAsset:asset] presentationSize]; //nslogs -> 高度:000
我是一名优秀的程序员,十分优秀!