|
@@ -320,7 +320,7 @@ class BFRecordScreenCameraManager: BFRecordScreenBaseManager {
|
|
currentAssetProgress = videoS.1.timelineCMIn
|
|
currentAssetProgress = videoS.1.timelineCMIn
|
|
// 更新音频的时间点
|
|
// 更新音频的时间点
|
|
for model in item.voiceStickers {
|
|
for model in item.voiceStickers {
|
|
- if CMTimeCompare(currentAssetProgress, model.startCMTime) < 0 {
|
|
|
|
|
|
+ if CMTimeCompare(currentAssetProgress, model.startCMTime) <= 0 {
|
|
model.startCMTime = model.startCMTime - currDuration
|
|
model.startCMTime = model.startCMTime - currDuration
|
|
model.endCMTime = model.endCMTime - currDuration
|
|
model.endCMTime = model.endCMTime - currDuration
|
|
BFLog(1, message: "camera删除后更新voice time:\(model.startCMTime.seconds) ~ \(model.endCMTime.seconds)")
|
|
BFLog(1, message: "camera删除后更新voice time:\(model.startCMTime.seconds) ~ \(model.endCMTime.seconds)")
|
|
@@ -330,6 +330,14 @@ class BFRecordScreenCameraManager: BFRecordScreenBaseManager {
|
|
tm.timelineOut = tm.timelineOut - currDuration
|
|
tm.timelineOut = tm.timelineOut - currDuration
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ let vcList = recordItem!.voiceChangeStickers.filter { vc in
|
|
|
|
+ vc.recordId == model.recordId
|
|
|
|
+ }
|
|
|
|
+ for voice in vcList {
|
|
|
|
+ voice.startCMTime = voice.startCMTime - currDuration
|
|
|
|
+ voice.endCMTime = voice.endCMTime - currDuration
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 更新录像的时间点
|
|
// 更新录像的时间点
|
|
@@ -428,15 +436,15 @@ class BFRecordScreenCameraManager: BFRecordScreenBaseManager {
|
|
|
|
|
|
func playRecordVoice(needPlay: Bool = true) {
|
|
func playRecordVoice(needPlay: Bool = true) {
|
|
|
|
|
|
- // 三种状态值
|
|
|
|
|
|
+ // 三种状态值ff
|
|
// case paused = 0
|
|
// case paused = 0
|
|
// case waitingToPlayAtSpecifiedRate = 1
|
|
// case waitingToPlayAtSpecifiedRate = 1
|
|
// case playing = 2
|
|
// case playing = 2
|
|
if (BFAudioPlayer.shared.player?.isPlaying ?? false || audioPlayerIsPlaying){
|
|
if (BFAudioPlayer.shared.player?.isPlaying ?? false || audioPlayerIsPlaying){
|
|
- BFLog(2, message: "is playering 本次查找无效,有播放任务")
|
|
|
|
|
|
+// BFLog(2, message: "is playering 本次查找无效,有播放任务")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- BFLog(2,message: "开始查找!!!!当前进度:\(currentAssetProgress.seconds)")
|
|
|
|
|
|
+// BFLog(2,message: "开始查找!!!!当前进度:\(currentAssetProgress.seconds)")
|
|
|
|
|
|
// 播放音频
|
|
// 播放音频
|
|
var useVoiceStickers = [PQVoiceModel]()
|
|
var useVoiceStickers = [PQVoiceModel]()
|
|
@@ -480,9 +488,9 @@ class BFRecordScreenCameraManager: BFRecordScreenBaseManager {
|
|
let outTime = ttsAudioAsset.duration.seconds - (mod.endCMTime - mod.startCMTime).seconds
|
|
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))
|
|
-
|
|
|
|
//如果音频比原来的字幕时间要长,动态加速保证和字幕时长一致。
|
|
//如果音频比原来的字幕时间要长,动态加速保证和字幕时长一致。
|
|
BFAudioPlayer.shared.player?.rate = Float(outTime > 0 ? ttsAudioAsset.duration.seconds / (mod.endCMTime - mod.startCMTime).seconds : 1.0)
|
|
BFAudioPlayer.shared.player?.rate = Float(outTime > 0 ? ttsAudioAsset.duration.seconds / (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) 音频比字幕显示时间长 :\(outTime) \(mod.wavFilePath ?? "")")
|