| 
					
				 | 
			
			
				@@ -6,6 +6,12 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //  Copyright © 2021 BytesFlow. All rights reserved. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //  功能:卡点音乐编辑界面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 创建不同玩法的类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+enum createStickersModel { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case createStickersModelPoint // 卡点 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case createStickersModelSpeed // 快慢速 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import Foundation 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import ObjectMapper 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import RealmSwift 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -108,7 +114,7 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 let seekTimeRange: CMTimeRange = CMTimeRange(start: CMTime(value: CMTimeValue(Int64(newBeginSconds)), timescale: 600), end: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     CMTime(value: CMTimeValue(Int64(endTime * 600)), timescale: 600)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 BFLog(message: "修改的开始 \(CMTimeGetSeconds(seekTimeRange.start)) 结束  \(CMTimeGetSeconds(seekTimeRange.end))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //重新设置有效缓存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 重新设置有效缓存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 self?.playerView.configCache(beginTime: CMTimeGetSeconds(seekTimeRange.start)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 self?.playerView.play(pauseFirstFrame: false, playeTimeRange: seekTimeRange) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -321,6 +327,7 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 2,添加背景音乐 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         projectModel.sData?.addBGM(audioMix: stuckPointMusicData!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 设置播放器 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     func settingPlayerView() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 1,设置播放器的显示区域 和画布大小 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -364,7 +371,7 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             videoSize = CGSize(width: minSlider, height: maxSlider) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let maxValue = max(videoSize.width ?? 0, videoSize.height ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let maxValue = max(videoSize.width , videoSize.height ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if maxValue > 1920 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             let maxRation = 1920 / maxValue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -384,62 +391,52 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         projectModel.sData?.videoMetaData?.videoHeight = Int(videoSize.height) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 2,创建滤镜 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let beginTime: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            self.mStickers = self.createStickers(sections: self.projectModel.sData?.sections ?? List(), inputSize: CGSize(width: CGFloat(self.projectModel.sData?.videoMetaData?.videoWidth ?? 0), height: CGFloat(self.projectModel.sData?.videoMetaData?.videoHeight ?? 0))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            self.playerView.mStickers = self.mStickers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let end: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BFLog(message: "createStickers tiskskskskme  \(end - beginTime)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 3,设置音频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let audioPath = self.stuckPointMusicData?.localPath ?? "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BFLog(message: "初始化音频播放器的音频地址为:\(audioPath)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self.playerView.stop() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let beginTime: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mStickers = createStickers(sections: projectModel.sData?.sections ?? List(), inputSize: CGSize(width: CGFloat(projectModel.sData?.videoMetaData?.videoWidth ?? 0), height: CGFloat(projectModel.sData?.videoMetaData?.videoHeight ?? 0)), model: .createStickersModelSpeed) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerView.mStickers = mStickers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let end: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BFLog(message: "createStickers tiskskskskme  \(end - beginTime)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 3,设置音频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let audioPath = stuckPointMusicData?.localPath ?? "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BFLog(message: "初始化音频播放器的音频地址为:\(audioPath)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerView.stop() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 这里的测试这个音乐播放有问题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        self.playerView.updateAsset(URL(fileURLWithPath: "63930549652d74e477141e3b79c8d29a9ef8af81625053214516.mp3", relativeTo:Bundle.main.resourceURL!), videoComposition: nil, audioMixModel: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self.playerView.updateAsset(URL(fileURLWithPath: documensDirectory + audioPath), videoComposition: nil, audioMixModel: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerView.updateAsset(URL(fileURLWithPath: documensDirectory + audioPath), videoComposition: nil, audioMixModel: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let end2: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BFLog(message: "updateAsset tiskskskskme  \(end2 - end)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 4, 设置播放器的输出画布大小 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self.playerView.movie?.mShowVidoSize = CGSize(width: CGFloat(self.projectModel.sData?.videoMetaData?.videoWidth ?? 0), height: CGFloat(self.projectModel.sData?.videoMetaData?.videoHeight ?? 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let end2: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BFLog(message: "updateAsset tiskskskskme  \(end2 - end)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 4, 设置播放器的输出画布大小 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerView.movie?.mShowVidoSize = CGSize(width: CGFloat(projectModel.sData?.videoMetaData?.videoWidth ?? 0), height: CGFloat(projectModel.sData?.videoMetaData?.videoHeight ?? 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 5,开始播放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self.playerView.isLoop = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self.playerView.showProgressLab = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 5,开始播放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerView.isLoop = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerView.showProgressLab = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 初始化音频的开始和结束时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BFLog(message: "播放的器 开始\(String(describing: CMTimeGetSeconds(self.playeTimeRange.start))) 结束 \(String(describing: CMTimeGetSeconds(self.playeTimeRange.end)))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let end3: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self.playerView.play(pauseFirstFrame: false, playeTimeRange: CMTimeRange(start: self.playeTimeRange.start, end: self.playeTimeRange.end)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let end4: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BFLog(message: " playerView.play tiskskskskme  \(end4 - end3)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 6,进度回调 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self.playerView.progress = { [weak self] currentTime, tatolTime, _ in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // 更新进度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    let progress = (currentTime - CMTimeGetSeconds(self?.playeTimeRange.start ?? .zero 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    )) / CMTimeGetSeconds(self?.playeTimeRange.duration ?? .zero 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    BFLog(message: "\(currentTime) \(tatolTime) 显示播放器进度为: \(progress)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    self?.stuckPointCuttingView.videoCropView.updateProgress(progress: CGFloat(progress)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if self?.synchroMarskView.superview != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        self?.synchroMarskView.removeMarskView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 初始化音频的开始和结束时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BFLog(message: "播放的器 开始\(String(describing: CMTimeGetSeconds(playeTimeRange.start))) 结束 \(String(describing: CMTimeGetSeconds(playeTimeRange.end)))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let end3: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerView.play(pauseFirstFrame: false, playeTimeRange: CMTimeRange(start: playeTimeRange.start, end: playeTimeRange.end)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let end4: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BFLog(message: " playerView.play tiskskskskme  \(end4 - end3)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 6,进度回调 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerView.progress = { [weak self] currentTime, tatolTime, _ in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 更新进度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let progress = (currentTime - CMTimeGetSeconds(self?.playeTimeRange.start ?? .zero)) / CMTimeGetSeconds(self?.playeTimeRange.duration ?? .zero) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BFLog(message: "\(currentTime) \(tatolTime) 显示播放器进度为: \(progress)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            self?.stuckPointCuttingView.videoCropView.updateProgress(progress: CGFloat(progress)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if self?.synchroMarskView.superview != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                self?.synchroMarskView.removeMarskView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     deinit { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -464,17 +461,17 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         var stickers: Array = Array<PQEditVisionTrackMaterialsModel>.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 第二种情况:有视频要进行分割 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           1, 确定每个视频素材需要切的段数p 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           2, 将所有视频时长相加,得到总视频素材时长L = l1 + l2 + ... + ln 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           3, 视频素材a1需要切分的个数clipNum = max (round (kongduan * a1 / L) , 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         1, 确定每个视频素材需要切的段数p 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         2, 将所有视频时长相加,得到总视频素材时长L = l1 + l2 + ... + ln 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         3, 视频素材a1需要切分的个数clipNum = max (round (kongduan * a1 / L) , 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 要补的空位数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let kongduan: Int = Int(stuckPoints.count) -  Int(section.sectionTimeline!.visionTrack?.getEnableVisionTrackMaterials().count ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let kongduan: Int = Int(stuckPoints.count) - Int(section.sectionTimeline!.visionTrack?.getEnableVisionTrackMaterials().count ?? 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 所有视频总时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         var videoTotalDuration: Float64 = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for video in section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials(type: "video") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory +  video.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + video.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             videoTotalDuration = videoTotalDuration + Float64(CMTimeGetSeconds(asset.duration)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if videoTotalDuration == 0 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -483,7 +480,7 @@ 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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + sticker.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 要分割的段落 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 let clipNum = Int(max(round(Double(kongduan) * CMTimeGetSeconds(asset.duration) / videoTotalDuration), 1)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 sticker.duration = CMTimeGetSeconds(asset.duration) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -525,142 +522,270 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ///   - sections: 项目所有段落数据信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ///   - inputSize: 画布大小 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// - Returns: filters 数据 播放器可直接使用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    func createStickers(sections: List<PQEditSectionModel>, inputSize _: CGSize = .zero) -> [PQEditVisionTrackMaterialsModel] { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    func createStickers(sections: List<PQEditSectionModel>, inputSize _: CGSize = .zero, model: createStickersModel = .createStickersModelPoint) -> [PQEditVisionTrackMaterialsModel] { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 保存滤镜对象数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         var stickers: Array = Array<PQEditVisionTrackMaterialsModel>.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for section in sections { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if section.sectionType == "normal" { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 推荐卡点数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                var stuckPoints: Array = Array<Float>.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                var stuckPointsTemp = Array<Float>.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for (index, dunshu) in stuckPointMusicData!.rhythmSdata[0].pointTimes.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    BFLog(message: "原所有卡点数:\(index) \(Float(dunshu) / Float(BASE_FILTER_TIMESCALE))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if Float64(dunshu) / Float64(BASE_FILTER_TIMESCALE) > CMTimeGetSeconds(playeTimeRange.start), Float64(dunshu) / Float64(BASE_FILTER_TIMESCALE) < CMTimeGetSeconds(playeTimeRange.end) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        stuckPointsTemp.append(Float(dunshu) / Float(BASE_FILTER_TIMESCALE)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if model == .createStickersModelPoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for section in sections { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if section.sectionType == "normal" { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 推荐卡点数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var stuckPoints: Array = Array<Float>.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var stuckPointsTemp = Array<Float>.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (index, dunshu) in stuckPointMusicData!.rhythmSdata[0].pointTimes.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BFLog(message: "原所有卡点数:\(index) \(Float(dunshu) / Float(BASE_FILTER_TIMESCALE))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if Float64(dunshu) / Float64(BASE_FILTER_TIMESCALE) > CMTimeGetSeconds(playeTimeRange.start), Float64(dunshu) / Float64(BASE_FILTER_TIMESCALE) < CMTimeGetSeconds(playeTimeRange.end) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            stuckPointsTemp.append(Float(dunshu) / Float(BASE_FILTER_TIMESCALE)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 根据不同速度 取卡点 1,2,3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 - 快节奏为选中区域的所有点位,即0,1,2,3,4…… 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 - 适中为每两个点位取一个,即0,2,4,6…… 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 - 慢节奏为每三个点位取一个,即0,3,6,9…… 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BFLog(message: "stuckPointMusicData?.speed is \(String(describing: stuckPointMusicData?.speed))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for (index, point) in stuckPointsTemp.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if stuckPointMusicData?.speed == 1 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        stuckPoints.append(Float(point)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } else if stuckPointMusicData?.speed == 2 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if index % 2 == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            stuckPoints.append(point) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 根据不同速度 取卡点 1,2,3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     - 快节奏为选中区域的所有点位,即0,1,2,3,4…… 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     - 适中为每两个点位取一个,即0,2,4,6…… 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     - 慢节奏为每三个点位取一个,即0,3,6,9…… 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BFLog(message: "stuckPointMusicData?.speed is \(String(describing: stuckPointMusicData?.speed))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (index, point) in stuckPointsTemp.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if stuckPointMusicData?.speed == 1 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            stuckPoints.append(Float(point)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else if stuckPointMusicData?.speed == 2 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if index % 2 == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                stuckPoints.append(point) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else if stuckPointMusicData?.speed == 3 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if index % 3 == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                stuckPoints.append(point) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for point in stuckPoints { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BFLog(message: "没有 start end 计算后的卡点数\(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if stuckPoints.first != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        stuckPoints.removeFirst() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if stuckPoints.last != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        stuckPoints.removeLast() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 开始时间是服务器返回, 结果时间根据策略计算的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    stuckPoints.insert(Float(CMTimeGetSeconds(playeTimeRange.start)), at: 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    stuckPoints.insert((Float(CMTimeGetSeconds(playeTimeRange.end))), at: stuckPoints.count) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for point in stuckPoints { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BFLog(message: "有 start end 计算后的卡点数\(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } else if stuckPointMusicData?.speed == 3 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if index % 3 == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            stuckPoints.append(point) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BFLog(message: "stuckPoints count is \(stuckPoints.count)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 当用户上传视觉素材个数大于等于音乐选择区域节拍分割个数时,无需进行视频分割,只显示卡点数-1 个素材 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials().count >= stuckPointMusicData!.rhythmSdata[0].pointTimes.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (index, sticker) in section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials().enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if index == stuckPointMusicData!.rhythmSdata[0].pointTimes.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                BFLog(message: "到达卡点数量") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BFLog(message: "创建 filter start :\(sticker.timelineIn) end :\(sticker.timelineOut) type is \(sticker.type) \(sticker.locationPath)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            sticker.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            sticker.timelineOut = Float64("\(stuckPoints[index + 1])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BFLog(message: "卡点 间隔 \(sticker.timelineIn - sticker.timelineOut)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            sticker.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            stickers.append(sticker) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // 卡点数 > 选择素材数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // 第一种情况:全是图片,图片回环播放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials(type: "video").count == 0, section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials(type: "image").count > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            for (index, point) in stuckPoints.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let sticker: PQEditVisionTrackMaterialsModel = section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials()[index % section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials().count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                BFLog(message: "stickerlocationPath sticker : \(sticker.locationPath)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let stickerjson = sticker.toJSONString(prettyPrint: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let deepCopySticker = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: stickerjson!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if deepCopySticker!.type == StickerType.IMAGE.rawValue { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if index + 1 < stuckPoints.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        deepCopySticker!.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        deepCopySticker!.timelineOut = Float64("\(stuckPoints[index + 1])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        if deepCopySticker != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            deepCopySticker?.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            stickers.append(deepCopySticker!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            // 第二种情况:有视频要进行分割 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            let clipFilters = clipVideoMerage(section: section, stuckPoints: stuckPoints) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            for (index, point) in stuckPoints.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                BFLog(message: "aaaaaindexindeindexxindexindexindex \(index) \(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if index + 1 < stuckPoints.count, index < clipFilters.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    BFLog(message: "bbbbbindexindeindexxindexindexindex \(index) \(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    let sticker: PQEditVisionTrackMaterialsModel = clipFilters[index] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    sticker.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    // TODO: 不是最好方案 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    sticker.timelineOut = Float64("\(stuckPoints[index + 1])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    // 卡点的时间 >  in out 值 这里就会出现鬼畜效果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    let timelineInterval = sticker.timelineOut - sticker.timelineIn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    let inOutInterval = sticker.out - sticker.model_in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if timelineInterval > inOutInterval { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        BFLog(message: "实际要显示卡点时长\(timelineInterval) 素材裁剪时长:\(inOutInterval)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        sticker.out = sticker.model_in + timelineInterval 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        // 下面只是 LOG 方便查问题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        let stickerInOut = sticker.out - sticker.model_in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        let stickerTimelineInOut = sticker.timelineOut - sticker.timelineIn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        if stickerInOut != stickerTimelineInOut { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            BFLog(message: "sticker.timelineIn \(sticker.timelineIn) stickerTimelineInOut is\(stickerTimelineInOut) stickerInOut is\(stickerInOut) 相差\(stickerTimelineInOut - stickerInOut)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    // out > 素材的总时长in out 进行前移操作 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    let offsetAssetDuration = sticker.out - sticker.duration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if offsetAssetDuration > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        sticker.model_in = sticker.model_in - offsetAssetDuration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        sticker.out = sticker.out - offsetAssetDuration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    BFLog(message: "index is \(index)分割后 创建 filter timelineIn :\(sticker.timelineIn) timelineOut :\(sticker.timelineOut)  in :\(sticker.model_in) out:\(sticker.out) type is \(sticker.type) 显示总时长为:\(sticker.timelineOut - sticker.timelineIn)  裁剪总时长\(sticker.out - sticker.model_in)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    stickers.append(sticker) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for section in sections { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if section.sectionType == "normal" { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 推荐卡点数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var stuckPoints: Array = Array<Float>.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var stuckPointsTemp = Array<Float>.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (index, dunshu) in stuckPointMusicData!.rhythmSdata[0].pointTimes.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BFLog(message: "原所有卡点数:\(index) \(Float(dunshu) / Float(BASE_FILTER_TIMESCALE))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if Float64(dunshu) / Float64(BASE_FILTER_TIMESCALE) > CMTimeGetSeconds(playeTimeRange.start), Float64(dunshu) / Float64(BASE_FILTER_TIMESCALE) < CMTimeGetSeconds(playeTimeRange.end) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            stuckPointsTemp.append(Float(dunshu) / Float(BASE_FILTER_TIMESCALE)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for point in stuckPoints { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    BFLog(message: "没有 start end 计算后的卡点数\(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if stuckPoints.first != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    stuckPoints.removeFirst() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if stuckPoints.last != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    stuckPoints.removeLast() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //开始时间是服务器返回, 结果时间根据策略计算的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                stuckPoints.insert(Float(CMTimeGetSeconds(playeTimeRange.start)), at: 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                stuckPoints.insert((Float(CMTimeGetSeconds(playeTimeRange.end))), at: stuckPoints.count) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 根据不同速度 取卡点 1,2,3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     - 快节奏为选中区域的所有点位,即0,1,2,3,4…… 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     - 适中为每两个点位取一个,即0,2,4,6…… 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     - 慢节奏为每三个点位取一个,即0,3,6,9…… 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BFLog(message: "stuckPointMusicData?.speed is \(String(describing: stuckPointMusicData?.speed))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (index, point) in stuckPointsTemp.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if stuckPointMusicData?.speed == 1 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            stuckPoints.append(Float(point)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else if stuckPointMusicData?.speed == 2 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if index % 2 == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                stuckPoints.append(point) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for point in stuckPoints { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    BFLog(message: "有 start end 计算后的卡点数\(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BFLog(message: "stuckPoints count is \(stuckPoints.count)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 当用户上传视觉素材个数大于等于音乐选择区域节拍分割个数时,无需进行视频分割,只显示卡点数-1 个素材 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials().count >= stuckPointMusicData!.rhythmSdata[0].pointTimes.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for (index, sticker) in section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials().enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if index == stuckPointMusicData!.rhythmSdata[0].pointTimes.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            BFLog(message: "到达卡点数量") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else if stuckPointMusicData?.speed == 3 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if index % 3 == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                stuckPoints.append(point) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        BFLog(message: "创建 filter start :\(sticker.timelineIn) end :\(sticker.timelineOut) type is \(sticker.type) \(sticker.locationPath)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        sticker.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        sticker.timelineOut = Float64("\(stuckPoints[index + 1])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        BFLog(message: "卡点 间隔 \(sticker.timelineIn - sticker.timelineOut)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        sticker.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        stickers.append(sticker) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // 卡点数 > 选择素材数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // 第一种情况:全是图片,图片回环播放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials(type: "video").count == 0, section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials(type: "image").count > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        for (index, point) in stuckPoints.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            let sticker: PQEditVisionTrackMaterialsModel = section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials()[index % section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials().count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            BFLog(message: "stickerlocationPath sticker : \(sticker.locationPath)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            let stickerjson = sticker.toJSONString(prettyPrint: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            let deepCopySticker = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: stickerjson!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if deepCopySticker!.type == StickerType.IMAGE.rawValue { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if index + 1 < stuckPoints.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    deepCopySticker!.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    deepCopySticker!.timelineOut = Float64("\(stuckPoints[index + 1])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    if deepCopySticker != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        deepCopySticker?.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        stickers.append(deepCopySticker!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for point in stuckPoints { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BFLog(message: "没有 start end 计算后的卡点数\(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if stuckPoints.first != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        stuckPoints.removeFirst() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if stuckPoints.last != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        stuckPoints.removeLast() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 开始时间是服务器返回, 结果时间根据策略计算的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    stuckPoints.insert(Float(CMTimeGetSeconds(playeTimeRange.start)), at: 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    stuckPoints.insert((Float(CMTimeGetSeconds(playeTimeRange.end))), at: stuckPoints.count) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for point in stuckPoints { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BFLog(message: "有 start end 计算后的卡点数\(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BFLog(message: "stuckPoints count is \(stuckPoints.count)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 当用户上传视觉素材个数大于等于音乐选择区域节拍分割个数时,无需进行视频分割,只显示卡点数-1 个素材 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials().count >= stuckPointMusicData!.rhythmSdata[0].pointTimes.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (index, sticker) in section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials().enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if index == stuckPointMusicData!.rhythmSdata[0].pointTimes.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                BFLog(message: "到达卡点数量") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BFLog(message: "创建 filter start :\(sticker.timelineIn) end :\(sticker.timelineOut) type is \(sticker.type) \(sticker.locationPath)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            sticker.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            sticker.timelineOut = Float64("\(stuckPoints[index + 1])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BFLog(message: "卡点 间隔 \(sticker.timelineIn - sticker.timelineOut)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            sticker.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            stickers.append(sticker) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        // 第二种情况:有视频要进行分割 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        let clipFilters = clipVideoMerage(section: section, stuckPoints: stuckPoints) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        for (index, point) in stuckPoints.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            BFLog(message: "aaaaaindexindeindexxindexindexindex \(index) \(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if index + 1 < stuckPoints.count, index < clipFilters.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BFLog(message: "bbbbbindexindeindexxindexindexindex \(index) \(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let sticker: PQEditVisionTrackMaterialsModel = clipFilters[index] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                sticker.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                // TODO 不是最好方案 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                sticker.timelineOut = Float64("\(stuckPoints[index + 1] )") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                // 卡点的时间 >  in out 值 这里就会出现鬼畜效果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let timelineInterval = sticker.timelineOut - sticker.timelineIn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let inOutInterval = sticker.out - sticker.model_in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if timelineInterval > inOutInterval { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    BFLog(message: "实际要显示卡点时长\(timelineInterval) 素材裁剪时长:\(inOutInterval)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    sticker.out = sticker.model_in + timelineInterval 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    //下面只是 LOG 方便查问题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    let stickerInOut = sticker.out - sticker.model_in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    let stickerTimelineInOut = sticker.timelineOut - sticker.timelineIn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    if(stickerInOut != stickerTimelineInOut){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        BFLog(message: "sticker.timelineIn \(sticker.timelineIn) stickerTimelineInOut is\(stickerTimelineInOut) stickerInOut is\(stickerInOut) 相差\(stickerTimelineInOut - stickerInOut)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // 卡点数 > 选择素材数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // 第一种情况:全是图片,图片回环播放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials(type: "video").count == 0, section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials(type: "image").count > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            for (index, point) in stuckPoints.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let sticker: PQEditVisionTrackMaterialsModel = section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials()[index % section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials().count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                BFLog(message: "stickerlocationPath sticker : \(sticker.locationPath)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let stickerjson = sticker.toJSONString(prettyPrint: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let deepCopySticker = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: stickerjson!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if deepCopySticker!.type == StickerType.IMAGE.rawValue { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if index + 1 < stuckPoints.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        deepCopySticker!.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        deepCopySticker!.timelineOut = Float64("\(stuckPoints[index + 1])") ?? 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        if deepCopySticker != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            deepCopySticker?.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            stickers.append(deepCopySticker!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                // out > 素材的总时长in out 进行前移操作 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let offsetAssetDuration = sticker.out - sticker.duration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if offsetAssetDuration > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    sticker.model_in = sticker.model_in - offsetAssetDuration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    sticker.out = sticker.out - offsetAssetDuration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            // 第二种情况:有视频要进行分割 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            let clipFilters = clipVideoMerage(section: section, stuckPoints: stuckPoints) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            for (index, point) in stuckPoints.enumerated() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                BFLog(message: "aaaaaindexindeindexxindexindexindex \(index) \(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if index + 1 < stuckPoints.count, index < clipFilters.count { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    BFLog(message: "bbbbbindexindeindexxindexindexindex \(index) \(point)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    let sticker: PQEditVisionTrackMaterialsModel = clipFilters[index] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    let spit: Int = 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    sticker.timelineIn = 57.5 + Double(index * spit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    sticker.timelineOut = sticker.timelineIn + Double(spit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    sticker.speedRate = index % 2 == 0 ? 0.1 : 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    sticker.model_in = Double(index * spit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    sticker.out = sticker.model_in + Double(spit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    let spit: Int = 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    sticker.timelineIn = 57.5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    sticker.timelineOut = sticker.timelineIn + 24 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    sticker.speedRate = index % 2 == 0 ? 0.1 : 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+////                                    sticker.speedRate = 0.1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    sticker.model_in = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    sticker.out = sticker.model_in + 24 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if stickers.count < 12 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        BFLog(message: "index is \(index)分割后 创建 filter timelineIn :\(sticker.timelineIn) timelineOut :\(sticker.timelineOut)  in :\(sticker.model_in) out:\(sticker.out) type is \(sticker.type) 显示总时长为:\(sticker.timelineOut - sticker.timelineIn)  裁剪总时长\(sticker.out - sticker.model_in)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        stickers.append(sticker) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BFLog(message: "index is \(index)分割后 创建 filter timelineIn :\(sticker.timelineIn) timelineOut :\(sticker.timelineOut)  in :\(sticker.model_in) out:\(sticker.out) type is \(sticker.type) 显示总时长为:\(sticker.timelineOut - sticker.timelineIn)  裁剪总时长\(sticker.out - sticker.model_in)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                stickers.append(sticker) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return stickers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -763,25 +888,24 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             let dispatchGroup = DispatchGroup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for photo in selectedPhotoData! { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if photo.asset != nil, photo.asset?.mediaType == .video{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if photo.asset != nil, photo.asset?.mediaType == .video { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if !isHaveVideo { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         isHaveVideo = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     dispatchGroup.enter() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    PQPHAssetVideoParaseUtil.parasToAVAsset(phAsset: photo.asset!) { avAsset, fileSize, _, _ in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    PQPHAssetVideoParaseUtil.parasToAVAsset(phAsset: photo.asset!) { avAsset, _, _, _ in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if avAsset is AVURLAsset { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             // 创建目录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             let fileName = (avAsset as! AVURLAsset).url.absoluteString 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             BFLog(message: "video  fileName is\(fileName)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             let tempPhoto = self.selectedPhotoData?.first(where: { material in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 material.asset == photo.asset 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if(fileName.count ) > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (fileName.count) > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 createDirectory(path: photoLibraryDirectory) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 let outFilePath = photoLibraryDirectory + fileName.md5 + ".mp4" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 // 文件存在先删除老文件 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -792,28 +916,24 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         BFLog(message: "导出相册视频-error == \(error)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                do{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     try FileManager.default.copyItem(atPath: fileName.replacingOccurrences(of: "file:///", with: ""), toPath: outFilePath) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     print("Success to copy file.") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                }catch{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } catch { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     print("Failed to copy file.") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 tempPhoto?.locationPath = outFilePath.replacingOccurrences(of: documensDirectory, with: "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 BFLog(message: "导出视频相册地址为 \(String(describing: tempPhoto?.locationPath))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                dispatchGroup.leave() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                dispatchGroup.leave() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dispatchGroup.notify(queue: DispatchQueue.main) { [weak self] in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 self?.isExportVideosSuccess = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 BFLog(message: "所有相册视频导出成功") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -823,32 +943,26 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //只有图片 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(!isHaveVideo){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self.isExportVideosSuccess = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 只有图片 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if !isHaveVideo { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                isExportVideosSuccess = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 BFLog(message: "所有相册视频导出成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self.dealWithDataSuccess() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dealWithDataSuccess() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// 处理所有数据完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// - Returns: <#description#> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     func dealWithDataSuccess() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BFLog(message: "三组参数:\(isSynchroMusicInfoSuccess)  \(isStuckPointDataSuccess) \(isExportVideosSuccess)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if !isSynchroMusicInfoSuccess  || !isStuckPointDataSuccess || !isExportVideosSuccess { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if !isSynchroMusicInfoSuccess || !isStuckPointDataSuccess || !isExportVideosSuccess { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        playeTimeRange = CMTimeRange(start:  CMTimeMakeWithSeconds(stuckPointMusicData?.startTime ?? 0, preferredTimescale: BASE_FILTER_TIMESCALE), end: CMTimeMakeWithSeconds(stuckPointMusicData?.endTime ?? 0, preferredTimescale: BASE_FILTER_TIMESCALE)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playeTimeRange = CMTimeRange(start: CMTimeMakeWithSeconds(stuckPointMusicData?.startTime ?? 0, preferredTimescale: BASE_FILTER_TIMESCALE), end: CMTimeMakeWithSeconds(stuckPointMusicData?.endTime ?? 0, preferredTimescale: BASE_FILTER_TIMESCALE)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         createPorjectData() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         settingPlayerView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 |