浏览代码

播放音频时去掉变速设置

jsonwang 3 年之前
父节点
当前提交
2e771bbf81
共有 1 个文件被更改,包括 3 次插入8 次删除
  1. 3 8
      BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenCameraManager.swift

+ 3 - 8
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenCameraManager.swift

@@ -482,17 +482,12 @@ class BFRecordScreenCameraManager: BFRecordScreenBaseManager {
 
 
                 return
                 return
             }
             }
-            
-           let ttsAudioAsset = AVURLAsset(url: URL(fileURLWithPath: mod.wavFilePath), options: avAssertOptions)
-            
-           let outTime =  ttsAudioAsset.duration.seconds - (mod.endCMTime - mod.startCMTime).seconds
+ 
             BFAudioPlayer.shared.delegate = self
             BFAudioPlayer.shared.delegate = self
             BFAudioPlayer.shared.configPlayer(audioPathURL: URL(fileURLWithPath: mod.wavFilePath))
             BFAudioPlayer.shared.configPlayer(audioPathURL: URL(fileURLWithPath: mod.wavFilePath))
-            //如果音频比原来的字幕时间要长,动态加速保证和字幕时长一致。 0.1多算一点音频时长,也就是让更快速度播放一些 XXXX
-            BFAudioPlayer.shared.player?.rate = Float(outTime > 0 ? (ttsAudioAsset.duration.seconds + 0.1) / (mod.endCMTime - mod.startCMTime).seconds : 1.0)
-            
+ 
             let tt = currentAssetProgress - mod.startCMTime
             let tt = currentAssetProgress - mod.startCMTime
-            BFLog(1, message: "record - tt: \(tt.seconds), curr:\(currentAssetProgress.seconds) \(needPlay) rate:\(BFAudioPlayer.shared.player?.rate  ?? -1) 音频比字幕显示时间长 :\(outTime) \(mod.wavFilePath ?? "")")
+            BFLog(1, message: "record - tt: \(tt.seconds), curr:\(currentAssetProgress.seconds) \(needPlay) rate:\(BFAudioPlayer.shared.player?.rate  ?? -1)   \(mod.wavFilePath ?? "")")
             if CMTimeCompare(tt, .zero) == 0 {
             if CMTimeCompare(tt, .zero) == 0 {
                 if needPlay {
                 if needPlay {
                     audioPlayerIsPlaying = true
                     audioPlayerIsPlaying = true