|
@@ -45,17 +45,18 @@ public class BFRecordItemModel: NSObject {
|
|
|
func initOriginData(phasset: PHAsset) {
|
|
|
width = phasset.pixelWidth
|
|
|
height = phasset.pixelHeight
|
|
|
+
|
|
|
+ fetchCoverImage(phasset)
|
|
|
+ fetchAVUrlAsset(phasset)
|
|
|
+
|
|
|
if phasset.mediaType == .image {
|
|
|
mediaType = .IMAGE
|
|
|
localPath = "image"
|
|
|
} else if phasset.mediaType == .video {
|
|
|
mediaType = .VIDEO
|
|
|
fetchPlayItem(phasset)
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- fetchCoverImage(phasset)
|
|
|
- fetchAVUrlAsset(phasset)
|
|
|
}
|
|
|
|
|
|
func fetchCoverImage(_ phasset: PHAsset) {
|
|
@@ -97,11 +98,14 @@ public class BFRecordItemModel: NSObject {
|
|
|
options.deliveryMode = .automatic
|
|
|
|
|
|
PHCachingImageManager().requestAVAsset(forVideo: phasset, options: options, resultHandler: { [weak self] (asset: AVAsset?, _: AVAudioMix?, _) in
|
|
|
+ guard let sself = self else {
|
|
|
+ return
|
|
|
+ }
|
|
|
if let videoAsset = asset as? AVURLAsset {
|
|
|
- self?.materialDuraion = videoAsset.duration.seconds
|
|
|
- self?.localPath = (videoAsset.url.absoluteString.removingPercentEncoding)?.replacingOccurrences(of: "file://", with: "")
|
|
|
- self?.videoAsset = videoAsset
|
|
|
- self?.fetchAVUrlAsset?(videoAsset)
|
|
|
+ sself.materialDuraion = videoAsset.duration.seconds
|
|
|
+ sself.localPath = (videoAsset.url.absoluteString.removingPercentEncoding)?.replacingOccurrences(of: "file://", with: "")
|
|
|
+ sself.videoAsset = videoAsset
|
|
|
+ sself.fetchAVUrlAsset?(videoAsset)
|
|
|
}
|
|
|
})
|
|
|
}
|