|
@@ -142,7 +142,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}()
|
|
|
|
|
|
lazy var playBtn: UIButton = {
|
|
|
- let btn = UIButton(frame: CGRect.init(x: 0, y: 0, width: 150, height: 156))
|
|
|
+ let btn = UIButton(frame: CGRect(x: 0, y: 0, width: 150, height: 156))
|
|
|
btn.setImage(imageInRecordScreenKit(by: "preview_play"), for: .normal)
|
|
|
let vv = UIView(frame: CGRect(x: 0, y: 0, width: 1, height: 1))
|
|
|
btn.setImage(vv.graphicsGetImage(), for: .selected)
|
|
@@ -370,6 +370,26 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
return collectionView
|
|
|
}()
|
|
|
+
|
|
|
+ //debug
|
|
|
+ lazy var neoNuiDebugLabel: UILabel = {
|
|
|
+ let neoNuiDebugLabel = UILabel.init(frame: CGRect.init(x: 0, y: 100, width: 200, height: 24))
|
|
|
+ neoNuiDebugLabel.backgroundColor = .black
|
|
|
+ neoNuiDebugLabel.textColor = .white
|
|
|
+ neoNuiDebugLabel.textAlignment = .left
|
|
|
+ return neoNuiDebugLabel
|
|
|
+
|
|
|
+ }()
|
|
|
+ lazy var audioQueueRecoderLabel: UILabel = {
|
|
|
+ let audioQueueRecoderLabel = UILabel.init(frame: CGRect.init(x: 0, y: 125, width: 200, height: 24))
|
|
|
+ audioQueueRecoderLabel.backgroundColor = .black
|
|
|
+ audioQueueRecoderLabel.textColor = .white
|
|
|
+ audioQueueRecoderLabel.textAlignment = .left
|
|
|
+ return audioQueueRecoderLabel
|
|
|
+
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
|
|
|
// MARK: - ----------------- 生命周期
|
|
|
|
|
@@ -413,9 +433,9 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
// 录音进度
|
|
|
recorderManager?.recorderProgrossHandle = { [weak self] progress in
|
|
|
- BFLog(1, message: "curr:录音进度--\(progress) \(self?.recordStartTime ?? 0) \(self?.isRecording ?? false)")
|
|
|
-
|
|
|
+ BFLog(1, message: "curr:录音进度--\(progress ?? 0.0) \(self?.recordStartTime ?? 0) \(self?.isRecording ?? false)")
|
|
|
self?.drawProgressIndication(progress: (progress.isNaN || progress.isInfinite) ? progress : 0)
|
|
|
+ self?.drawProgressIndication(progress: progress ?? 0)
|
|
|
}
|
|
|
|
|
|
// 录音字幕回调
|
|
@@ -514,7 +534,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
if deletedVoices.count == 0 {
|
|
|
self?.indirectionView?.resetCurrentItem(start: model.startTime, end: model.endTime)
|
|
|
} else {
|
|
|
- self?.indirectionView?.resetAllSubViews(items: recordItem.voiceStickers, percenWidth: recordItem.mediaType == .IMAGE ? (self?.progressThumV.thumbImageWidth ?? 0) / 2.0 : 0, totalDuration: recordItem.materialDuraion)
|
|
|
+ /// 重绘录音进度视图
|
|
|
+ self?.resetAllIndirectionView()
|
|
|
}
|
|
|
// 矫正进度
|
|
|
self?.resetCurrentProgress()
|
|
@@ -550,12 +571,22 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
// 移除
|
|
|
self?.indirectionView?.deleteItem(isCurrent: true)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ recorderManager?.NeoNuiDebugHandle = { [weak self] msg in
|
|
|
+ self?.neoNuiDebugLabel.text = "录音机:\(msg ?? "")"
|
|
|
+ }
|
|
|
+
|
|
|
+ recorderManager?.AudioQueueRecoderDebugHandle = { [weak self] msg in
|
|
|
+ self?.audioQueueRecoderLabel.text = "字幕服务:\(msg ?? "")"
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
view.backgroundColor = .black
|
|
|
view.addSubview(collectionView)
|
|
|
// playView = GPUImageView(frame: view.bounds)
|
|
|
// view.addSubview(playView!)
|
|
|
fetchVideo()
|
|
|
+ view.addSubview(subtitleLabel)
|
|
|
view.addSubview(playBtn)
|
|
|
view.addSubview(bottomeView)
|
|
|
view.addSubview(avatarView)
|
|
@@ -564,7 +595,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
view.addSubview(subtitleBtn)
|
|
|
view.addSubview(soundSettingBtn)
|
|
|
view.addSubview(subtitleSettingView)
|
|
|
- view.addSubview(subtitleLabel)
|
|
|
+
|
|
|
|
|
|
view.addSubview(audioSettingView)
|
|
|
|
|
@@ -614,6 +645,11 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
if !SWNetRequest.isNetReachabled() {
|
|
|
cShowHUB(superView: view, msg: "网络不佳,字幕可能无法生成")
|
|
|
}
|
|
|
+
|
|
|
+ view.addSubview(neoNuiDebugLabel)
|
|
|
+ view.addSubview(audioQueueRecoderLabel)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@objc func editSubtitle() {
|
|
@@ -837,7 +873,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
// 从原数组中删除
|
|
|
let arr = itemModels[currItemModelIndex].titleStickers.filter { model in
|
|
|
- return !deleteTemp.contains { tuple in
|
|
|
+ !deleteTemp.contains { tuple in
|
|
|
tuple.0.audioFilePath == model.audioFilePath
|
|
|
}
|
|
|
}
|
|
@@ -866,23 +902,19 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
for (index, item) in itemModels[currItemModelIndex].voiceStickers.enumerated() {
|
|
|
if index >= isStopAtRecordRange {
|
|
|
// 注:开始时间减去duration or 等一前一段录音的结束时间
|
|
|
- // item.startTime = item.startTime - currDuration
|
|
|
-// item.startTime = itemModels[currItemModelIndex].voiceStickers[index - 1].endTime
|
|
|
-// item.endTime = item.startTime + (Double(item.duration ?? "0") ?? 0)
|
|
|
item.startTime -= currDuration
|
|
|
item.endTime -= currDuration
|
|
|
}
|
|
|
}
|
|
|
- // 重绘录音进度视图
|
|
|
- indirectionView?.resetAllSubViews(items: itemModels[currItemModelIndex].voiceStickers, percenWidth: progressThumV.thumbImageWidth / 2.0, totalDuration: itemModels[currItemModelIndex].materialDuraion)
|
|
|
+ /// 重绘录音进度视图
|
|
|
+ resetAllIndirectionView()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
var event = WithDrawModel(type: 3, timestamp: currentAssetProgress.seconds, deletedVoices: [(model, isStopAtRecordRange)])
|
|
|
event.deletedTittles = deleteTitles(voiceModel: model)
|
|
|
events.append(event)
|
|
|
|
|
|
searchStopAtRecordRange()
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1046,10 +1078,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
searchStopAtRecordRange()
|
|
|
let itemModel = itemModels[currItemModelIndex]
|
|
|
-
|
|
|
- // 重置进度条
|
|
|
- indirectionView?.resetAllSubViews(items: itemModels[currItemModelIndex].voiceStickers, percenWidth: itemModels[currItemModelIndex].mediaType == .IMAGE ? progressThumV.thumbImageWidth / 2.0 : 0, totalDuration: itemModels[currItemModelIndex].materialDuraion)
|
|
|
-
|
|
|
+ /// 重绘录音进度视图
|
|
|
+ resetAllIndirectionView()
|
|
|
// 如果是图片需重置播放按钮
|
|
|
if itemModel.mediaType == .IMAGE {
|
|
|
playBtn.isSelected = itemModels[currItemModelIndex].voiceStickers.count <= 0
|
|
@@ -1740,13 +1770,8 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
|
|
|
// 重绘录音区域
|
|
|
progressThumV.recordItem = recordItem
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
|
|
|
- var percenWidth: CGFloat = 0
|
|
|
- if recordItem.mediaType == .IMAGE {
|
|
|
- percenWidth = (self?.progressThumV.thumbImageWidth ?? 0) / 2.0
|
|
|
- } else {
|
|
|
- percenWidth = (self?.progressThumV.progessIndicateBackV.frame.width ?? 0) / CGFloat(recordItem.materialDuraion)
|
|
|
- }
|
|
|
- self?.indirectionView?.resetAllSubViews(items: recordItem.voiceStickers, percenWidth: percenWidth, totalDuration: recordItem.materialDuraion)
|
|
|
+ /// 重绘录音进度视图
|
|
|
+ self?.resetAllIndirectionView()
|
|
|
}
|
|
|
// 更新缩略图
|
|
|
progressThumV.isHidden = false
|
|
@@ -1851,4 +1876,16 @@ public extension BFRecordScreenController {
|
|
|
self?.updateSubtitle(time: self?.currentAssetProgress ?? CMTime.zero)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// 重绘录音进度视图
|
|
|
+ func resetAllIndirectionView() {
|
|
|
+ // 重绘录音进度视图
|
|
|
+ var percenWidth: CGFloat = 0
|
|
|
+ if itemModels[currItemModelIndex].mediaType == .IMAGE {
|
|
|
+ percenWidth = progressThumV.thumbImageWidth / 2.0
|
|
|
+ } else {
|
|
|
+ percenWidth = progressThumV.progessIndicateBackV.frame.width / CGFloat(itemModels[currItemModelIndex].materialDuraion)
|
|
|
+ }
|
|
|
+ indirectionView?.resetAllSubViews(items: itemModels[currItemModelIndex].voiceStickers, percenWidth: percenWidth, totalDuration: itemModels[currItemModelIndex].materialDuraion)
|
|
|
+ }
|
|
|
}
|