Ver Fonte

1,添加统计 2, 显示转音进度

jsonwang há 3 anos atrás
pai
commit
7926d37dc9

+ 13 - 5
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -40,7 +40,8 @@ public class BFRecordScreenController: BFBaseViewController {
     // 字幕按钮点击上报
     public var subTitleBtnClickHandle: ((_ isOn: Bool) -> Void)?
 //    public var currentRecordId: String? // 当前录制Id
-
+    //选了发音人点了确定
+    public var voiceBtnClickHandle: ((_ voice: PQVoiceModel?) -> Void)?
     // MARK: - 素材参数
     lazy var rsvmanager : BFRecordScreenVideoManager = {
         let m = BFRecordScreenVideoManager()
@@ -839,8 +840,12 @@ public class BFRecordScreenController: BFBaseViewController {
             guard let wself = self else { return }
           
             if actionType == .VoiceSettingActionConfirm{//要生成真实音频文件
-                wself.tts?.stopTTS("")
                 BFLog(2, message: "确认选择发音人操作")
+                if(wself.voiceBtnClickHandle != nil && selectVoice != nil){
+                    wself.voiceBtnClickHandle!(selectVoice!)
+                }
+                wself.tts?.stopTTS("")
+            
                 
                 //切换了发音人
                 if(wself.mSelectVoiced != selectVoice){
@@ -2003,7 +2008,7 @@ public class BFRecordScreenController: BFBaseViewController {
             BFLog(3, message: "未找到可播放录音")
             return
         }
-//        BFLog(1, message: "当前时间:\(CMTimeGetSeconds(currentT)), 找到的音频:\(recordedAudio.startCMTime.seconds) ~ \(recordedAudio.endCMTime.seconds), \(recordedAudio.wavFilePath ?? "")")
+        BFLog(1, message: "当前时间:\(CMTimeGetSeconds(currentT)), 找到的音频:\(recordedAudio.startCMTime.seconds) ~ \(recordedAudio.endCMTime.seconds), \(recordedAudio.wavFilePath ?? "")")
 
         // 创建播放器
         if (recordPlayer.currentItem?.asset as? AVURLAsset)?.url.lastPathComponent != (recordedAudio.wavFilePath as NSString?)?.lastPathComponent {
@@ -2822,10 +2827,13 @@ extension BFRecordScreenController: BFTTSManagerDelegte{
         voice.startCMTime = model.timelineIn
         voice.endCMTime = model.timelineOut
         voice.ttsTaskID = model.tTtaskId
+        voice.recordId = model.recordId
         itemModels[currItemModelIndex].voiceChangeStickers.append(voice)
         
-        //
-        loadingView.titleL.text = "变音中 \(itemModels[currItemModelIndex].voiceChangeStickers.count / itemModels[currItemModelIndex].titleStickers.count)%"
+        //显示转换进度
+        let progress =  Float(itemModels[currItemModelIndex].voiceChangeStickers.count * 100 / itemModels[currItemModelIndex].titleStickers.count)
+        BFLog(message: "TTS 进度:\(Int(progress))")
+        loadingView.titleL.text = "变音中 \(Int(progress))%"
         
         if(voiceChangeStickerFinish(itemIndex: currItemModelIndex)){
             loadingView.loadHidden()