Procházet zdrojové kódy

1,删除不使用代码 ,2,录音时隐藏变音入口 3,返回时删除缓存音频文件 4,添加 LOG

jsonwang před 3 roky
rodič
revize
3ecf5a5cd4

+ 12 - 25
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -189,7 +189,7 @@ public class BFRecordScreenController: BFBaseViewController {
     public var isRecording = false { // 是否正在录音
         didSet {
             withDrawBtn.isHidden = isRecording
-            changeVoiceBtn.isHidden = isRecording
+            voiceSettingBtn.isHidden = isRecording
             subtitleBtn.isHidden = isRecording
             soundSettingBtn.isHidden = isRecording
             recordBtn.setTitle(isRecording ? "record_pause".BFLocale : (currMediaType == .Camera ? "record_lz".BFLocale : "record_ly".BFLocale), for: .normal)
@@ -376,19 +376,6 @@ public class BFRecordScreenController: BFBaseViewController {
         return btn
     }()
 
-    lazy var changeVoiceBtn: UIButton = {
-        let btn = UIButton(type: .custom)
-        btn.setImage(imageInRecordScreenKit(by: "changeVoice_n"), for: .normal)
-        btn.setImage(imageInRecordScreenKit(by: "changeVoice_h"), for: .highlighted)
-        btn.setTitle("变声", for: .normal)
-        btn.setTitleColor(.white, for: .normal)
-        btn.setTitleColor(ThemeStyleColor, for: .highlighted)
-        btn.titleLabel?.font = UIFont.systemFont(ofSize: 12)
-        btn.contentVerticalAlignment = UIControl.ContentVerticalAlignment.center
-        btn.addTarget(self, action: #selector(changeVoiceAction), for: .touchUpInside)
-        return btn
-    }()
-
     lazy var toolV: BFIntroduceToolView = {
         let toolV = BFIntroduceToolView()
         toolV.centerY = view.centerY
@@ -735,7 +722,6 @@ public class BFRecordScreenController: BFBaseViewController {
         bottomeView.addSubview(recordBtn)
         bottomeView.addSubview(deleteRecordBtn)
         bottomeView.addSubview(withDrawBtn)
-        //        bottomeView.addSubview(changeVoiceBtn)
         bottomeView.addSubview(progressThumV)
         bottomeView.addSubview(cameraProgressThumV)
 
@@ -925,11 +911,7 @@ public class BFRecordScreenController: BFBaseViewController {
             make.width.height.equalTo(65)
             make.top.equalTo(88)
         }
-        //        changeVoiceBtn.snp.makeConstraints { make in
-        //            make.right.equalToSuperview()
-        //            make.top.width.height.equalTo(withDrawBtn)
-        //        }
-
+ 
         recordBtn.snp.makeConstraints { make in
             make.left.equalTo(withDrawBtn.snp.right)
             make.right.equalTo(-65)
@@ -989,9 +971,6 @@ public class BFRecordScreenController: BFBaseViewController {
 
         withDrawBtn.imageEdgeInsets = UIEdgeInsets(top: -withDrawBtn.imageView!.height, left: 0, bottom: 0, right: -withDrawBtn.titleLabel!.width)
         withDrawBtn.titleEdgeInsets = UIEdgeInsets(top: withDrawBtn.titleLabel!.height + 2, left: -withDrawBtn.imageView!.width, bottom: 0, right: 0)
-
-        changeVoiceBtn.imageEdgeInsets = UIEdgeInsets(top: -changeVoiceBtn.imageView!.height - 2, left: 0, bottom: 0, right: -changeVoiceBtn.titleLabel!.width)
-        changeVoiceBtn.titleEdgeInsets = UIEdgeInsets(top: changeVoiceBtn.titleLabel!.height + 2, left: -changeVoiceBtn.imageView!.width, bottom: 0, right: 0)
     }
     // MARK: - 录音机字幕回调相关
     func initlizeRecordManager() {
@@ -1314,7 +1293,8 @@ public class BFRecordScreenController: BFBaseViewController {
     // MARK: - 按钮事件响应
 
     override public func backBtnClick() {
-        
+        //add by ak 删除变音文件
+        tts?.deleteWavFiles()
         pause()
     }
 
@@ -1455,6 +1435,7 @@ public class BFRecordScreenController: BFBaseViewController {
 
             searchStopAtRecordRange()
             changeWithDrawBtnLayout(3)
+            
         }
     }
 
@@ -2194,9 +2175,11 @@ public class BFRecordScreenController: BFBaseViewController {
         deleteRecordBtn.isHidden = true
 
         subtitleBtn.isHidden = true
+        voiceSettingBtn.isHidden = true
         soundSettingBtn.isHidden = true
         withDrawBtn.isHidden = true
         recordBtn.isHidden = true
+        
     }
 
     public func pause() {
@@ -2833,7 +2816,11 @@ extension BFRecordScreenController: BFTTSManagerDelegte{
     }
     
     public func ttsFinish(_ model:BFTTSTaskModel){
-        BFLog(message: "文字转语音完成recordId:\(model.recordId) tttaskid:\(model.tTtaskId)")
+        
+        
+        let ttsAudioAsset = AVURLAsset(url: URL(fileURLWithPath: model.wavFilePath), options: avAssertOptions)
+     
+        BFLog(message: "文字转语音完成recordId:\(model.recordId) tttaskid:\(model.tTtaskId)  tss语音时长\(ttsAudioAsset.duration.seconds) 字幕开始\(model.timelineIn.seconds) 字幕结束\(model.timelineOut.seconds) 字幕原时长\(CMTimeSubtract(model.timelineOut, model.timelineIn).seconds)")
         
         let voice = PQVoiceModel.init()
         voice.wavFilePath = model.wavFilePath