|
@@ -39,7 +39,6 @@ class WSSCreativeTemplateEditViewController: WSSMultiVideoEditViewController {
|
|
|
if let cropTool = self?.cropVideoTool {
|
|
|
cropTool.stopExport()
|
|
|
self?.cropVideoTool = nil
|
|
|
- self?.cropVideoTask.signal()
|
|
|
}
|
|
|
|
|
|
if let templateDecoder = self?.templateDecoder {
|
|
@@ -303,12 +302,13 @@ fileprivate extension WSSCreativeTemplateEditViewController {
|
|
|
DispatchQueue.main.async {
|
|
|
if let currentCount = self?.cropVideoSuccessCount,
|
|
|
let totalCount = self?.creativeVideoInfoArray.count {
|
|
|
- guard progress != 1 else { return }
|
|
|
+ guard let userCancel = self?.isUserCancel,
|
|
|
+ progress != 1,
|
|
|
+ !userCancel else { return }
|
|
|
let currentProgress = Float(currentCount) / Float(totalCount)
|
|
|
let singleProgress = 1.0 / Float(totalCount)
|
|
|
var vailProgress = 0.5 * (currentProgress + singleProgress * progress)
|
|
|
vailProgress = Float.minimum(0.5, vailProgress)
|
|
|
- print("====>progress \(vailProgress)")
|
|
|
showProgressCancelHub(progress: vailProgress, status: "正在合成...")
|
|
|
}
|
|
|
}
|
|
@@ -319,20 +319,20 @@ fileprivate extension WSSCreativeTemplateEditViewController {
|
|
|
outputFileType: AVFileType.mp4.rawValue,
|
|
|
clipRange: cropTimeRange,
|
|
|
completionBlock: { [weak self] success, _ in
|
|
|
- if success {
|
|
|
- WSSLog("🍿: 裁剪成功- \(exportURL)")
|
|
|
- model.cropVideoPath = cropVideoOutputPath
|
|
|
- model.mediaModel?.editVideoURL = exportURL // 合成视频的时候,从这个字段读取视频
|
|
|
- model.mediaModel?.sourceType = .video
|
|
|
-
|
|
|
- } else {
|
|
|
- showHud(withOnlyText: "截取视频失败")
|
|
|
- self?.isCropVideoFail = true
|
|
|
- }
|
|
|
DispatchQueue.main.async {
|
|
|
+ if success {
|
|
|
+ WSSLog("🍿: 裁剪成功- \(exportURL)")
|
|
|
+ model.cropVideoPath = cropVideoOutputPath
|
|
|
+ model.mediaModel?.editVideoURL = exportURL // 合成视频的时候,从这个字段读取视频
|
|
|
+ model.mediaModel?.sourceType = .video
|
|
|
+
|
|
|
+ } else {
|
|
|
+ showHud(withOnlyText: "截取视频失败")
|
|
|
+ self?.isCropVideoFail = true
|
|
|
+ }
|
|
|
self?.cropVideoSuccessCount += 1
|
|
|
+ self?.cropVideoTask.signal()
|
|
|
}
|
|
|
- self?.cropVideoTask.signal()
|
|
|
|
|
|
})
|
|
|
self.cropVideoTool = cropVideoTool
|