3
私はカスタム画像ピッカーを統合しているので、カメラのロールから10秒未満のビデオを表示する必要があります。以下のコードはギャラリーからすべての動画を取得しますが、期間に基づいてフィルタに述語を適用したいと考えています。継続時間が10秒未満のビデオを取得する
let options = PHFetchOptions()
options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: true) ]
options.predicate = NSPredicate(format: "mediaType = %d", PHAssetMediaType.video.rawValue)
assets = PHAsset.fetchAssets(with: options)
print(assets ?? "no video found")
collectionView.reloadData()
誰かが同じことを考えている場合は教えてください。おかげさまで