Selaa lähdekoodia

字幕时间戳修正

harry 3 vuotta sitten
vanhempi
commit
535bafae2b

+ 2 - 2
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -458,7 +458,7 @@ public class BFRecordScreenController: BFBaseViewController {
                 newSubtitle.taskID = (header?["task_id"] as? String) ?? ""
 
                 // 这里加300ms 是因为返回结果为了切到字,时长提前一些时间,具体时间官方没说和原音频有关系。这里我们先延后300ms 单位:毫秒。
-                if audioFilePath == self?.recorderManager?.voiceModel?.wavFilePath ?? "aa" {
+                if URL(fileURLWithPath: audioFilePath ?? "b").deletingPathExtension().lastPathComponent.contains(URL(fileURLWithPath: (self?.recorderManager?.voiceModel?.wavFilePath ?? "aa")).deletingPathExtension().lastPathComponent) {
                     newSubtitle.timelineIn = (self?.recorderManager?.voiceModel?.startCMTime.seconds ?? 0.0) + Float64((((payload?["begin_time"]) as? Int) ?? 0) + 300) / 1000.0
                     newSubtitle.timelineOut = (self?.recorderManager?.voiceModel?.startCMTime.seconds ?? 0.0) + Float64(((payload?["time"]) as? Int) ?? 0) / 1000.0
                 } else {
@@ -1912,7 +1912,7 @@ public extension BFRecordScreenController {
             currenStartPlayTime = CMTime.zero
         }
         playRecord(at: time, periodicTimeObserver: { [weak self] currentT, currentItem in
-            BFLog(1, message: "播放录音进度:\(currentT),\(currentItem)")
+            BFLog(1, message: "播放录音进度:\(currentT.seconds),\(currentItem)")
             if self?.itemModels[self?.currItemModelIndex ?? 0].mediaType == .IMAGE, self?.isNormalPlaying ?? false {
                 self?.imageRecordProgress(progress: CMTimeGetSeconds(currentT))
             }