【问题标题】:How to fetch screen recordings video如何获取屏幕录像视频
【发布时间】:2020-08-07 02:24:29
【问题描述】:

据我们所知,我们可以像这样使用PhotoKit 框架来获取截图照片,

 let collection = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumScreenshots, options: fetchOption)

但是如何获取录屏视频呢?

【问题讨论】:

    标签: ios swift iphone photokit


    【解决方案1】:
    if let res = PHAssetResource.assetResources(for: asset).first {
           if res.originalFilename.hasPrefix("RPReplay") {              
              screenRecordings.append(asset.localIdentifier)
           } 
    }
    

    【讨论】:

      【解决方案2】:

      试试这个⬇️

      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)
      }
      

      现在实现委托方法来检索选定的视频。

      【讨论】:

        猜你喜欢
        • 2012-10-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-09-28
        • 1970-01-01
        • 2011-07-19
        相关资源
        最近更新 更多