| 
					
				 | 
			
			
				@@ -1231,7 +1231,9 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 所有视频总时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // MARK: SanW-2021.11.15-不在导出到沙盒,直接用本地地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: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 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1240,7 +1242,9 @@ 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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // MARK: SanW-2021.11.15-不在导出到沙盒,直接用本地地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: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) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1399,7 +1403,9 @@ 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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                // MARK: SanW-2021.11.15-不在导出到沙盒,直接用本地地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath:sticker.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + sticker.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 BFLog(message: "单个视频\(sticker.locationPath)时长::\(CMTimeGetSeconds(asset.duration)) ,clipNum is:\(sticker.clipCount)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 var lastOutTime: Float64 = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 for _ in 1 ... sticker.clipCount { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1647,7 +1653,9 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if section.sectionType == "normal" { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     for sticker in section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if sticker.type == StickerType.VIDEO.rawValue { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + sticker.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            // MARK: SanW-2021.11.15-不在导出到沙盒,直接用本地地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath:sticker.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + sticker.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             let assetDuration = Float(CMTimeGetSeconds(asset.duration)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             BFLog(message: "输入素材时长 \(assetDuration)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1905,39 +1913,40 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             let tempPhoto = self.selectedMetarialData?.first(where: { material in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 material.asset == photo.asset 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if fileName.count > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                createDirectory(path: photoLibraryDirectory) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let outFilePath = photoLibraryDirectory + fileName.md5 + ".mp4" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                // 文件存在先删除老文件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if FileManager.default.fileExists(atPath: outFilePath) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        try FileManager.default.removeItem(at: NSURL.fileURL(withPath: outFilePath)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } catch { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        BFLog(message: "导出相册视频-error == \(error)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let curr = Date() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let assetResources = PHAssetResource.assetResources(for: photo.asset!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if let rsc = assetResources.first(where: { res in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    res.type == .video  || res.type == .pairedVideo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                }) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    PHAssetResourceManager.default().writeData(for: rsc, toFile: URL(fileURLWithPath: outFilePath), options: nil) { error in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        if error == nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            BFLog(message: "导出视频相exportAsynchronously \(String(describing: outFilePath)) \(Date().timeIntervalSince(curr))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            tempPhoto?.locationPath = outFilePath.replacingOccurrences(of: documensDirectory, with: "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            failedExprot = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                            BFLog(message: "导出视频相exportAsynchro faile") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        dispatchGroup.leave() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    BFLog(message: "导出视频相exportAsynchro faile") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    dispatchGroup.leave() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// MARK: SanW-2021.11.15-不在导出到沙盒,直接用本地地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            tempPhoto?.locationPath = fileName?.replacingOccurrences(of: "file:///", with: "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            if fileName.count > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                createDirectory(path: photoLibraryDirectory) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                let outFilePath = photoLibraryDirectory + fileName.md5 + ".mp4" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                // 文件存在先删除老文件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                if FileManager.default.fileExists(atPath: outFilePath) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        try FileManager.default.removeItem(at: NSURL.fileURL(withPath: outFilePath)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    } catch { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        BFLog(message: "导出相册视频-error == \(error)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                let curr = Date() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                let assetResources = PHAssetResource.assetResources(for: photo.asset!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                if let rsc = assetResources.first(where: { res in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    res.type == .video  || res.type == .pairedVideo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                }) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    PHAssetResourceManager.default().writeData(for: rsc, toFile: URL(fileURLWithPath: outFilePath), options: nil) { error in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        if error == nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            BFLog(message: "导出视频相exportAsynchronously \(String(describing: outFilePath)) \(Date().timeIntervalSince(curr))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            tempPhoto?.locationPath = outFilePath.replacingOccurrences(of: documensDirectory, with: "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            failedExprot = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                            BFLog(message: "导出视频相exportAsynchro faile") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                        dispatchGroup.leave() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    BFLog(message: "导出视频相exportAsynchro faile") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                    dispatchGroup.leave() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 |