|
@@ -169,7 +169,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
var currentAssetProgress: CMTime = .zero
|
|
|
{
|
|
|
didSet {
|
|
|
- BFLog(1, message: "currentAssetProgress=\(currentAssetProgress.seconds)")
|
|
|
+// BFLog(1, message: "currentAssetProgress=\(currentAssetProgress.seconds)")
|
|
|
rscurrentManager.currentAssetProgress = currentAssetProgress
|
|
|
}
|
|
|
} // 当前素材播放的进度
|
|
@@ -636,16 +636,85 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // MARK: - 录音机初始化
|
|
|
+ func layoutsubview() {
|
|
|
+ bottomeView.snp.makeConstraints { make in
|
|
|
+ make.left.bottom.right.equalToSuperview()
|
|
|
+ make.height.equalTo(adapterWidth(width: 180))
|
|
|
+ }
|
|
|
+
|
|
|
+ progreddL.snp.makeConstraints { make in
|
|
|
+ make.width.equalTo(100)
|
|
|
+ make.centerX.equalToSuperview()
|
|
|
+ make.top.equalToSuperview().offset(-5)
|
|
|
+ make.height.equalTo(18)
|
|
|
+ }
|
|
|
+
|
|
|
+ withDrawBtn.snp.makeConstraints { make in
|
|
|
+ make.left.equalToSuperview()
|
|
|
+ make.width.height.equalTo(65)
|
|
|
+ make.top.equalTo(88)
|
|
|
+ }
|
|
|
+ // changeVoiceBtn.snp.makeConstraints { make in
|
|
|
+ // make.right.equalToSuperview()
|
|
|
+ // make.top.width.height.equalTo(withDrawBtn)
|
|
|
+ // }
|
|
|
+
|
|
|
+ recordBtn.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(withDrawBtn.snp.right)
|
|
|
+ make.right.equalTo(-65)
|
|
|
+ make.height.equalTo(42)
|
|
|
+ make.top.equalTo(withDrawBtn).offset(6)
|
|
|
+ }
|
|
|
+ deleteRecordBtn.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(withDrawBtn.snp.right)
|
|
|
+ make.right.equalTo(-65)
|
|
|
+ make.height.equalTo(42)
|
|
|
+ make.top.equalTo(withDrawBtn).offset(6)
|
|
|
+ }
|
|
|
+
|
|
|
+ // openCameraBtn.snp.makeConstraints { make in
|
|
|
+ // make.right.equalToSuperview().offset(-12)
|
|
|
+ // make.top.equalToSuperview().offset(98)
|
|
|
+ // make.width.equalTo(80)
|
|
|
+ // make.height.equalTo(124)
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // drawPinBtn.snp.makeConstraints { make in
|
|
|
+ // make.right.equalTo(openCameraBtn)
|
|
|
+ // make.top.equalTo(openCameraBtn.snp.bottom).offset(18)
|
|
|
+ // make.width.equalTo(80)
|
|
|
+ // make.height.equalTo(124)
|
|
|
+ // }
|
|
|
+
|
|
|
+ soundSettingBtn.snp.makeConstraints { make in
|
|
|
+ make.right.equalToSuperview().offset(-12)
|
|
|
+ make.top.equalToSuperview().offset(98)
|
|
|
+ make.width.equalTo(40)
|
|
|
+ make.height.equalTo(62)
|
|
|
+ }
|
|
|
+
|
|
|
+ subtitleBtn.snp.makeConstraints { make in
|
|
|
+ make.right.equalTo(soundSettingBtn)
|
|
|
+ make.top.equalTo(soundSettingBtn.snp.bottom).offset(18)
|
|
|
+ make.width.equalTo(40)
|
|
|
+ make.height.equalTo(62)
|
|
|
+ }
|
|
|
+
|
|
|
+ withDrawBtn.imageEdgeInsets = UIEdgeInsets(top: -withDrawBtn.imageView!.height, left: 0, bottom: 0, right: -withDrawBtn.titleLabel!.width)
|
|
|
+ withDrawBtn.titleEdgeInsets = UIEdgeInsets(top: withDrawBtn.titleLabel!.height + 2, left: -withDrawBtn.imageView!.width, bottom: 0, right: 0)
|
|
|
+
|
|
|
+ changeVoiceBtn.imageEdgeInsets = UIEdgeInsets(top: -changeVoiceBtn.imageView!.height - 2, left: 0, bottom: 0, right: -changeVoiceBtn.titleLabel!.width)
|
|
|
+ changeVoiceBtn.titleEdgeInsets = UIEdgeInsets(top: changeVoiceBtn.titleLabel!.height + 2, left: -changeVoiceBtn.imageView!.width, bottom: 0, right: 0)
|
|
|
+ }
|
|
|
+ // MARK: - 录音机字幕回调相关
|
|
|
func initlizeRecordManager() {
|
|
|
recorderManager = BFVoiceRecordManager()
|
|
|
// 录音进度
|
|
|
recorderManager?.recorderProgrossHandle = { [weak self] progress in
|
|
|
-// BFLog(1, message: "curr:录音进度--\(progress),\(self?.isRecording ?? false)")
|
|
|
self?.drawProgressIndication(progress: (progress.isNaN || progress.isInfinite) ? 0 : progress)
|
|
|
}
|
|
|
|
|
|
- // 录音字幕回调
|
|
|
+ // MARK: 录音字幕回调
|
|
|
recorderManager?.subtitleRecordHandle = { [weak self] eventCode, recordId, asrResult, audioFilePath, _ in
|
|
|
// BFLog(1, message: "eventcode:\(eventCode), recordid:\(String(describing: recordId)), asr:\(String(describing: asrResult))")
|
|
|
|
|
@@ -715,7 +784,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // MARK: - 录音结束
|
|
|
+ // MARK: 录音结束
|
|
|
recorderManager?.endRecordHandle = { [weak self, weak recorderManager] voideModel, _ in
|
|
|
if let wself = self, let model = voideModel, FileManager.default.fileExists(atPath: model.wavFilePath ?? "") {
|
|
|
// 加入到语音数组里
|
|
@@ -807,7 +876,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
// 矫正进度
|
|
|
self?.resetCurrentProgress()
|
|
|
self?.deleteRecordBtn.isHidden = true
|
|
|
- self?.recordBtn.isHidden = (self?.itemModels[self?.currItemModelIndex ?? 0].mediaType == .Image && (self?.isEndPlay ?? false)) ? false : (self?.isEndPlay ?? false)
|
|
|
+ self?.recordBtn.isHidden = (self?.itemModels[self?.currItemModelIndex ?? 0].mediaType != .Video && (self?.isEndPlay ?? false)) ? false : (self?.isEndPlay ?? false)
|
|
|
}
|
|
|
wself.currentPlayRecordIndex = -3 // 刚录音完,不需要播放录音
|
|
|
BFLog(3, message: "重置播放index-\(#function) = \(wself.currentPlayRecordIndex)")
|
|
@@ -929,77 +998,6 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func layoutsubview() {
|
|
|
- bottomeView.snp.makeConstraints { make in
|
|
|
- make.left.bottom.right.equalToSuperview()
|
|
|
- make.height.equalTo(adapterWidth(width: 180))
|
|
|
- }
|
|
|
-
|
|
|
- progreddL.snp.makeConstraints { make in
|
|
|
- make.width.equalTo(100)
|
|
|
- make.centerX.equalToSuperview()
|
|
|
- make.top.equalToSuperview().offset(-5)
|
|
|
- make.height.equalTo(18)
|
|
|
- }
|
|
|
-
|
|
|
- withDrawBtn.snp.makeConstraints { make in
|
|
|
- make.left.equalToSuperview()
|
|
|
- make.width.height.equalTo(65)
|
|
|
- make.top.equalTo(88)
|
|
|
- }
|
|
|
- // changeVoiceBtn.snp.makeConstraints { make in
|
|
|
- // make.right.equalToSuperview()
|
|
|
- // make.top.width.height.equalTo(withDrawBtn)
|
|
|
- // }
|
|
|
-
|
|
|
- recordBtn.snp.makeConstraints { make in
|
|
|
- make.left.equalTo(withDrawBtn.snp.right)
|
|
|
- make.right.equalTo(-65)
|
|
|
- make.height.equalTo(42)
|
|
|
- make.top.equalTo(withDrawBtn).offset(6)
|
|
|
- }
|
|
|
- deleteRecordBtn.snp.makeConstraints { make in
|
|
|
- make.left.equalTo(withDrawBtn.snp.right)
|
|
|
- make.right.equalTo(-65)
|
|
|
- make.height.equalTo(42)
|
|
|
- make.top.equalTo(withDrawBtn).offset(6)
|
|
|
- }
|
|
|
-
|
|
|
- // openCameraBtn.snp.makeConstraints { make in
|
|
|
- // make.right.equalToSuperview().offset(-12)
|
|
|
- // make.top.equalToSuperview().offset(98)
|
|
|
- // make.width.equalTo(80)
|
|
|
- // make.height.equalTo(124)
|
|
|
- // }
|
|
|
- //
|
|
|
- // drawPinBtn.snp.makeConstraints { make in
|
|
|
- // make.right.equalTo(openCameraBtn)
|
|
|
- // make.top.equalTo(openCameraBtn.snp.bottom).offset(18)
|
|
|
- // make.width.equalTo(80)
|
|
|
- // make.height.equalTo(124)
|
|
|
- // }
|
|
|
-
|
|
|
- soundSettingBtn.snp.makeConstraints { make in
|
|
|
- make.right.equalToSuperview().offset(-12)
|
|
|
- make.top.equalToSuperview().offset(98)
|
|
|
- make.width.equalTo(40)
|
|
|
- make.height.equalTo(62)
|
|
|
- }
|
|
|
-
|
|
|
- subtitleBtn.snp.makeConstraints { make in
|
|
|
- make.right.equalTo(soundSettingBtn)
|
|
|
- make.top.equalTo(soundSettingBtn.snp.bottom).offset(18)
|
|
|
- make.width.equalTo(40)
|
|
|
- make.height.equalTo(62)
|
|
|
- }
|
|
|
-
|
|
|
- withDrawBtn.imageEdgeInsets = UIEdgeInsets(top: -withDrawBtn.imageView!.height, left: 0, bottom: 0, right: -withDrawBtn.titleLabel!.width)
|
|
|
- withDrawBtn.titleEdgeInsets = UIEdgeInsets(top: withDrawBtn.titleLabel!.height + 2, left: -withDrawBtn.imageView!.width, bottom: 0, right: 0)
|
|
|
-
|
|
|
- changeVoiceBtn.imageEdgeInsets = UIEdgeInsets(top: -changeVoiceBtn.imageView!.height - 2, left: 0, bottom: 0, right: -changeVoiceBtn.titleLabel!.width)
|
|
|
- changeVoiceBtn.titleEdgeInsets = UIEdgeInsets(top: changeVoiceBtn.titleLabel!.height + 2, left: -changeVoiceBtn.imageView!.width, bottom: 0, right: 0)
|
|
|
- }
|
|
|
-
|
|
|
// public override func viewWillLayoutSubviews() {
|
|
|
// super.viewWillLayoutSubviews()
|
|
|
//
|
|
@@ -1569,7 +1567,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
recordBtn.alpha = 1
|
|
|
|
|
|
isStopAtRecordRange = -1
|
|
|
- BFLog(1, message: "停在了录音区间外 \(isStopAtRecordRange)")
|
|
|
+ BFLog(1, message: "停在了录音区间外 \(isStopAtRecordRange), currTime:\(currentAssetProgress.seconds)")
|
|
|
}
|
|
|
pauseTime = currentAssetProgress.seconds
|
|
|
}
|