| 
														
															@@ -18,6 +18,8 @@ class INVideoExportController: BFBaseViewController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     var videoAsset : AVURLAsset? 
														 | 
														
														 | 
														
															     var videoAsset : AVURLAsset? 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     var avplayerTimeObserver: NSKeyValueObservation? 
														 | 
														
														 | 
														
															     var avplayerTimeObserver: NSKeyValueObservation? 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let backV = UIView() 
														 | 
														
														 | 
														
															     let backV = UIView() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    var hasExportAll = false 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    var hasExportOnly = false 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     var hasSaveAll = false 
														 | 
														
														 | 
														
															     var hasSaveAll = false 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     var hasSaveOnly = false 
														 | 
														
														 | 
														
															     var hasSaveOnly = false 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     var saveAllUlr = URL(fileURLWithPath: "aaa") 
														 | 
														
														 | 
														
															     var saveAllUlr = URL(fileURLWithPath: "aaa") 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -37,7 +39,7 @@ class INVideoExportController: BFBaseViewController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     // 合成进度指示条 
														 | 
														
														 | 
														
															     // 合成进度指示条 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     lazy var progressView : UIView = { 
														 | 
														
														 | 
														
															     lazy var progressView : UIView = { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         let v = UIView() 
														 | 
														
														 | 
														
															         let v = UIView() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        v.backgroundColor = .red 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        v.backgroundColor = ThemeStyleColor 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return v 
														 | 
														
														 | 
														
															         return v 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }() 
														 | 
														
														 | 
														
															     }() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      
														 | 
														
														 | 
														
															      
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -47,7 +49,9 @@ class INVideoExportController: BFBaseViewController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         la.textColor = .white 
														 | 
														
														 | 
														
															         la.textColor = .white 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         la.textAlignment = .center 
														 | 
														
														 | 
														
															         la.textAlignment = .center 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         la.text = "0%" 
														 | 
														
														 | 
														
															         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 
														 | 
														
														 | 
														
															         return la 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }() 
														 | 
														
														 | 
														
															     }() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      
														 | 
														
														 | 
														
															      
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -75,7 +79,7 @@ class INVideoExportController: BFBaseViewController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         exportBtn.setImage(UIImage(named: "export_btn"), for: .normal) 
														 | 
														
														 | 
														
															         exportBtn.setImage(UIImage(named: "export_btn"), for: .normal) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         exportBtn.backgroundColor = ThemeStyleColor 
														 | 
														
														 | 
														
															         exportBtn.backgroundColor = ThemeStyleColor 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         exportBtn.addCorner(roundingCorners: .allCorners, corner: 8) 
														 | 
														
														 | 
														
															         exportBtn.addCorner(roundingCorners: .allCorners, corner: 8) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        exportBtn.addTarget(self, action: #selector(saveNow), for: .touchUpInside) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        exportBtn.addTarget(self, action: #selector(saveToPhotoNow), for: .touchUpInside) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return exportBtn 
														 | 
														
														 | 
														
															         return exportBtn 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }() 
														 | 
														
														 | 
														
															     }() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      
														 | 
														
														 | 
														
															      
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -92,7 +96,7 @@ class INVideoExportController: BFBaseViewController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															          //    进度监控 
														 | 
														
														 | 
														
															          //    进度监控 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if let item = avplayer?.currentItem { 
														 | 
														
														 | 
														
															             if let item = avplayer?.currentItem { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 DispatchQueue.main.async { [weak self] in 
														 | 
														
														 | 
														
															                 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 { 
														 | 
														
														 | 
														
															                     if sself.saveAllBtn.isSelected { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                         sself.saveAllUlr = fileUrl 
														 | 
														
														 | 
														
															                         sself.saveAllUlr = fileUrl 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        sself.hasSaveAll = true 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        sself.hasExportAll = true 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     } 
														 | 
														
														 | 
														
															                     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                      
														 | 
														
														 | 
														
															                      
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     if sself.saveOnlyBtn.isSelected { 
														 | 
														
														 | 
														
															                     if sself.saveOnlyBtn.isSelected { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                         sself.saveOnlyUlr = fileUrl 
														 | 
														
														 | 
														
															                         sself.saveOnlyUlr = fileUrl 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        sself.hasSaveOnly = true 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        sself.hasExportOnly = true 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     } 
														 | 
														
														 | 
														
															                     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } 
														 | 
														
														 | 
														
															                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -161,6 +165,9 @@ class INVideoExportController: BFBaseViewController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      
														 | 
														
														 | 
														
															      
														 | 
													
												
											
												
													
														| 
														 | 
														
															     override func backBtnClick() { 
														 | 
														
														 | 
														
															     override func backBtnClick() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if !(hasExportAll || hasExportOnly) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+             
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         export.cancelExport() 
														 | 
														
														 | 
														
															         export.cancelExport() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         super.backBtnClick() 
														 | 
														
														 | 
														
															         super.backBtnClick() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -172,7 +179,7 @@ class INVideoExportController: BFBaseViewController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         leftButton(image: nil, imageName: nil, tintColor: UIColor.white) 
														 | 
														
														 | 
														
															         leftButton(image: nil, imageName: nil, tintColor: UIColor.white) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															          
														 | 
														
														 | 
														
															          
														 | 
													
												
											
												
													
														| 
														 | 
														
															 //        backV.frame = CGRect(x: 0, y: navHeadImageView?.bottomY ?? 0, width: cScreenWidth, height: cScreenWidth) 
														 | 
														
														 | 
														
															 //        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))) 
														 | 
														
														 | 
														
															         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{ 
														 | 
														
														 | 
														
															         if let url = (avplayer.currentItem?.asset as? AVURLAsset)?.url{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             PHPhotoLibrary.shared().performChanges { 
														 | 
														
														 | 
														
															             PHPhotoLibrary.shared().performChanges { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url) 
														 | 
														
														 | 
														
															                 PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -284,6 +295,11 @@ class INVideoExportController: BFBaseViewController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     DispatchQueue.main.async { 
														 | 
														
														 | 
														
															                     DispatchQueue.main.async { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                         cShowHUB(superView: nil, msg: "保存成功") 
														 | 
														
														 | 
														
															                         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 
														 | 
														
														 | 
														
															         btn.isSelected = true 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         saveOnlyBtn.isSelected = false 
														 | 
														
														 | 
														
															         saveOnlyBtn.isSelected = false 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         avplayer.pause() 
														 | 
														
														 | 
														
															         avplayer.pause() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if !hasSaveAll{ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if !hasExportAll{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             exportNow() 
														 | 
														
														 | 
														
															             exportNow() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }else{ 
														 | 
														
														 | 
														
															         }else{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             let item = AVPlayerItem(url: saveAllUlr) 
														 | 
														
														 | 
														
															             let item = AVPlayerItem(url: saveAllUlr) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -312,7 +328,7 @@ class INVideoExportController: BFBaseViewController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         btn.isSelected = true 
														 | 
														
														 | 
														
															         btn.isSelected = true 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         saveAllBtn.isSelected = false 
														 | 
														
														 | 
														
															         saveAllBtn.isSelected = false 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         avplayer.pause() 
														 | 
														
														 | 
														
															         avplayer.pause() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if !hasSaveOnly { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if !hasExportOnly { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             exportNow() 
														 | 
														
														 | 
														
															             exportNow() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }else{ 
														 | 
														
														 | 
														
															         }else{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             let item = AVPlayerItem(url: saveOnlyUlr) 
														 | 
														
														 | 
														
															             let item = AVPlayerItem(url: saveOnlyUlr) 
														 |