| 
					
				 | 
			
			
				@@ -433,8 +433,24 @@ class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         saveVideoTipsLabel.textAlignment = .center 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         saveVideoTipsLabel.font = UIFont.boldSystemFont(ofSize: 17) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         saveVideoTipsLabel.text = "视频保存中..." 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        saveVideoTipsLabel.sizeToFit() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return saveVideoTipsLabel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 保存重试 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    lazy var saveRetryBtn: UIButton = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let finishedBtn = UIButton(type: .custom) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        finishedBtn.setTitle("重试", for: .normal) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        finishedBtn.setTitleColor(UIColor.white, for: .normal) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        finishedBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        finishedBtn.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        finishedBtn.tag = 97 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        finishedBtn.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        finishedBtn.addCorner(corner: 5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        finishedBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return finishedBtn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     override func backBtnClick() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if isExportSuccess { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -461,6 +477,11 @@ class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var isTestSaveFailed = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    override func rightBtnClick(sender:UIButton){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isTestSaveFailed = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     override func viewDidLoad() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         super.viewDidLoad() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -468,6 +489,8 @@ class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         addNotification(self, selector: #selector(uploadSuccess(notify:)), name: cUploadSuccessKey, object: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PQNotification.addObserver(self, selector: #selector(didBecomeActiveNotification), name: UIApplication.didBecomeActiveNotification, object: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         leftButton(image: nil, tintColor: PQBFConfig.shared.styleTitleColor) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        rightButtonItem(image: nil, title: "TestSave失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         navHeadImageView?.backgroundColor = UIColor.clear 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         lineView?.removeFromSuperview() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         view.addSubview(bgTopView) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -510,7 +533,18 @@ class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         view.addSubview(saveVideoTipsBgView) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         saveVideoTipsBgView.addSubview(saveVideoTipsLabel) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        saveVideoTipsBgView.addSubview(saveRetryBtn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        saveVideoTipsLabel.snp.makeConstraints { make in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.top.height.equalToSuperview() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.centerX.equalToSuperview() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        saveRetryBtn.snp.makeConstraints { make in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.left.equalTo(saveVideoTipsLabel.snp.right).offset(10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.top.equalTo(6) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.bottom.equalTo(-6) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.width.equalTo(50) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         coverImageTitle.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(settingCoverImage))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         coverImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(settingCoverImage))) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -532,19 +566,19 @@ class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.height.equalTo(22) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         shareWechatBtn.snp.makeConstraints { make in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            make.right.equalTo(view.snp_centerX).offset(-cDefaultMargin) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.right.equalTo(view.snp.centerX).offset(-cDefaultMargin) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.width.equalTo(164) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.height.equalTo(52) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            make.bottom.equalTo(finishedBtn.snp_top).offset(-32) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.bottom.equalTo(finishedBtn.snp.top).offset(-32) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         shareFriendBtn.snp.makeConstraints { make in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            make.left.equalTo(view.snp_centerX).offset(cDefaultMargin) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.left.equalTo(view.snp.centerX).offset(cDefaultMargin) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.width.bottom.height.equalTo(shareWechatBtn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         inputBackView.snp.makeConstraints { make in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.centerX.equalToSuperview() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            make.bottom.equalTo(shareWechatBtn.snp_top).offset(-16) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.bottom.equalTo(shareWechatBtn.snp.top).offset(-16) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.width.equalTo(343) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.height.equalTo(109) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -566,21 +600,21 @@ class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         coverImageTitle.snp.makeConstraints { make in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.left.equalToSuperview() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.width.equalTo(50) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            make.top.equalTo(coverImageView.snp_bottom).offset(isWidth ? 0 : -23) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.top.equalTo(coverImageView.snp.bottom).offset(isWidth ? 0 : -23) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.height.equalTo(23) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         remindLab.snp.makeConstraints { make in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.centerX.equalToSuperview() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            make.bottom.equalTo(inputBackView.snp_top).offset(-16).priorityHigh() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.bottom.equalTo(inputBackView.snp.top).offset(-16).priorityHigh() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.height.equalTo(44) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.top.greaterThanOrEqualTo(5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            make.bottom.lessThanOrEqualTo(inputBackView.snp_top).offset(-5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.bottom.lessThanOrEqualTo(inputBackView.snp.top).offset(-5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         titleLabel.snp.makeConstraints { make in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.height.equalTo(48) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            make.left.equalTo(coverImageView.snp_right).offset(12) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.left.equalTo(coverImageView.snp.right).offset(12) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.right.equalToSuperview().offset(-14) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.top.equalToSuperview().offset(10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -588,7 +622,7 @@ class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         pinView.snp.makeConstraints { make in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.height.width.equalTo(72) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             make.right.equalToSuperview() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            make.bottom.equalTo(inputBackView.snp_bottom) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            make.bottom.equalTo(inputBackView.snp.bottom) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         publicTitleView.snp.makeConstraints { make in 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -651,7 +685,7 @@ class PQStuckPointPublicController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     deinit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        BFLog(message: "发布界面析构 1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BFLog(1, message: "发布界面析构release") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         view.endEditing(true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PQNotification.removeObserver(self) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 取消导出 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -867,7 +901,7 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         exporter.completion = { [weak self] url in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BFLog(message: "无水印的视频导出完成: \(url) 生成视频时长为:\(CMTimeGetSeconds(AVAsset(url: url).duration))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BFLog(message: "无水印的视频导出完成: \(String(describing: url)) 生成视频时长为:\(CMTimeGetSeconds(AVAsset(url: (url ?? URL(string: "https://media.w3.org/2010/05/sintel/trailer.mp4")!)).duration))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 导出完成后取消导出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if self?.exporter != nil { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -916,12 +950,14 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// - Returns: <#description#> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     func saveStuckPointVideo() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(saveMovieLocalURL == nil){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(saveMovieLocalURL == nil || isTestSaveFailed){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BFLog(message: "保存相册的视频导出地址无效!!!") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            saveVideoTipsLabel.text = "视频已经保存失败" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.8) { [weak self] in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self?.saveVideoTipsBgView.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            saveVideoTipsLabel.text = "视频保存失败" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            saveRetryBtn.isHidden = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            saveVideoTipsBgView.isHidden = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.8) { [weak self] in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                self?.saveVideoTipsBgView.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let authStatus = PHPhotoLibrary.authorizationStatus() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -933,16 +969,18 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 DispatchQueue.main.async { [weak self] in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if self?.view != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if isFinished { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            self?.saveVideoTipsLabel.text = "视频已经保存到相册" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            self?.saveVideoTipsLabel.text = "视频已保存到相册" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            self?.saveRetryBtn.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.8) { [weak self] in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 self?.saveVideoTipsBgView.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            self?.saveVideoTipsLabel.text = "视频已经保存失败" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.8) { [weak self] in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                self?.saveVideoTipsBgView.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            self?.saveVideoTipsLabel.text = "视频保存失败" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            self?.saveRetryBtn.isHidden = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.8) { [weak self] in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                                self?.saveVideoTipsBgView.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1083,7 +1121,7 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         DispatchQueue.global().async { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             PQBaseViewModel.getStsToken { [weak self] response, _ in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if response == nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    self?.showUploadRemindView(isNetCollected: false, msg: "获取数据失败了哦~") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    self?.showUploadRemindView(isNetCollected: false, msg: "token获取数据失败了哦~") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 更新进度 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1117,10 +1155,10 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if code == 6 { // 无网 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     let uploadRequest: OSSMultipartUploadRequest? = PQAliOssUtil.shared.allTasks[self?.uploadData?.videoBucketKey ?? ""] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if !(uploadRequest != nil && "\(uploadRequest?.callbackParam["code"] ?? "0")" == "1") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        self?.showUploadRemindView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        self?.showUploadRemindView(msg:"aliOss") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else if code == 260 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    self?.showUploadRemindView(isNetCollected: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    self?.showUploadRemindView(isNetCollected: false, msg:"aliOss") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else if code != 1 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 上传失败-播放视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     self?.publicEnd(isError: true) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1382,7 +1420,11 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             navigationController?.viewControllers = [(navigationController?.viewControllers.first)!] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 发送通知 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             postNotification(name: cFinishedPublishedNotiKey) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        case 97: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            saveRetryBtn.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            saveVideoTipsLabel.text = "视频保存中..." 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            isTestSaveFailed = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            self.saveStuckPointVideo() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1392,14 +1434,46 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// - Parameters: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ///   - isNetCollected: <#isNetCollected description#> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ///   - msg: <#msg description#> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    func showUploadRemindView(isNetCollected _: Bool = true, msg _: String? = nil) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    func showUploadRemindView(isNetCollected _: Bool = true, msg: String? = nil) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         view.endEditing(true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        PQUploadRemindView.showUploadRemindView(title: isNetCollected ? "上传中断" : "上传失败", summary: (isNetCollected ? "似乎已断开与互联网的连接" : (msg != nil ? msg : "视频文件已丢失"))!, confirmTitle: isNetCollected ? "重新连接网络" : "重新上传") { [weak self] _, _ in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            if isNetCollected { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                openAppSetting() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                self?.navigationController?.popToViewController((self?.navigationController?.viewControllers[1])!, animated: true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let emptyData = PQEmptyModel() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.isRefreshHidden = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.title = "上传失败" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.titleColor = UIColor.hexColor(hexadecimal: "#353535") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.summary = "建议切换 WIFI/移动网络后再重试" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.summaryColor = UIColor.hexColor(hexadecimal: "#353535") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.refreshBgColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.refreshTitle = NSMutableAttributedString(string: "立即重试", attributes: [.foregroundColor:UIColor.white]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.emptySoureImage = UIImage.moduleImage(named: "stuckPoint_video_empty", moduleName: "BFMaterialKit",isAssets: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.netDisRefreshBgColor = UIColor.hexColor(hexadecimal: "#FA6400") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.netDisTitle = "内容加载失败" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.netDisTitleColor = UIColor.hexColor(hexadecimal: "#333333") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.netemptyDisImage = UIImage.moduleImage(named: "empty_netDis_icon", moduleName: "BFMaterialKit",isAssets: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyData.netDisRefreshTitle = NSMutableAttributedString(string: "重新加载", attributes: [.font: UIFont.systemFont(ofSize: 16, weight: .medium), .foregroundColor: UIColor.white]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let emptyRemindView = PQEmptyRemindView(frame: CGRect(x: 0, y: cDevice_iPhoneNavBarAndStatusBarHei, width: view.frame.width, height: view.frame.height - cDevice_iPhoneNavBarAndStatusBarHei)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        emptyRemindView.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyRemindView.emptyData = emptyData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyRemindView.backgroundColor = PQBFConfig.shared.styleBackGroundColor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyRemindView.fullRefreshBloc = {[weak self] _, _ in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if emptyRemindView.refreshBtn.currentAttributedTitle?.string == "立即重试" { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                emptyRemindView.isHidden = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 重试逻辑 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if let message = msg{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if message.contains("token") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        self?.uploadVideo() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }else if message.contains("aliOss"){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        self?.uploadVideo() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        emptyRemindView.refreshBtn.addCorner(corner: 4) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        view.addSubview(emptyRemindView) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        PQRemindView.showUploadRemindView(title: "上传失败", summary: (msg != nil ? msg! : "视频文件已丢失"), confirmTitle:  "立即重试") { [weak self] _, _ in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            self?.navigationController?.popToViewController((self?.navigationController?.viewControllers[1])!, animated: true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1648,12 +1722,12 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             watermarkMovieExporter.start(playeTimeRange: playeTimeRange) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BFLog(message: "开始导出") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        watermarkMovieExporter.progressClosure = { [weak self] _, _, progress in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        watermarkMovieExporter.progressClosure = { _, _, progress in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BFLog(message: "带水印的合成进度 \(progress) ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         watermarkMovieExporter.completion = { [weak self] url in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BFLog(message: "有水印的视频导出完成: \(url) 生成视频时长为:\(CMTimeGetSeconds(AVAsset(url: url).duration))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BFLog(message: "有水印的视频导出完成: \(String(describing: url)) 生成视频时长为:\(CMTimeGetSeconds(AVAsset(url: url ?? URL(string: "https://media.w3.org/2010/05/sintel/trailer.mp4")!).duration))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 导出完成后取消导出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if self?.watermarkMovieExporter != nil { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1705,125 +1779,128 @@ extension PQStuckPointPublicController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BFLog(message: "头像的网络地址\(BFLoginUserInfo.shared.avatarUrl)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let avatarFilePath = NSHomeDirectory().appending("/Documents/").appending("user_avatar.jpg") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ImageDownloader.default.downloadImage(with: URL(string: BFLoginUserInfo.shared.avatarUrl)!, options: nil) { result in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // warning:给默认头像吧 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ImageDownloader.default.downloadImage(with: URL(string: BFLoginUserInfo.shared.avatarUrl)!, options: nil) {[weak self] result in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var image : UIImage? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             switch result { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case let .success(imageResult):   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   let image = UIImage.nx_circleImage(imageResult.image) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   if(image == nil){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       BFLog(message: "image date is error!!") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   UIImage.saveImage(currentImage: image!, outFilePath: avatarFilePath) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                image = UIImage.nx_circleImage(imageResult.image) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   //1,背景视频素材 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   let bgMovieInfo:PQEditVisionTrackMaterialsModel = PQEditVisionTrackMaterialsModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   bgMovieInfo.type = StickerType.VIDEO.rawValue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   bgMovieInfo.locationPath = moveResPath ?? "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   bgMovieInfo.timelineIn = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   bgMovieInfo.timelineOut = CMTimeGetSeconds(movieAsset.duration) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   bgMovieInfo.model_in = bgMovieInfo.timelineIn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   bgMovieInfo.out = bgMovieInfo.timelineOut 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   bgMovieInfo.canvasFillType = stickerContentMode.aspectFitStr.rawValue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   //2,用户头像素材 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   BFLog(message: "头像的沙盒地址:\(avatarFilePath)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   let avatarSticker:PQEditVisionTrackMaterialsModel = PQEditVisionTrackMaterialsModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   avatarSticker.locationPath = avatarFilePath.replacingOccurrences(of: documensDirectory, with: "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   avatarSticker.timelineIn = bgMovieInfo.timelineIn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   avatarSticker.timelineOut = bgMovieInfo.timelineOut 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   avatarSticker.canvasFillType = stickerContentMode.aspectFitStr.rawValue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //头像绘制大小\位置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                avatarPostion.x = ((self.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) - Int(avatarSize)) / 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                avatarPostion.y = Int(avatarTop) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   avatarSticker.materialPosition = avatarPostion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   //3,用户名素材 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   let userNameSticker:PQEditVisionTrackMaterialsModel = PQEditVisionTrackMaterialsModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   userNameSticker.timelineIn = bgMovieInfo.timelineIn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   userNameSticker.timelineOut = bgMovieInfo.timelineOut 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   userNameSticker.type = StickerType.SUBTITLE.rawValue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   //用户名绘制用到的参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   userNamePostion.x = ((self.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) -  userNamePostion.width) / 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   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) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       self.endMovieExporter.start(playeTimeRange: CMTimeRange.init(start: CMTime.zero, duration: CMTimeMakeWithSeconds(Float64(bgMovieInfo.out), preferredTimescale: BASE_FILTER_TIMESCALE))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       BFLog(message: "开始导出") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   self.endMovieExporter.progressClosure = { [weak self] _, _, progress in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       BFLog(message: "片尾合成进度 \(progress) ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self.endMovieExporter.completion = { [weak self] url in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       BFLog(message: "片尾的视频导出完成: \(url) 生成视频时长为:\(CMTimeGetSeconds(AVAsset(url: url).duration))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       // 导出完成后取消导出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       if self?.endMovieExporter != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                           self?.endMovieExporter.cancel() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       self?.endMovieLocalURL = url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       //拼接水印正片和片尾 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       if(self?.watermarkMovieLocalURL != nil && self?.endMovieLocalURL != nil){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                           let videoMerge:NXVideoMerge = NXVideoMerge.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                           videoMerge.mergeAndExportVideos(withFileURLs: [self!.watermarkMovieLocalURL!,self!.endMovieLocalURL!], renderSize:CGSize(width: self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0, height: self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0)) { isSuccess, outFileURL in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                               if(isSuccess){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   BFLog(message: "合并视频成功 outFilePath is \(outFileURL ?? "")") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   self?.saveMovieLocalURL = outFileURL as? URL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   //保存到相册 fp2-1-1 - 请求权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                   self?.authorizationStatus() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                               } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             case let .failure(error): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                image = UIImage.moduleImage(named: "user_avatar_normal", moduleName: "BFFramework", isAssets:false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 BFLog(message: "下载头像图片失败:\(error.localizedDescription)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(image == nil){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BFLog(message: "image date is error!!") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            UIImage.saveImage(currentImage: image!, outFilePath: avatarFilePath) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //1,背景视频素材 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let bgMovieInfo:PQEditVisionTrackMaterialsModel = PQEditVisionTrackMaterialsModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bgMovieInfo.type = StickerType.VIDEO.rawValue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bgMovieInfo.locationPath = moveResPath ?? "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bgMovieInfo.timelineIn = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bgMovieInfo.timelineOut = CMTimeGetSeconds(movieAsset.duration) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bgMovieInfo.model_in = bgMovieInfo.timelineIn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bgMovieInfo.out = bgMovieInfo.timelineOut 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bgMovieInfo.canvasFillType = stickerContentMode.aspectFitStr.rawValue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //2,用户头像素材 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BFLog(message: "头像的沙盒地址:\(avatarFilePath)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let avatarSticker:PQEditVisionTrackMaterialsModel = PQEditVisionTrackMaterialsModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            avatarSticker.locationPath = avatarFilePath.replacingOccurrences(of: documensDirectory, with: "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            avatarSticker.timelineIn = bgMovieInfo.timelineIn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            avatarSticker.timelineOut = bgMovieInfo.timelineOut 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            avatarSticker.canvasFillType = stickerContentMode.aspectFitStr.rawValue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         //头像绘制大小\位置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            avatarPostion.x = ((self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) - Int(avatarSize)) / 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         avatarPostion.y = Int(avatarTop) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            avatarSticker.materialPosition = avatarPostion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //3,用户名素材 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let userNameSticker:PQEditVisionTrackMaterialsModel = PQEditVisionTrackMaterialsModel.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userNameSticker.timelineIn = bgMovieInfo.timelineIn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userNameSticker.timelineOut = bgMovieInfo.timelineOut 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userNameSticker.type = StickerType.SUBTITLE.rawValue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //用户名绘制用到的参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userNamePostion.x = ((self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) -  userNamePostion.width) / 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            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.progressClosure = { _, _, progress in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            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))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 导出完成后取消导出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if self?.endMovieExporter != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    self?.endMovieExporter.cancel() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                self?.endMovieLocalURL = url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //拼接水印正片和片尾 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(self?.watermarkMovieLocalURL != nil && self?.endMovieLocalURL != nil){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let videoMerge:NXVideoMerge = NXVideoMerge.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    videoMerge.mergeAndExportVideos(withFileURLs: [self!.watermarkMovieLocalURL!,self!.endMovieLocalURL!], renderSize:CGSize(width: self?.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0, height: self?.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0)) { isSuccess, outFileURL in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(isSuccess){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BFLog(message: "合并视频成功 outFilePath is \(outFileURL ?? "")") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            self?.saveMovieLocalURL = outFileURL as? URL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            //保存到相册 fp2-1-1 - 请求权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            self?.authorizationStatus() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |