Bladeren bron

Merge branch 'master' of https://git.yishihui.com/iOS/BFRecordScreenKit

wenweiwei 3 jaren geleden
bovenliggende
commit
a80b5d1b27

+ 1 - 0
BFRecordScreenKit/Classes/BFVoiceRecordManager.swift

@@ -63,6 +63,7 @@ class BFVoiceRecordManager: NSObject {
         recorderFilePath.append("recorder_\(Date().timeIntervalSince1970).pcm")
         beginRecordTime = Date()
         BFLog(1, message: "开始录音 \(recorderFilePath)  开始时间\(beginRecordTime)")
+        voiceModel?.wavFilePath = recorderFilePath
         audioRecorder?.startRecord(recorderFilePath)
     }
 

+ 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 {
@@ -1911,7 +1911,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))
             }