| 
					
				 | 
			
			
				@@ -319,7 +319,7 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let speedSettingView = PQSpeedSettingView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         speedSettingView.backgroundColor = .clear 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         speedSettingView.viewType = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        speedSettingView.selectSpeedCallBack = { [weak self] maxSpeed, minSpeed,selectIndex in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        speedSettingView.selectSpeedCallBack = { [weak self] maxSpeed, minSpeed,selectIndex ,isSettingPlayer in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BFLog(message: "固定maxSpeed is\(maxSpeed) minSpeed \(minSpeed)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //更新最后一次选择的位置恢复时使用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(speedSettingView.viewType == 1){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -335,7 +335,10 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 self?.customSpeedSettingView.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 self?.customSpeedSettingView.isJumpSpeedModel = speedSettingView.viewType == 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            self?.settingPlayerView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(isSettingPlayer){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                self?.settingPlayerView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return speedSettingView 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -513,7 +516,7 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               sustomSwitchView.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //素材全是图片的时候三个模式都显示循环设置 UI 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //2素材全是图片的时候三个模式都显示循环设置 UI 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(selectedDataCount == selectedImageDataCount){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             speedSettingView.viewType = 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             customSpeedSettingView.isJumpSpeedModel = false 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -527,15 +530,15 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             speedSettingView.isHidden = !(selectedDataCount == selectedImageDataCount) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             editModelLineView.isHidden = !(selectedDataCount == selectedImageDataCount) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            speedSettingView.setSelectItem(index: lastCyclesSelectIndex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            speedSettingView.setSelectItem(index: lastCyclesSelectIndex,isSettingPlayer:false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if sender.tag == 1 { // 快慢速 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                speedSettingView.setSelectItem(index: lastSpeedSelectIndex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                speedSettingView.setSelectItem(index: lastSpeedSelectIndex,isSettingPlayer:false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else if sender.tag == 2 { // 跳跃卡点 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                speedSettingView.setSelectItem(index: lastJumpSpeedSelectIndex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                speedSettingView.setSelectItem(index: lastJumpSpeedSelectIndex,isSettingPlayer:false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else if sender.tag == 3 { // 仅音乐 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 customSpeedSettingView.isJumpSpeedModel = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 speedSettingView.viewType = 2 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -544,7 +547,7 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 2 设置 btn 不同显示状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 3 设置 btn 不同显示状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         var speedStuckBtnGifName = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         var jumpPointBtnGifName = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if sender.tag == 1 { // 快慢速 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1074,30 +1077,12 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       for sticker in section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                           if sticker.type == StickerType.VIDEO.rawValue { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + sticker.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              var i:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              //一个视频切的的段落 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              var oneVideoClipNum:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               var realUsedMusicDuration = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              while realUsedMusicDuration <= CMTimeGetSeconds(asset.duration) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  //快速段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  let LA = maxSpeed * (finallyStuckPoints[i+1] - finallyStuckPoints[i]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  realUsedMusicDuration = realUsedMusicDuration + Float64(LA) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  if(realUsedMusicDuration > CMTimeGetSeconds(asset.duration)){ break} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  oneVideoClipNum = oneVideoClipNum + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  //慢速段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  if(i + 2 >= finallyStuckPoints.count){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  let LB = minSpeed * (finallyStuckPoints[i+2] - finallyStuckPoints[i+1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  realUsedMusicDuration = realUsedMusicDuration + Float64(LB) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  oneVideoClipNum = oneVideoClipNum + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  i = i + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              BFLog(message: "单个视频\(sticker.locationPath)时长::\(CMTimeGetSeconds(asset.duration)) ,clipNum is:\(oneVideoClipNum)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BFLog(message: "单个视频\(sticker.locationPath)时长::\(CMTimeGetSeconds(asset.duration)) ,clipNum is:\(sticker.clipCount)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               var lastOutTime:Float64 = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              for clipindex in 0 ... oneVideoClipNum - 1 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                              for clipindex in 0 ... sticker.clipCount - 1 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                   // deep copy sticker model 防止只有一个对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                   let stickerjson = sticker.toJSONString(prettyPrint: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                   let deepCopySticker = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: stickerjson!) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1121,8 +1106,8 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       let timelineOut = Float64(finallyStuckPoints[totalClipNum + 1 + clipindex]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       //处理最后一点视频素材不够卡点时长 e.g. 0.3 卡点时长0.5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      if(tempOut > realUsedMusicDuration){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                          BFLog(message: "最后一点视频素材不够卡点时长 ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      if(tempOut > CMTimeGetSeconds(asset.duration)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          BFLog(message: "最后一点视频素材不够卡点时长要做变速C处理 差\(tempOut - CMTimeGetSeconds(asset.duration))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           //最后一点素材时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           let lastAssetDuration = realUsedMusicDuration - tempOut 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           let pointDuration = timelineOut -  tempTimelineIn 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1153,25 +1138,28 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       lastOutTime =  deepCopySticker?.out ?? 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                  BFLog(message: " 创建 sticker crilp is in \(String(format: "%.6f", deepCopySticker?.model_in ?? 0)) out  \(String(format: "%.6f", deepCopySticker?.out ?? 0)) ,分段素材时长:\(String(format: "%.6f", (deepCopySticker?.out ?? 0) - (deepCopySticker?.model_in ?? 0))) ,分段显示时长:\(String(format: "%.6f", (deepCopySticker?.timelineOut ?? 0) - (deepCopySticker?.timelineIn ?? 0))), 总时长\(CMTimeGetSeconds(asset.duration)) timelineIN: \(String(format: "%.6f", deepCopySticker?.timelineIn ?? 0)) timelineOUT:\(String(format: "%.6f", deepCopySticker?.timelineOut ?? 0)) speedRate:\(deepCopySticker?.speedRate ?? 0.0)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                BFLog(message: " 创建 sticker  crilp is in 视频 \(String(format: "%.6f", deepCopySticker?.model_in ?? 0))  out  \(String(format: "%.6f", deepCopySticker?.out ?? 0)) ,分段素材时长:\(String(format: "%.6f", (deepCopySticker?.out ?? 0) - (deepCopySticker?.model_in ?? 0))) ,分段显示时长:\(String(format: "%.6f", (deepCopySticker?.timelineOut ?? 0) - (deepCopySticker?.timelineIn ?? 0))), 总时长\(CMTimeGetSeconds(asset.duration)) timelineIN: \(String(format: "%.6f", deepCopySticker?.timelineIn ?? 0)) timelineOUT:\(String(format: "%.6f", deepCopySticker?.timelineOut ?? 0)) speedRate:\(deepCopySticker?.speedRate ?? 0.0)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                   if deepCopySticker != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       stickers.append(deepCopySticker!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                              totalClipNum = totalClipNum + oneVideoClipNum - 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            totalClipNum = totalClipNum + sticker.clipCount - 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                           } else if sticker.type == StickerType.IMAGE.rawValue { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      if(totalClipNum + 1 >= finallyStuckPoints.count){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                          BFLog(message: "数据出现错误!!!查正") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                          break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      sticker.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      sticker.timelineIn = Float64(finallyStuckPoints[totalClipNum]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      sticker.timelineOut = Float64(finallyStuckPoints[totalClipNum + 1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      totalClipNum = totalClipNum + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      stickers.append(sticker) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  if(totalClipNum + 1 >= finallyStuckPoints.count){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      BFLog(message: "数据出现错误!!!查正") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  sticker.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  sticker.timelineIn = Float64(finallyStuckPoints[totalClipNum]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  sticker.timelineOut = Float64(finallyStuckPoints[totalClipNum + 1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  totalClipNum = totalClipNum + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  stickers.append(sticker) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    BFLog(message: " 创建 sticker  crilp is in 图片 \(String(format: "%.6f", sticker.model_in))  out  \(String(format: "%.6f", sticker.out)) ,分段素材时长:\(String(format: "%.6f", (sticker.out) - (sticker.model_in))) ,分段显示时长:\(String(format: "%.6f", (sticker.timelineOut) - (sticker.timelineIn))),   timelineIN: \(String(format: "%.6f", sticker.timelineIn)) timelineOUT:\(String(format: "%.6f", sticker.timelineOut)) speedRate:\(sticker.speedRate)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1287,8 +1275,8 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        case .createStickersModelSpeed://快慢速 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//          快慢速  (2:快节奏,3:适中,4:慢节奏) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        case .createStickersModelSpeed,.createStickersModelOnlyMusic://快慢速 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //快慢速  (2:快节奏,3:适中,4:慢节奏) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             stuckPointsTemp  = getUsedStuckPoint(seed: (stuckPointMusicData?.speed ?? 0) + 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             /* 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1302,73 +1290,85 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //LA=x*n*d,LB=y*n*d (n=1/3/5) 注:视频经过快慢速处理后的总时长约=L*2/(x+y) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BFLog(message: "Ax快速为:\(maxSpeed) By慢速为:\(minSpeed) 档位 N为:\(stuckPointMusicData?.speed ?? 0)  使用的卡点总数:\(stuckPointsTemp.count)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //使用新方法取使用的卡点数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for section in projectModel.sData?.sections ?? List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if section.sectionType == "normal" { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for sticker in section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if sticker.type == StickerType.VIDEO.rawValue { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + sticker.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            let assetDuration = Float(CMTimeGetSeconds(asset.duration)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BFLog(message: "输入素材时长 \(assetDuration)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            //查找使用的最后一个卡点在原数组中的位置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var lastPointIndex = stuckPointsTemp.firstIndex(where: { (point) -> Bool in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                (point == (finallyStuckPoints.last ?? 0).truncatingRemainder(dividingBy: (stuckPointsTemp.last ?? 0))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var i = lastPointIndex ?? 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            //1,计算 AB 段的个数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var LACount:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var LBCount:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                           //已经取到的视频素材总长度,用于和原视频素材时长做对比,不够多加一个卡点 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var useAssestDurationTemp:Float = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            while useAssestDurationTemp < assetDuration { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                //回环从头取 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if(i+2 > stuckPointsTemp.count){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    i = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                //快速段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let LA = maxSpeed * (stuckPointsTemp[i+1] - stuckPointsTemp[i]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                useAssestDurationTemp = useAssestDurationTemp + Float(LA) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if(useAssestDurationTemp > Float(assetDuration)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    useAssestDurationTemp = useAssestDurationTemp - Float(LA) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                LACount = LACount + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                BFLog(message: "快速段段段段段段后LACount:\(LACount) realUsedMusicDuration:\(useAssestDurationTemp)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                //慢速段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let LB = minSpeed * (stuckPointsTemp[i+2] - stuckPointsTemp[i+1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                useAssestDurationTemp = useAssestDurationTemp + Float(LB) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if(useAssestDurationTemp > Float(assetDuration)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    useAssestDurationTemp = useAssestDurationTemp - Float(LB) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                LBCount = LBCount + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                BFLog(message: "慢速段段段段段段后LACount:\(LACount) realUsedMusicDuration:\(useAssestDurationTemp)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                i = i + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            //2拼接要使用的卡点信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            for i in 0...(LACount + LBCount) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let a = stuckPointsTemp[(i + Int(lastPointIndex ?? 0)) % stuckPointsTemp.count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let b = Float((i + Int(lastPointIndex ?? 0)) / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                finallyStuckPoints.append(a + b) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            sticker.clipCount = LACount + LBCount 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            //3,多补一个卡点 做 C级 速处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if(useAssestDurationTemp < assetDuration){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                lastPointIndex = stuckPointsTemp.firstIndex(where: { (point) -> Bool in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    (point == (finallyStuckPoints.last ?? 0).truncatingRemainder(dividingBy: (stuckPointsTemp.last ?? 0))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let a = stuckPointsTemp[(1 + Int(lastPointIndex ?? 0))  % stuckPointsTemp.count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let b = Float((1 + Int(lastPointIndex ?? 0)) / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                finallyStuckPoints.append(a + b) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                sticker.clipCount =  sticker.clipCount + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //1,计算 AB 段的个数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var i:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var LACount:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var LBCount:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            while useAssestDuration < Float(selectedTotalDuration) && selectedTotalDuration != 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //回环从头取 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(i+2 > stuckPointsTemp.count){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    i = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //快速段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let LA = maxSpeed * (stuckPointsTemp[i+1] - stuckPointsTemp[i]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                useAssestDuration = useAssestDuration + Float(LA) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(useAssestDuration > Float(selectedTotalDuration)){ break} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                LACount = LACount + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BFLog(message: "快速段段段段段段后LACount:\(LACount) realUsedMusicDuration:\(useAssestDuration)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //慢速段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let LB = minSpeed * (stuckPointsTemp[i+2] - stuckPointsTemp[i+1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                useAssestDuration = useAssestDuration + Float(LB) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                LBCount = LBCount + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BFLog(message: "慢速段段段段段段后LACount:\(LACount) realUsedMusicDuration:\(useAssestDuration)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                i = i + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //2拼接要使用的卡点信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for i in 0...(LACount + LBCount) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let a = stuckPointsTemp[i % stuckPointsTemp.count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let b = Float(i / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                finallyStuckPoints.append(a + b) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BFLog(message: "计算后的\(useAssestDuration) LACount:\(LACount) LBCount \(LBCount) 估算时长为:\(selectedTotalDuration * 2 / Float64(maxSpeed + minSpeed))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        case .createStickersModelOnlyMusic://仅音乐 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            stuckPointsTemp = getUsedStuckPoint(seed: 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //要拼接的段数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var clipNum:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var i:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            while useAssestDuration < Float(selectedTotalDuration) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //回环从头取 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(i+2 >= stuckPointsTemp.count){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    i = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //快速段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let LA =  (stuckPointsTemp[i+1] - stuckPointsTemp[i]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                useAssestDuration = useAssestDuration + Float(LA) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                clipNum = clipNum + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(useAssestDuration > Float(selectedTotalDuration)){ break} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //慢速段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let LB = (stuckPointsTemp[i+2] - stuckPointsTemp[i+1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                useAssestDuration = useAssestDuration + Float(LB) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                i = i + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                clipNum = clipNum + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //拼接要使用的卡点信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for i in 0...clipNum { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let a = stuckPointsTemp[i % stuckPointsTemp.count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let b = Float(i / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                finallyStuckPoints.append(a + b) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1382,8 +1382,8 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for i in 0...selectedImageDataCount { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let a = stuckPointsTemp[i % stuckPointsTemp.count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let b = Float(i / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let a = stuckPointsTemp[(i + Int(pointIndex ?? 0))  % stuckPointsTemp.count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let b = Float((i + Int(pointIndex ?? 0))  / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 finallyStuckPoints.append(a + b) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             selectedTotalDuration = Float64(((finallyStuckPoints.last ?? 0) - (finallyStuckPoints.first ?? 0))) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1402,8 +1402,8 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     pointIndex = (pointIndex ?? 0) + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     for i in 0...selectedImageDataCount { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        let a = stuckPointsTemp[i % stuckPointsTemp.count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        let b = Float(i / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        let a = stuckPointsTemp[(i + Int(pointIndex ?? 0))  % stuckPointsTemp.count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        let b = Float((i + Int(pointIndex ?? 0))  / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         finallyStuckPoints.append(a + b) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1426,18 +1426,13 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     selectedTotalDuration = Float64((finallyStuckPoints.last ?? 0) - (finallyStuckPoints.first ?? 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     lastCyclesSelectIndex = lastCyclesSelectIndex + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                speedSettingView.setSelectItem(index: lastCyclesSelectIndex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                speedSettingView.setSelectItem(index: lastCyclesSelectIndex,isSettingPlayer: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //三,按原倍速取视频素材长度超过原素材长度处理,要多添加一位卡点做 A B C 处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if(useAssestDuration < selectedTotalDuration){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //四,背景音乐时长处理)计算最后使用的音频时长, 如果不用拼接音频时长度是卡点的倒数第二位时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let asset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + (stuckPointMusicData?.localPath ?? "")), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1453,6 +1448,10 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         playeTimeRange = CMTimeRange(start: CMTime(value: CMTimeValue( Float(stuckPointMusicData?.startTime ?? 0) * Float(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE), end: CMTime(value: CMTimeValue((Float(finallyStuckPoints.last ?? 0)) * Float(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (index,usePoint) in finallyStuckPoints.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BFLog(message: "最后使用的卡点信息 \(index) : \(usePoint)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 更新裁剪时间条的的ui数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         stuckPointCuttingView.videoDuration = CGFloat(finallyUserAudioTime) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1628,7 +1627,6 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         createPorjectData() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BFLog(message: "界面编辑界面时参数 选择素材时长:\(selectedTotalDuration) 选择素材总数:\(selectedDataCount) 选择图片总数\(selectedImageDataCount) 再创建类型:\(String(describing: reCreateVideoData?.rhythmMode))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1716,7 +1714,6 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //默认进入跳跃卡点模式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             editModelClick(sender: jumpPointBtn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            speedSettingView.setSelectItem(index: lastJumpSpeedSelectIndex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1724,13 +1721,11 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(selectedTotalDuration > 0 && selectedTotalDuration <= 144){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 editModelClick(sender: speedStuckBtn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                speedSettingView.setSelectItem(index: lastSpeedSelectIndex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //默认进入卡点模式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 editModelClick(sender: jumpPointBtn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                speedSettingView.setSelectItem(index: lastJumpSpeedSelectIndex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   
			 |