| 
					
				 | 
			
			
				@@ -18,6 +18,8 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var videoAsset : AVURLAsset? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var avplayerTimeObserver: NSKeyValueObservation? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let backV = UIView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var hasExportAll = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var hasExportOnly = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var hasSaveAll = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var hasSaveOnly = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var saveAllUlr = URL(fileURLWithPath: "aaa") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -37,7 +39,7 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 合成进度指示条 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     lazy var progressView : UIView = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let v = UIView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        v.backgroundColor = .red 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        v.backgroundColor = ThemeStyleColor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return v 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -47,7 +49,9 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         la.textColor = .white 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         la.textAlignment = .center 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         la.text = "0%" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        la.font = UIFont.systemFont(ofSize: 8) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        la.font = UIFont.systemFont(ofSize: 28) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        la.shadowColor = .black 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        la.shadowOffset = CGSize(width: 1, height: 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return la 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -75,7 +79,7 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         exportBtn.setImage(UIImage(named: "export_btn"), for: .normal) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         exportBtn.backgroundColor = ThemeStyleColor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         exportBtn.addCorner(roundingCorners: .allCorners, corner: 8) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        exportBtn.addTarget(self, action: #selector(saveNow), for: .touchUpInside) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        exportBtn.addTarget(self, action: #selector(saveToPhotoNow), for: .touchUpInside) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return exportBtn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -92,7 +96,7 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          //    进度监控 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if let item = avplayer?.currentItem { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 DispatchQueue.main.async { [weak self] in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    self?.progreddL.text = String(format: "%.2f / %.2f", CMTimeGetSeconds(time), CMTimeGetSeconds(item.duration)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    self?.progreddL.text = String(format: "%@ / %@", CMTimeGetSeconds(time).formatDurationToHMS(), CMTimeGetSeconds(item.duration).formatDurationToHMS()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -137,12 +141,12 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if sself.saveAllBtn.isSelected { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         sself.saveAllUlr = fileUrl 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        sself.hasSaveAll = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        sself.hasExportAll = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if sself.saveOnlyBtn.isSelected { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         sself.saveOnlyUlr = fileUrl 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        sself.hasSaveOnly = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        sself.hasExportOnly = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -161,6 +165,9 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     override func backBtnClick() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if !(hasExportAll || hasExportOnly) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         export.cancelExport() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         super.backBtnClick() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -172,7 +179,7 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         leftButton(image: nil, imageName: nil, tintColor: UIColor.white) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        backV.frame = CGRect(x: 0, y: navHeadImageView?.bottomY ?? 0, width: cScreenWidth, height: cScreenWidth) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        backV.backgroundColor = .gray 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        backV.backgroundColor = .clear 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         backV.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(play))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -275,7 +282,11 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @objc func saveNow(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @objc func saveToPhotoNow(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (self.saveAllBtn.isSelected && self.hasSaveAll) || self.saveOnlyBtn.isSelected && self.hasSaveOnly { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            cShowHUB(superView: nil, msg: "已保存过了") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if let url = (avplayer.currentItem?.asset as? AVURLAsset)?.url{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             PHPhotoLibrary.shared().performChanges { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -284,6 +295,11 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     DispatchQueue.main.async { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         cShowHUB(superView: nil, msg: "保存成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if self.saveAllBtn.isSelected { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        self.hasSaveAll = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }else if self.saveOnlyBtn.isSelected { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        self.hasSaveOnly = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -296,7 +312,7 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         btn.isSelected = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         saveOnlyBtn.isSelected = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         avplayer.pause() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if !hasSaveAll{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if !hasExportAll{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             exportNow() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             let item = AVPlayerItem(url: saveAllUlr) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -312,7 +328,7 @@ class INVideoExportController: BFBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         btn.isSelected = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         saveAllBtn.isSelected = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         avplayer.pause() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if !hasSaveOnly { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if !hasExportOnly { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             exportNow() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             let item = AVPlayerItem(url: saveOnlyUlr) 
			 |