Procházet zdrojové kódy

删除不掉字幕fix

harry před 3 roky
rodič
revize
9d8df5e5ff

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

@@ -503,6 +503,9 @@ public class BFRecordScreenController: BFBaseViewController {
                             BFLog(1, message: "卡在录音尾巴上了1")
                             newSubtitle.timelineIn = newSubtitle.timelineIn - CMTime(seconds: 0.1, preferredTimescale: 1000)
                         }
+                    }else {
+                        BFLog(1, message: "没有对应音频播放记录,出现错误!!!!!!")
+                        return
                     }
                 }
                 var showText = ((payload?["result"]) as? String) ?? ""
@@ -715,7 +718,7 @@ public class BFRecordScreenController: BFBaseViewController {
         }
         var findShowSubtitle: PQEditSubTitleModel?
         for (index, subtitle) in itemModels[currItemModelIndex].titleStickers.enumerated() {
-            if CMTimeCompare(subtitle.timelineIn, time) <= 0, CMTimeCompare(subtitle.timelineOut, time) >= 0 {
+            if CMTimeCompare(subtitle.timelineIn, time) <= 0, CMTimeCompare(subtitle.timelineOut, time) > 0, subtitle.audioFilePath.count > 0 { //  audioFilePath.count 这个条件是确保这个字幕有对应录音
                 findShowSubtitle = subtitle
                 BFLog(1, message: "找到要显示的字幕 in \((findShowSubtitle?.timelineIn ?? .zero).seconds) out \((findShowSubtitle?.timelineOut ?? .zero).seconds) text:\(findShowSubtitle?.text ?? "") currTime is \(CMTimeGetSeconds(time))")
                 showSubtitleIndex = index