소스 검색

修改字幕和音频的关联关系;
切换素材时停止字幕翻译服务

harry 3 년 전
부모
커밋
5dec6700e8

+ 1 - 1
BFRecordScreenKit/Classes/BFRecordExport.swift

@@ -218,7 +218,7 @@ public class BFRecordExport {
                             voiceList.append(voice)
 
                             let titleModels = itemModel.titleStickers.filter { mod in
-                                mod.audioFilePath == voiceSticker.wavFilePath
+                                mod.taskID == voiceSticker.titleTaskId
                             }
                             
                             // 字幕的时间点是以相关录音的原点为坐标计算的。

+ 4 - 3
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -976,7 +976,7 @@ public class BFRecordScreenController: BFBaseViewController {
 
         // 从原数组中删除
         itemModels[currItemModelIndex].titleStickers.removeAll { m in
-            let su = (m.audioFilePath == voiceModel.wavFilePath)
+            let su = (m.taskID == voiceModel.titleTaskId)
             if su {
                 deleteTemp.append(m)
             }
@@ -1015,7 +1015,7 @@ public class BFRecordScreenController: BFBaseViewController {
                         item.endCMTime = item.endCMTime - currDuration
                         
                         let titlsList = itemModels[currItemModelIndex].titleStickers.filter({ tm in
-                            tm.audioFilePath == item.wavFilePath
+                            tm.taskID == item.titleTaskId
                         })
                         
                         for titleM in titlsList {
@@ -1164,7 +1164,7 @@ public class BFRecordScreenController: BFBaseViewController {
         BFLog(2, message: "删除\(voiceModel?.wavFilePath ?? "")对应的字幕 前 count\(subtitleCount)")
         if subtitleCount > 0 {
             for title in itemModels[currItemModelIndex].titleStickers {
-                if title.audioFilePath == voiceModel?.wavFilePath ?? "" {
+                if title.taskID == voiceModel?.titleTaskId ?? "none" {
                     if let index = itemModels[currItemModelIndex].titleStickers.firstIndex(of: title) {
                         itemModels[currItemModelIndex].titleStickers.remove(at: index)
                     }
@@ -2073,6 +2073,7 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
             if isRecording {
                 endRecord()
             }
+            recorderManager?.cancelTitleService()
 //            events.append(WithDrawModel(type: 0, timestamp: currentAssetProgress.seconds))
 //            // 重设撤销栈
 //            itemModels[currItemModelIndex].events = events