|
@@ -492,7 +492,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
let header = dicResult?["header"] as? [String: Any]
|
|
let header = dicResult?["header"] as? [String: Any]
|
|
let payload = dicResult?["payload"] 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: "识别结果:) \(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)")
|
|
|
|
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
// 1,保存字幕数据 begin_time是开始出现文字的时间,time 是结束文字出现的时间 单位都为毫秒,都是相对于录制音频数据整段时间。self.recorderManager.voiceModel?.startCMTime.seconds 为开始的录制的时间,开始和结束都要加上这个时差
|
|
// 1,保存字幕数据 begin_time是开始出现文字的时间,time 是结束文字出现的时间 单位都为毫秒,都是相对于录制音频数据整段时间。self.recorderManager.voiceModel?.startCMTime.seconds 为开始的录制的时间,开始和结束都要加上这个时差
|
|
@@ -529,14 +529,9 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- var showText = ((payload?["result"]) as? String) ?? ""
|
|
|
|
- if showText.count > subtitleMaxlength {
|
|
|
|
- showText = showText.substring(to: subtitleMaxlength)
|
|
|
|
- showText += "..."
|
|
|
|
- }
|
|
|
|
|
|
+ let showText = ((payload?["result"]) as? String) ?? ""
|
|
newSubtitle.text = showText
|
|
newSubtitle.text = showText
|
|
// newSubtitle.audioFilePath = audioFilePath ?? ""
|
|
// newSubtitle.audioFilePath = audioFilePath ?? ""
|
|
-
|
|
|
|
BFLog(1, message: "添加字幕数据 timelineIn \(newSubtitle.timelineIn.seconds) timelineOut \(newSubtitle.timelineOut.seconds) text: \(newSubtitle.text) 音频路径为:\(audioFilePath ?? "bb") 传入的地址:\(self?.recorderManager?.voiceModel?.wavFilePath ?? "aa")")
|
|
BFLog(1, message: "添加字幕数据 timelineIn \(newSubtitle.timelineIn.seconds) timelineOut \(newSubtitle.timelineOut.seconds) text: \(newSubtitle.text) 音频路径为:\(audioFilePath ?? "bb") 传入的地址:\(self?.recorderManager?.voiceModel?.wavFilePath ?? "aa")")
|
|
|
|
|
|
newSubtitle.setting = self?.subtitleSettingView.subtitle.setting ?? BFSubTitileSettingModel()
|
|
newSubtitle.setting = self?.subtitleSettingView.subtitle.setting ?? BFSubTitileSettingModel()
|
|
@@ -696,10 +691,6 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
}
|
|
}
|
|
// 编辑字幕完成
|
|
// 编辑字幕完成
|
|
subtitleEditView.editSubtitleDone = { [weak self] newtext, index in
|
|
subtitleEditView.editSubtitleDone = { [weak self] newtext, index in
|
|
- // 1,刷新 UI
|
|
|
|
- self?.subtitleLabel.text = newtext
|
|
|
|
-
|
|
|
|
- self?.setSubtitleStyle(settingModel: (self?.subtitleSettingView.subtitle.setting)!)
|
|
|
|
|
|
|
|
// 更新缓存数据
|
|
// 更新缓存数据
|
|
if index < (self?.itemModels[self?.currItemModelIndex ?? 0].titleStickers.count ?? 0) {
|
|
if index < (self?.itemModels[self?.currItemModelIndex ?? 0].titleStickers.count ?? 0) {
|
|
@@ -712,6 +703,10 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
self?.itemModels[self?.currItemModelIndex ?? 0].titleStickers[index].text = newtext
|
|
self?.itemModels[self?.currItemModelIndex ?? 0].titleStickers[index].text = newtext
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ self?.setSubtitleStyle(settingModel: (self?.subtitleSettingView.subtitle.setting)!)
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
layoutsubview()
|
|
layoutsubview()
|
|
@@ -722,8 +717,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
cShowHUB(superView: view, msg: "网络不佳,字幕可能无法生成")
|
|
cShowHUB(superView: view, msg: "网络不佳,字幕可能无法生成")
|
|
}
|
|
}
|
|
|
|
|
|
-// view.addSubview(neoNuiDebugLabel)
|
|
|
|
-// view.addSubview(audioQueueRecoderLabel)
|
|
|
|
|
|
+ view.addSubview(neoNuiDebugLabel)
|
|
|
|
+ view.addSubview(audioQueueRecoderLabel)
|
|
}
|
|
}
|
|
|
|
|
|
@objc func editSubtitle() {
|
|
@objc func editSubtitle() {
|