|  | @@ -17,6 +17,7 @@ import Foundation
 | 
	
		
			
				|  |  |  import GPUImage
 | 
	
		
			
				|  |  |  import Photos
 | 
	
		
			
				|  |  |  import UIKit
 | 
	
		
			
				|  |  | +import BFUploadKit
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  struct WithDrawModel {
 | 
	
		
			
				|  |  |      var type: Int // 0:拖动; 1:预览播放暂停 2: 录音结束  3: 删除录音
 | 
	
	
		
			
				|  | @@ -48,6 +49,7 @@ public class BFRecordScreenController: BFBaseViewController {
 | 
	
		
			
				|  |  |      public var nextActionHandle: (() -> Void)?
 | 
	
		
			
				|  |  |      public var closeActionHandle: (() -> Void)?
 | 
	
		
			
				|  |  |      public var changeItemHandle: ((_ index: Int) -> Void)?
 | 
	
		
			
				|  |  | +    public var cleanScreen: ((Bool) -> Void)?
 | 
	
		
			
				|  |  |      // 当前录制结束的上报
 | 
	
		
			
				|  |  |      public var recordEndHandle: ((_ currentRecord: PQVoiceModel?) -> Void)?
 | 
	
		
			
				|  |  |      // 字幕按钮点击上报
 | 
	
	
		
			
				|  | @@ -512,20 +514,13 @@ public class BFRecordScreenController: BFBaseViewController {
 | 
	
		
			
				|  |  |      }()
 | 
	
		
			
				|  |  |      
 | 
	
		
			
				|  |  |      lazy var choseMusicPanel: BFChooseMusicView = {
 | 
	
		
			
				|  |  | -        let vv = BFChooseMusicView(frame: CGRect(x: 0, y: cScreenHeigth, width: cScreenWidth, height: cScreenHeigth - 200))
 | 
	
		
			
				|  |  | +        let vv = BFChooseMusicView(frame: CGRect(x: 0, y: cScreenHeigth, width: cScreenWidth, height: cScreenHeigth))
 | 
	
		
			
				|  |  |          vv.clickBtnAction = { [weak self, weak vv] type in
 | 
	
		
			
				|  |  |              guard let wself = self else { return }
 | 
	
		
			
				|  |  |              
 | 
	
		
			
				|  |  |              var nextAction : ((Bool) -> Void)?
 | 
	
		
			
				|  |  |              if type == BFChooseMusicViewClickType.sure {
 | 
	
		
			
				|  |  | -                let model = vv?.chosedMusic
 | 
	
		
			
				|  |  | -                wself.bgmModel = model
 | 
	
		
			
				|  |  | -                if let title = model?.musicName {
 | 
	
		
			
				|  |  | -                    wself.addMusicBtn.setTitle(model?.musicName, for: .normal)
 | 
	
		
			
				|  |  | -                }else{
 | 
	
		
			
				|  |  | -                    wself.addMusicBtn.setTitle("选择音乐", for: .normal)
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                // 设置music为背景音乐
 | 
	
		
			
				|  |  | +                wself.hadChoosed(music: vv?.chosedMusic)
 | 
	
		
			
				|  |  |              }else if type == .cancle{
 | 
	
		
			
				|  |  |                  
 | 
	
		
			
				|  |  |              }else if type == .search{
 | 
	
	
		
			
				|  | @@ -537,10 +532,7 @@ public class BFRecordScreenController: BFBaseViewController {
 | 
	
		
			
				|  |  |                          vc.modalPresentationStyle = .fullScreen
 | 
	
		
			
				|  |  |                          vc.choseAction = {[weak self] voiceModel in
 | 
	
		
			
				|  |  |                              guard let wself = self else { return }
 | 
	
		
			
				|  |  | -                            wself.bgmModel = voiceModel
 | 
	
		
			
				|  |  | -//                            wself.dismiss(animated: true) {
 | 
	
		
			
				|  |  | -//                                
 | 
	
		
			
				|  |  | -//                            }
 | 
	
		
			
				|  |  | +                            wself.hadChoosed(music: voiceModel)
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          
 | 
	
		
			
				|  |  |                          vc.cutActionCallback = {[weak self] voiceModel in
 | 
	
	
		
			
				|  | @@ -556,14 +548,14 @@ public class BFRecordScreenController: BFBaseViewController {
 | 
	
		
			
				|  |  |              let hiddAnimation = {[weak self] in
 | 
	
		
			
				|  |  |                  guard let wself = self else { return }
 | 
	
		
			
				|  |  |                  
 | 
	
		
			
				|  |  | -                wself.choseMusicPanel.frame = CGRect(x: 0, y: cScreenHeigth, width: cScreenWidth, height: cScreenHeigth - 200)
 | 
	
		
			
				|  |  | +                wself.choseMusicPanel.frame = CGRect(x: 0, y: cScreenHeigth, width: cScreenWidth, height: cScreenHeigth)
 | 
	
		
			
				|  |  |                  
 | 
	
		
			
				|  |  |                  wself.soundSettingBtn.isHidden = false
 | 
	
		
			
				|  |  |                  wself.cameraFlipBtn.isHidden = false
 | 
	
		
			
				|  |  |                  wself.voiceSettingBtn.isHidden = false
 | 
	
		
			
				|  |  |                  wself.subtitleBtn.isHidden = false
 | 
	
		
			
				|  |  |                  wself.addMusicBtn.isHidden = false
 | 
	
		
			
				|  |  | -                
 | 
	
		
			
				|  |  | +                wself.cleanScreen?(false)
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              
 | 
	
		
			
				|  |  |              UIView.animate(withDuration: 0.25, animations: hiddAnimation, completion: nextAction)
 | 
	
	
		
			
				|  | @@ -574,7 +566,7 @@ public class BFRecordScreenController: BFBaseViewController {
 | 
	
		
			
				|  |  |              UIView.animate(withDuration: 0.25) {[weak self] in
 | 
	
		
			
				|  |  |                  guard let wself = self else { return }
 | 
	
		
			
				|  |  |                  
 | 
	
		
			
				|  |  | -                wself.choseMusicPanel.frame = CGRect(x: 0, y: cScreenHeigth, width: cScreenWidth, height: cScreenHeigth - 200)
 | 
	
		
			
				|  |  | +                wself.choseMusicPanel.frame = CGRect(x: 0, y: cScreenHeigth, width: cScreenWidth, height: cScreenHeigth)
 | 
	
		
			
				|  |  |                  
 | 
	
		
			
				|  |  |                  wself.soundSettingBtn.isHidden = false
 | 
	
		
			
				|  |  |                  wself.cameraFlipBtn.isHidden = false
 | 
	
	
		
			
				|  | @@ -790,11 +782,22 @@ public class BFRecordScreenController: BFBaseViewController {
 | 
	
		
			
				|  |  |      override public func viewDidLoad() {
 | 
	
		
			
				|  |  |          super.viewDidLoad()
 | 
	
		
			
				|  |  |          _ = disablePopGesture()
 | 
	
		
			
				|  |  | +<<<<<<< HEAD
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        let path = Bundle.main.path(forResource: "11111", ofType: "mp3")
 | 
	
		
			
				|  |  | +        bgmModel = PQVoiceModel.init()
 | 
	
		
			
				|  |  | +        bgmModel?.wavFilePath = path
 | 
	
		
			
				|  |  | +        bgmModel?.startCMTime  = CMTime.init(value: 20 * 1000_000, timescale: 1000_000)
 | 
	
		
			
				|  |  | +        bgmModel?.endCMTime  = CMTime.init(value: 240 * 1000_000, timescale: 1000_000)
 | 
	
		
			
				|  |  | +        bgmModel?.volume = 100
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +=======
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |          let doubleTapGes = UITapGestureRecognizer(target: self, action: #selector(doubleTapAction(tap:)))
 | 
	
		
			
				|  |  |          doubleTapGes.numberOfTapsRequired = 2
 | 
	
		
			
				|  |  |          doubleTapGes.numberOfTouchesRequired = 1
 | 
	
		
			
				|  |  |          view.addGestureRecognizer(doubleTapGes)
 | 
	
		
			
				|  |  | +>>>>>>> c2402d0b7d3837cbda505e6074eded08f1528888
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |          // 进入活跃状态
 | 
	
		
			
				|  |  |          PQNotification.addObserver(self, selector: #selector(didBecomeActive), name: UIApplication.didBecomeActiveNotification, object: nil)
 | 
	
	
		
			
				|  | @@ -1537,17 +1540,6 @@ public class BFRecordScreenController: BFBaseViewController {
 | 
	
		
			
				|  |  |        
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      
 | 
	
		
			
				|  |  | -    @objc func doubleTapAction(tap:UITapGestureRecognizer) {
 | 
	
		
			
				|  |  | -        if !(bottomeView.bounds.contains(tap.location(in: bottomeView))
 | 
	
		
			
				|  |  | -             || navHeadImageView!.bounds.contains(tap.location(in: navHeadImageView!))
 | 
	
		
			
				|  |  | -             || !voiceSettingView.isHidden
 | 
	
		
			
				|  |  | -             || !subtitleSettingView.isHidden
 | 
	
		
			
				|  |  | -             || !audioSettingView.isHidden
 | 
	
		
			
				|  |  | -             || recordBtn.isHidden){
 | 
	
		
			
				|  |  | -            cameraFlipAction()
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  |      @objc func cameraFlipAction() {
 | 
	
		
			
				|  |  |          if currMediaType == .Camera && !recordBtn.isHidden  {
 | 
	
		
			
				|  |  |              rscmanager.cameraFlip()
 | 
	
	
		
			
				|  | @@ -1561,11 +1553,11 @@ public class BFRecordScreenController: BFBaseViewController {
 | 
	
		
			
				|  |  |          voiceSettingBtn.isHidden = true
 | 
	
		
			
				|  |  |          subtitleBtn.isHidden = true
 | 
	
		
			
				|  |  |          addMusicBtn.isHidden = true
 | 
	
		
			
				|  |  | -        
 | 
	
		
			
				|  |  | +        cleanScreen?(true)
 | 
	
		
			
				|  |  |          UIView.animate(withDuration: 0.25) {[weak self] in
 | 
	
		
			
				|  |  |              guard let wself = self else { return }
 | 
	
		
			
				|  |  |              
 | 
	
		
			
				|  |  | -            wself.choseMusicPanel.frame = CGRect(x: 0, y: 210, width: cScreenWidth, height: cScreenHeigth - 200)
 | 
	
		
			
				|  |  | +            wself.choseMusicPanel.frame = CGRect(x: 0, y: 0, width: cScreenWidth, height: cScreenHeigth)
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2641,6 +2633,32 @@ public class BFRecordScreenController: BFBaseViewController {
 | 
	
		
			
				|  |  |              imageRecordProgress(isRecord: true, progress: progress)
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    func hadChoosed(music:PQVoiceModel?) {
 | 
	
		
			
				|  |  | +        bgmModel = music
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if let model = music {
 | 
	
		
			
				|  |  | +            if let title = model.musicName {
 | 
	
		
			
				|  |  | +                addMusicBtn.setTitle(title, for: .normal)
 | 
	
		
			
				|  |  | +            }else{
 | 
	
		
			
				|  |  | +                addMusicBtn.setTitle("选择音乐", for: .normal)
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            // 设置music为背景音乐
 | 
	
		
			
				|  |  | +            hadDowonloadMusic(model: model)
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            BFLog(1, message: "无效音乐")
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    func hadDowonloadMusic(model: PQVoiceModel) {
 | 
	
		
			
				|  |  | +        if let path = model.musicPath {
 | 
	
		
			
				|  |  | +            PQDownloadManager.downLoadFile(url: path) { musicUrl, err in
 | 
	
		
			
				|  |  | +                if err == nil, musicUrl != nil {
 | 
	
		
			
				|  |  | +                    model.wavFilePath = musicUrl
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  extension BFRecordScreenController: GPUImageMovieDelegate {
 | 
	
	
		
			
				|  | @@ -2682,6 +2700,11 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
 | 
	
		
			
				|  |  |              cell = BFVideoCoverViewCell.gpuVideoViewCell(collectionView: collectionView, indexPath: indexPath)
 | 
	
		
			
				|  |  |          case .Camera:
 | 
	
		
			
				|  |  |              cell = BFCameraCoverViewCell.gpuCamraViewCell(collectionView: collectionView, indexPath: indexPath)
 | 
	
		
			
				|  |  | +            (cell as? BFCameraCoverViewCell)?.cameraFlip = {[weak self] in
 | 
	
		
			
				|  |  | +                guard let wself = self else { return }
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  | +                wself.cameraFlipAction()
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          default:
 | 
	
		
			
				|  |  |              break
 | 
	
		
			
				|  |  |          }
 |