| 
														
															@@ -11,10 +11,11 @@ import UIKit 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 class PQStuckPointCuttingView: UIView { 
														 | 
														
														 | 
														
															 class PQStuckPointCuttingView: UIView { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     // 视频时长 
														 | 
														
														 | 
														
															     // 视频时长 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     var videoDuration: CGFloat = 0 
														 | 
														
														 | 
														
															     var videoDuration: CGFloat = 0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    var lastVideoDuration:CGFloat = 0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     // 卡点开始时间 默认 0 
														 | 
														
														 | 
														
															     // 卡点开始时间 默认 0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    private var stuckPointStartTime: CGFloat = 0 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    var stuckPointStartTime: CGFloat = 0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     // 卡点结束时间 
														 | 
														
														 | 
														
															     // 卡点结束时间 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    private var stuckPointEndTime: CGFloat = 0 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    var stuckPointEndTime: CGFloat = 0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     // 裁剪开始时间 默认 0 
														 | 
														
														 | 
														
															     // 裁剪开始时间 默认 0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private var cutStartTime: CGFloat = 0 
														 | 
														
														 | 
														
															     private var cutStartTime: CGFloat = 0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -162,6 +163,9 @@ class PQStuckPointCuttingView: UIView { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     func updateEndTime(startTime: CGFloat, endTime: CGFloat) { 
														 | 
														
														 | 
														
															     func updateEndTime(startTime: CGFloat, endTime: CGFloat) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         stuckPointStartTime = startTime 
														 | 
														
														 | 
														
															         stuckPointStartTime = startTime 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         stuckPointEndTime = endTime 
														 | 
														
														 | 
														
															         stuckPointEndTime = endTime 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+         
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        tatalTimeLabel.text = "\(Float64(stuckPointEndTime - stuckPointStartTime).formatDurationToHMS())" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+   
														 | 
													
												
											
												
													
														| 
														 | 
														
															         BFLog(message: "推荐开始\(stuckPointStartTime) 结束\(stuckPointEndTime) 时长为:\(stuckPointEndTime - stuckPointStartTime)  音乐总时长为:\(videoDuration)") 
														 | 
														
														 | 
														
															         BFLog(message: "推荐开始\(stuckPointStartTime) 结束\(stuckPointEndTime) 时长为:\(stuckPointEndTime - stuckPointStartTime)  音乐总时长为:\(videoDuration)") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         backgroundColor = PQBFConfig.shared.styleBackGroundColor 
														 | 
														
														 | 
														
															         backgroundColor = PQBFConfig.shared.styleBackGroundColor 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         addSubview(scrollView) 
														 | 
														
														 | 
														
															         addSubview(scrollView) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -180,7 +184,7 @@ class PQStuckPointCuttingView: UIView { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             make.right.equalTo(videoCropView.snp_right).offset(-6) 
														 | 
														
														 | 
														
															             make.right.equalTo(videoCropView.snp_right).offset(-6) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															          
														 | 
														
														 | 
														
															          
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        tatalTimeLabel.text = "\(Float64(stuckPointEndTime - stuckPointStartTime).formatDurationToHMS())" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+       
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     func addData() { 
														 | 
														
														 | 
														
															     func addData() { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -256,16 +260,20 @@ class PQStuckPointCuttingView: UIView { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /// progress <#progress description#> 
														 | 
														
														 | 
														
															     /// progress <#progress description#> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     func updateProgress(progress: CGFloat) { 
														 | 
														
														 | 
														
															     func updateProgress(progress: CGFloat) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															          
														 | 
														
														 | 
														
															          
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(progress < 0){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(progress <= 0 || lineLayerArray.count == 0){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             BFLog(message: "progress is error ") 
														 | 
														
														 | 
														
															             BFLog(message: "progress is error ") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            return 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         let startIndex = stuckPointStartTime / oneMarginTime 
														 | 
														
														 | 
														
															         let startIndex = stuckPointStartTime / oneMarginTime 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         BFLog(message: "startIndex is\(startIndex) stuckPointStartTime is: \(stuckPointStartTime)") 
														 | 
														
														 | 
														
															         BFLog(message: "startIndex is\(startIndex) stuckPointStartTime is: \(stuckPointStartTime)") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         let selectIndex = Int(startIndex + progress * CGFloat(wavSelectCount)) 
														 | 
														
														 | 
														
															         let selectIndex = Int(startIndex + progress * CGFloat(wavSelectCount)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        let drawLayer:CAShapeLayer = lineLayerArray[selectIndex] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        BFLog(message: "progress is \(progress) i \(selectIndex) 命中的位置:\(CGFloat(selectIndex) * oneMarginTime)") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        drawLayer.strokeColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue).cgColor 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        drawLayer.setNeedsDisplay() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(selectIndex < lineLayerArray.count){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            let drawLayer:CAShapeLayer = lineLayerArray[selectIndex] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            BFLog(message: "progress is \(progress) i \(selectIndex) 命中的位置:\(CGFloat(selectIndex) * oneMarginTime)") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            drawLayer.strokeColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue).cgColor 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            drawLayer.setNeedsDisplay() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															          
														 | 
														
														 | 
														
															          
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if(progress >= 0.99){ 
														 | 
														
														 | 
														
															         if(progress >= 0.99){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             BFLog(message: "播放完成 重新更新 UI ") 
														 | 
														
														 | 
														
															             BFLog(message: "播放完成 重新更新 UI ") 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -381,13 +389,20 @@ extension PQStuckPointCuttingView: UIScrollViewDelegate { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      
														 | 
														
														 | 
														
															      
														 | 
													
												
											
												
													
														| 
														 | 
														
															     func scrollViewDidEndDecelerating(_: UIScrollView) { 
														 | 
														
														 | 
														
															     func scrollViewDidEndDecelerating(_: UIScrollView) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if !scrollView.isDragging, !scrollView.isDecelerating { 
														 | 
														
														 | 
														
															         if !scrollView.isDragging, !scrollView.isDecelerating { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            moveEnd() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2) { [weak self] in 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                self?.moveEnd() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         
														 | 
														
														 | 
														
															         
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     func scrollViewDidEndDragging(_:UIScrollView,willDecelerate decelerate:Bool){ 
														 | 
														
														 | 
														
															     func scrollViewDidEndDragging(_:UIScrollView,willDecelerate decelerate:Bool){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if !decelerate, !scrollView.isDragging, !scrollView.isDecelerating { 
														 | 
														
														 | 
														
															         if !decelerate, !scrollView.isDragging, !scrollView.isDecelerating { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            moveEnd() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+             
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2) { [weak self] in 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                self?.moveEnd() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         
														 | 
														
														 | 
														
															         
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 |