Przeglądaj źródła

fix: #trello(【创意模板】编辑页点击保定按钮后,会有一个合成的加载状态,点击取消时,需要多次点击才能真正取消(具体看录制的小视频))

Melody 5 lat temu
rodzic
commit
a320b645d0

+ 14 - 14
SuperShow/UI/Template/WSSCreativeTemplateEditViewController.swift

@@ -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