| 
					
				 | 
			
			
				@@ -12,6 +12,7 @@ import UIKit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import WechatOpenSDK 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import Kingfisher 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import BFCommonKit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import Alamofire 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private var isShared: Bool = false // 是否在分享 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -644,6 +645,8 @@ class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 取推荐标题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         getTitles() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        networkStausListen() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -704,8 +707,19 @@ class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 点击上报:返回按钮 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_click_back, pageSource: .sp_stuck_publishSyncedUp, extParams: nil, remindmsg: "卡点视频数据上报-(点击上报:返回按钮)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // MARK: - 网络监控 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    func networkStausListen(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        manager?.startListening(onUpdatePerforming: { status in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if status == .reachable(.cellular) || status == .reachable(.ethernetOrWiFi) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cHiddenHUB(superView: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                cShowHUB(superView: nil, msg: "当前网络不佳,请尝试重新连接") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // MARK: - 导出/上传/下载及其他方法 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /// 导出/上传/下载及其他方法 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1813,24 +1827,24 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             avatarSticker.timelineOut = bgMovieInfo.timelineOut 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             avatarSticker.canvasFillType = stickerContentMode.aspectFitStr.rawValue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         //头像绘制大小\位置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         var avatarSize:Float = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         var avatarTop:Float = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             //头像绘制大小\位置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var avatarSize:Float = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var avatarTop:Float = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if((self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) > (self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             //竖屏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 //竖屏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 avatarSize = Float(self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) * 360.0 / 1080.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             avatarTop = 430 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             //横屏屏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            avatarSize = Float(self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 300.0 / 1080.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            avatarTop = Float(self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 130.0 / 1080.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         let avatarPostion:PQEditMaterialPositionModel = PQEditMaterialPositionModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         avatarPostion.width = Int(avatarSize) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         avatarPostion.height = Int(avatarSize) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                avatarTop = 430 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //横屏屏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                avatarSize = Float(self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 300.0 / 1080.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                avatarTop = Float(self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 130.0 / 1080.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let avatarPostion:PQEditMaterialPositionModel = PQEditMaterialPositionModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            avatarPostion.width = Int(avatarSize) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            avatarPostion.height = Int(avatarSize) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             avatarPostion.x = ((self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) - Int(avatarSize)) / 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         avatarPostion.y = Int(avatarTop) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            avatarPostion.y = Int(avatarTop) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             avatarSticker.materialPosition = avatarPostion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //3,用户名素材 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1841,48 +1855,47 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //用户名绘制用到的参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         var userNameTop:Float = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         var userNameFontSize:Float = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var userNameTop:Float = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var userNameFontSize:Float = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if((self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) > (self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              //竖屏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             userNameTop = 870 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                userNameTop = 870 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 userNameFontSize = Float(self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) * 100.0 / 1080.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             //横屏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            userNameTop = Float(self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 480 / 1080.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            userNameFontSize = Float(self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 70.0 / 1080.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         let subtitleInfo:PQEditSubtitleInfoModel = PQEditSubtitleInfoModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         subtitleInfo.fontSize = Int(userNameFontSize) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         subtitleInfo.text = BFLoginUserInfo.shared.nickName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         userNameSticker.subtitleInfo = subtitleInfo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         let userNamePostion:PQEditMaterialPositionModel = PQEditMaterialPositionModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         userNamePostion.width = Int(userNameFontSize ) * 10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         userNamePostion.height = Int(userNameFontSize ) * 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 //横屏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                userNameTop = Float(self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 480 / 1080.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                userNameFontSize = Float(self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 70.0 / 1080.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let subtitleInfo:PQEditSubtitleInfoModel = PQEditSubtitleInfoModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            subtitleInfo.fontSize = Int(userNameFontSize) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            subtitleInfo.text = BFLoginUserInfo.shared.nickName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userNameSticker.subtitleInfo = subtitleInfo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let userNamePostion:PQEditMaterialPositionModel = PQEditMaterialPositionModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userNamePostion.width = Int(userNameFontSize ) * 10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userNamePostion.height = Int(userNameFontSize ) * 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             userNamePostion.x = ((self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) -  userNamePostion.width) / 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         userNamePostion.y = Int(userNameTop) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         userNameSticker.materialPosition = userNamePostion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userNamePostion.y = Int(userNameTop) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userNameSticker.materialPosition = userNamePostion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         //4,音频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         let soundResPath = currentBundlePath()!.path(forResource: "endMovieSound", ofType: "mp3") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         let soundAsset = AVURLAsset(url:  URL(fileURLWithPath: soundResPath ?? ""), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //4,音频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let soundResPath = currentBundlePath()!.path(forResource: "endMovieSound", ofType: "mp3") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let soundAsset = AVURLAsset(url:  URL(fileURLWithPath: soundResPath ?? ""), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             self?.endMovieExporter = PQCompositionExporter(asset: soundAsset, videoComposition: nil, audioMix: nil, filters: nil, stickers: [bgMovieInfo,avatarSticker,userNameSticker], animationTool: nil, exportURL: outPutMP4URL) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             self?.endMovieExporter.isEndMovie = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if ((self?.endMovieExporter.prepare(videoSize: CGSize(width: self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0, height: self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0), videoAverageBitRate: orgeBitRate)) != nil) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            self?.endMovieExporter.start(playeTimeRange: CMTimeRange.init(start: CMTime.zero, duration: CMTimeMakeWithSeconds(Float64(bgMovieInfo.out), preferredTimescale: BASE_FILTER_TIMESCALE))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BFLog(message: "开始导出") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                self?.endMovieExporter.start(playeTimeRange: CMTimeRange.init(start: CMTime.zero, duration: CMTimeMakeWithSeconds(Float64(bgMovieInfo.out), preferredTimescale: BASE_FILTER_TIMESCALE))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BFLog(message: "开始导出") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             self?.endMovieExporter.progressClosure = { _, _, progress in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BFLog(message: "片尾合成进度 \(progress) ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BFLog(message: "片尾合成进度 \(progress) ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             self?.endMovieExporter.completion = { [weak self] url in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             BFLog(message: "片尾的视频导出完成: \(String(describing: url)) 生成视频时长为:\(CMTimeGetSeconds(AVAsset(url: url ?? URL(string: "https://media.w3.org/2010/05/sintel/trailer.mp4")!).duration))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BFLog(message: "片尾的视频导出完成: \(String(describing: url)) 生成视频时长为:\(CMTimeGetSeconds(AVAsset(url: url ?? URL(string: "https://media.w3.org/2010/05/sintel/trailer.mp4")!).duration))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 导出完成后取消导出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if self?.endMovieExporter != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     self?.endMovieExporter.cancel() 
			 |