|
@@ -490,26 +490,27 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
BFLog(message: "识别结果为空????不能生成字幕数据")
|
|
|
return
|
|
|
}
|
|
|
- if eventCode == 2 || eventCode == 26 {
|
|
|
+ if eventCode == 26 {
|
|
|
self?.currentRecordId = nil
|
|
|
}
|
|
|
if eventCode == 0 {
|
|
|
self?.currentRecordId = recordId
|
|
|
}
|
|
|
// 只有为24时才有字幕返回
|
|
|
- if eventCode != 24 {
|
|
|
+ if eventCode != 24 || recordId == nil{
|
|
|
return
|
|
|
}
|
|
|
- DispatchQueue.global().async {
|
|
|
+ DispatchQueue.global().async { [weak self] in
|
|
|
let dicResult: [String: Any]? = jsonStringToDictionary(asrResult!)
|
|
|
let header = dicResult?["header"] as? [String: Any]
|
|
|
let payload = dicResult?["payload"] as? [String: Any]
|
|
|
- BFLog(1, message: "识别结果:) \(payload?["result"] ?? "") ,taskId:\((header?["task_id"] as? String) ?? "taskId"), 识别时间:\(((payload?["begin_time"]) as? Int) ?? 0) ~ \(((payload?["time"]) as? Int) ?? 0) startTime:\(self?.recorderManager?.voiceModel?.startCMTime.seconds ?? 0.0)")
|
|
|
+ BFLog(1, message: "onNuiEventCallback event 识别结果:) \(payload?["result"] ?? "") ,taskId:\((header?["task_id"] as? String) ?? "taskId"), 识别时间:\(((payload?["begin_time"]) as? Int) ?? 0) ~ \(((payload?["time"]) as? Int) ?? 0) startTime:\(self?.recorderManager?.voiceModel?.startCMTime.seconds ?? 0.0)")
|
|
|
// 1,保存字幕数据 begin_time是开始出现文字的时间,time 是结束文字出现的时间 单位都为毫秒,都是相对于录制音频数据整段时间。self.recorderManager.voiceModel?.startCMTime.seconds 为开始的录制的时间,开始和结束都要加上这个时差
|
|
|
|
|
|
let newSubtitle = PQEditSubTitleModel()
|
|
|
// 任务全局唯一ID,请记录该值,便于排查问题。 每次 startRecorder 和 stopRecoder 之间 task_Id都不会变化
|
|
|
let taskID = header?["task_id"] as? String
|
|
|
+
|
|
|
newSubtitle.taskID = taskID ?? ""
|
|
|
newSubtitle.recordId = self?.currentRecordId
|
|
|
BFLog(1, message: "对应关系:字幕所属地址:taskID:\(taskID ?? ""),\((audioFilePath ?? "b").replacingOccurrences(of: documensDirectory, with: "")), 开始录音输入:\((self?.recorderManager?.voiceModel?.wavFilePath ?? "aa").replacingOccurrences(of: documensDirectory, with: ""))")
|
|
@@ -520,7 +521,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
self?.itemModels.enumerated().forEach { index, item in
|
|
|
if tempVoice == nil {
|
|
|
tempVoice = item.voiceStickers.first { voice in
|
|
|
- voice.recordId == self?.currentRecordId
|
|
|
+ voice.recordId == recordId
|
|
|
}
|
|
|
if tempVoice != nil {
|
|
|
tempItem = item
|
|
@@ -1373,7 +1374,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
hadPrepareToPlayRecord = false
|
|
|
BFLog(1, message: "isDragingProgressSlder : \(isDragingProgressSlder)")
|
|
|
BFLog(3, message: "重置播放index-\(#function) = \(currentPlayRecordIndex)")
|
|
|
- searchStopAtRecordRange(needAdsorb: true)
|
|
|
+ searchStopAtRecordRange()
|
|
|
changeWithDrawBtnLayout(0)
|
|
|
isEndPlay = (progress == 1)
|
|
|
recorderManager?.voiceModel = nil
|