|  | @@ -1122,7 +1122,7 @@ class PQStuckPointEditerController: PQBaseViewController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          let beginTime = Date()
 | 
	
		
			
				|  |  |          dealParameter(model: currentCreateStickersModel)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  |          // 更新裁剪时间条的的ui数据
 | 
	
		
			
				|  |  |          stuckPointCuttingView.videoDuration = max(CGFloat(finallyUserAudioTime), CGFloat(finallyStuckPoints.last!))
 | 
	
		
			
				|  |  |          let counn = (stuckPointMusicData?.rhythmSdata[0].pointTimes.count)! - 2
 | 
	
	
		
			
				|  | @@ -1544,9 +1544,9 @@ extension PQStuckPointEditerController {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          stuckPoints.insert(Float(stuckPointMusicData?.startTime ?? 0), at: 0)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        for point in stuckPoints {
 | 
	
		
			
				|  |  | -            BFLog(message: "有 start end 计算后的卡点数\(point)")
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +//        for point in stuckPoints {
 | 
	
		
			
				|  |  | +//            BFLog(message: "有 start end 计算后的卡点数\(point)")
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          BFLog(message: "处理节奏后 stuckPoints count is \(stuckPoints.count) seed \(seed), start time:\(stuckPoints.first ?? 0.0),end time:\(stuckPoints.last ?? 0.0) 总时长为:\((stuckPoints.last ?? 0.0) - (stuckPoints.first ?? 0.0))")
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1743,6 +1743,12 @@ extension PQStuckPointEditerController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              break
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        if finallyStuckPoints.count < 2 {
 | 
	
		
			
				|  |  | +            cShowHUB(superView: nil, msg: "视频资源导入失败,请重新选择!!")
 | 
	
		
			
				|  |  | +            exportResourceFailed()
 | 
	
		
			
				|  |  | +            return
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          // 拼接图片所使用的时长.选择一组图片 按图片数量计算卡点的总时长
 | 
	
		
			
				|  |  |          if selectedImageDataCount > 0 {
 | 
	
		
			
				|  |  |              clipPoint(clipNum: selectedImageDataCount - 1, oldPoints: stuckPointsTemp)
 | 
	
	
		
			
				|  | @@ -1856,7 +1862,7 @@ extension PQStuckPointEditerController {
 | 
	
		
			
				|  |  |                      self?.synchroMarskView.removeMarskView()
 | 
	
		
			
				|  |  |                      cShowHUB(superView: nil, msg: "音乐信息加载失败,请重新选择音乐")
 | 
	
		
			
				|  |  |  //                    PQUploadRemindView.showUploadRemindView(title: nil, attributedTitle: NSAttributedString(string: "加载音乐失败,请重新选择音乐"), summary: "", confirmTitle: nil) { [weak self] _, _ in
 | 
	
		
			
				|  |  | -//                        self?.navigationController?.popViewController(animated: true)
 | 
	
		
			
				|  |  | +                        self?.navigationController?.popViewController(animated: true)
 | 
	
		
			
				|  |  |  //                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -1875,6 +1881,7 @@ extension PQStuckPointEditerController {
 | 
	
		
			
				|  |  |              exportSession.cancelExport()
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          var isHaveVideo: Bool = false
 | 
	
		
			
				|  |  | +        var failedExprot: Bool = false
 | 
	
		
			
				|  |  |          if selectedMetarialData != nil, (selectedMetarialData?.count ?? 0) > 0 {
 | 
	
		
			
				|  |  |              if synchroMarskView.superview == nil {
 | 
	
		
			
				|  |  |                  UIApplication.shared.keyWindow?.addSubview(synchroMarskView)
 | 
	
	
		
			
				|  | @@ -1910,23 +1917,26 @@ extension PQStuckPointEditerController {
 | 
	
		
			
				|  |  |                                          BFLog(message: "导出相册视频-error == \(error)")
 | 
	
		
			
				|  |  |                                      }
 | 
	
		
			
				|  |  |                                  }
 | 
	
		
			
				|  |  | +                                let curr = Date()
 | 
	
		
			
				|  |  | +                                let assetResources = PHAssetResource.assetResources(for: photo.asset!)
 | 
	
		
			
				|  |  | +                                if let rsc = assetResources.first(where: { res in
 | 
	
		
			
				|  |  | +                                    res.type == .video  || res.type == .pairedVideo
 | 
	
		
			
				|  |  | +                                }) {
 | 
	
		
			
				|  |  | +                                    PHAssetResourceManager.default().writeData(for: rsc, toFile: URL(fileURLWithPath: outFilePath), options: nil) { error in
 | 
	
		
			
				|  |  | +                                        if error == nil {
 | 
	
		
			
				|  |  | +                                            BFLog(message: "导出视频相exportAsynchronously \(String(describing: outFilePath)) \(Date().timeIntervalSince(curr))")
 | 
	
		
			
				|  |  | +                                            tempPhoto?.locationPath = outFilePath.replacingOccurrences(of: documensDirectory, with: "")
 | 
	
		
			
				|  |  | +                                        }else{
 | 
	
		
			
				|  |  | +                                            failedExprot = true
 | 
	
		
			
				|  |  | +                                            BFLog(message: "导出视频相exportAsynchro faile")
 | 
	
		
			
				|  |  | +                                        }
 | 
	
		
			
				|  |  | +                                        dispatchGroup.leave()
 | 
	
		
			
				|  |  | +                                    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                                do {
 | 
	
		
			
				|  |  | -                                    try FileManager.default.copyItem(atPath: fileName.replacingOccurrences(of: "file:///", with: ""), toPath: outFilePath)
 | 
	
		
			
				|  |  | -                                    print("Success to copy file.")
 | 
	
		
			
				|  |  | -                                } catch {
 | 
	
		
			
				|  |  | -                                    print("Failed to copy file.")
 | 
	
		
			
				|  |  | +                                }else {
 | 
	
		
			
				|  |  | +                                    BFLog(message: "导出视频相exportAsynchro faile")
 | 
	
		
			
				|  |  | +                                    dispatchGroup.leave()
 | 
	
		
			
				|  |  |                                  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                                tempPhoto?.locationPath = outFilePath.replacingOccurrences(of: documensDirectory, with: "")
 | 
	
		
			
				|  |  | -                                BFLog(message: "导出视频相册地址为 \(String(describing: tempPhoto?.locationPath))")
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                                dispatchGroup.leave()
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                        }else {
 | 
	
		
			
				|  |  | -                            // 结束loading动画
 | 
	
		
			
				|  |  | -                            DispatchQueue.main.async {
 | 
	
		
			
				|  |  | -                                self.synchroMarskView.removeMarskView()
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      }
 | 
	
	
		
			
				|  | @@ -1934,6 +1944,11 @@ extension PQStuckPointEditerController {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              dispatchGroup.notify(queue: DispatchQueue.main) { [weak self] in
 | 
	
		
			
				|  |  | +                if failedExprot {
 | 
	
		
			
				|  |  | +                    cShowHUB(superView: nil, msg: "视频导入失败,请返回重试")
 | 
	
		
			
				|  |  | +                    self?.exportResourceFailed()
 | 
	
		
			
				|  |  | +                    return
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  self?.isExportVideosSuccess = true
 | 
	
		
			
				|  |  |                  BFLog(message: "所有相册视频导出成功")
 | 
	
		
			
				|  |  |                  // 处理所有数据完成
 | 
	
	
		
			
				|  | @@ -1951,6 +1966,13 @@ extension PQStuckPointEditerController {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    func exportResourceFailed(){
 | 
	
		
			
				|  |  | +        DispatchQueue.main.async {
 | 
	
		
			
				|  |  | +            self.synchroMarskView.removeMarskView()
 | 
	
		
			
				|  |  | +            self.navigationController?.popViewController(animated: true)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// 处理所有数据完成
 | 
	
		
			
				|  |  |      /// - Returns: <#description#>
 |