Procházet zdrojové kódy

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

harry před 3 roky
rodič
revize
7397bae41b

+ 4 - 5
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenCameraManager.swift

@@ -458,11 +458,11 @@ class BFRecordScreenCameraManager: BFRecordScreenBaseManager {
             CMTimeCompare(m.startCMTime, currentAssetProgress) <= 0 && CMTimeCompare(m.endCMTime, currentAssetProgress) > 0
 
         }) {
-            BFLog(message: "找到音频开始时间:\(mod.startCMTime.seconds)结束 \(mod.endCMTime.seconds) currentAssetProgress is \(currentAssetProgress.seconds)")
+            BFLog(message: "找到音频开始时间:\(mod.startCMTime.seconds)结束 \(mod.endCMTime.seconds) currentAssetProgress is \(currentAssetProgress.seconds) wavFilePath:\(mod.wavFilePath ?? "")")
 
             // 当前播放的文件
             if playingVoiceMode == mod {
-                BFLog(2,message: "找查到mod的已经播放完成同一个")
+                BFLog(2,message: "找查到mod的已经播放完成同一个 wavFilePath:\(mod.wavFilePath ?? "")")
                 return
             }
             playingVoiceMode = mod
@@ -488,9 +488,8 @@ class BFRecordScreenCameraManager: BFRecordScreenBaseManager {
            let outTime =  ttsAudioAsset.duration.seconds - (mod.endCMTime - mod.startCMTime).seconds
             BFAudioPlayer.shared.delegate = self
             BFAudioPlayer.shared.configPlayer(audioPathURL: URL(fileURLWithPath: mod.wavFilePath))
-            //如果音频比原来的字幕时间要长,动态加速保证和字幕时长一致。
-            BFAudioPlayer.shared.player?.rate = Float(outTime > 0 ? ttsAudioAsset.duration.seconds / (mod.endCMTime - mod.startCMTime).seconds : 1.0)
- 
+            //如果音频比原来的字幕时间要长,动态加速保证和字幕时长一致。 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
             BFLog(1, message: "record - tt: \(tt.seconds), curr:\(currentAssetProgress.seconds) \(needPlay) rate:\(BFAudioPlayer.shared.player?.rate  ?? -1) 音频比字幕显示时间长 :\(outTime) \(mod.wavFilePath ?? "")")

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

@@ -2846,12 +2846,8 @@ extension BFRecordScreenController: BFTTSManagerDelegte{
             temp.recordId == model.recordId
         }
         //第一次录制返回后是voiceStickers为空的也要加入
-        if(itemModels[Int(model.itemModelIndex)].voiceStickers.count == 0){
-            itemModels[Int(model.itemModelIndex)].voiceChangeStickers.append(voice)
-            
-        }else if(itemModels[Int(model.itemModelIndex)].voiceStickers.count > 0 && findRecordId != nil){
-            itemModels[Int(model.itemModelIndex)].voiceChangeStickers.append(voice)
-        }
+        itemModels[Int(model.itemModelIndex)].voiceChangeStickers.append(voice)
+        
      
         //显示当前段的转换进度isExportAction
         var  progress:Float = 0.0