iOS PhotoKit框架如何獲取視頻文件大小


// 獲取相冊中的資源
[group enumerateAssetsWithOptions:NSEnumerationReverse usingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
    if (result) {
        NSLog(@"-資源是否可編輯: %d", result.editable);
        if ([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo]) {
            NSLog(@"- 文件日期: %@", [result valueForProperty:ALAssetPropertyDate]);
            NSLog(@"- 文件名稱: %@", [[result defaultRepresentation] filename]);
            NSLog(@"- 文件大小: %lld", [[result defaultRepresentation] size]);
            NSLog(@"- 文件URL: %@", [[result defaultRepresentation] url]);
            NSLog(@"- 文件縮略圖: %@", [UIImage imageWithCGImage:[result thumbnail]]);
        }
    } else {
        // result為nil, 即遍歷資源(相片或視頻)完畢, 可以展示資源列表
        NSLog(@"遍歷資源(相片或視頻)完畢, 可以展示資源列表");
    }
}];


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM