【发布时间】:2020-08-07 02:24:29
【问题描述】:
据我们所知,我们可以像这样使用PhotoKit 框架来获取截图照片,
let collection = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumScreenshots, options: fetchOption)
但是如何获取录屏视频呢?
【问题讨论】:
据我们所知,我们可以像这样使用PhotoKit 框架来获取截图照片,
let collection = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumScreenshots, options: fetchOption)
但是如何获取录屏视频呢?
【问题讨论】:
if let res = PHAssetResource.assetResources(for: asset).first {
if res.originalFilename.hasPrefix("RPReplay") {
screenRecordings.append(asset.localIdentifier)
}
}
【讨论】:
试试这个⬇️
func openVideoGallery() {
let picker = UIImagePickerController()
picker.delegate = self
picker.sourceType = .savedPhotosAlbum
picker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .savedPhotosAlbum)!
picker.mediaTypes = ["public.movie"]
picker.allowsEditing = false
present(picker, animated: true, completion: nil)
}
现在实现委托方法来检索选定的视频。
【讨论】: