|
@@ -256,27 +256,27 @@ public class PQEditVisionTrackMaterialsModel: PQEditBaseModel {
|
|
|
}
|
|
|
BFLog(message: " locationPath is\(documensDirectory + locationPath)")
|
|
|
if type != StickerType.VIDEO.rawValue {
|
|
|
- var coverImage = UIImage(contentsOfFile: documensDirectory + locationPath)
|
|
|
+ let tempPath = (locationPath.contains("var/mobile/Media") ? locationPath: documensDirectory + locationPath)
|
|
|
+ var coverImage = UIImage(contentsOfFile: tempPath)
|
|
|
|
|
|
if coverImage == nil {
|
|
|
// 有可能是 WEBP
|
|
|
var fileData: Data?
|
|
|
- if fileIsExists(filePath: documensDirectory + locationPath) {
|
|
|
- fileData = try! Data(contentsOf: URL(fileURLWithPath: documensDirectory + locationPath))
|
|
|
+ if fileIsExists(filePath: tempPath) {
|
|
|
+ fileData = try! Data(contentsOf: URL(fileURLWithPath: tempPath))
|
|
|
}
|
|
|
if fileData != nil && (fileData?.count ?? 0) > 0 && fileData?.isWebPFormat ?? false {
|
|
|
BFLog(message: "这个资源为web!")
|
|
|
coverImage = WebPProcessor.default.process(item: ImageProcessItem.data(fileData!), options: KingfisherParsedOptionsInfo([.onlyLoadFirstFrame, .scaleFactor(1)]))
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return coverImage
|
|
|
} else {
|
|
|
if coverImageUI != nil {
|
|
|
BFLog(message: "已经有封面了")
|
|
|
return coverImageUI
|
|
|
} else {
|
|
|
- return PQVideoSnapshotUtil.videoSnapshot(videoURL: URL(fileURLWithPath: documensDirectory + locationPath), time: 0)
|
|
|
+ return PQVideoSnapshotUtil.videoSnapshot(videoURL: URL(fileURLWithPath: (locationPath.contains("var/mobile/Media") ? locationPath: documensDirectory + locationPath)), time: 0)
|
|
|
}
|
|
|
}
|
|
|
}
|