|
@@ -135,7 +135,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
l.font = UIFont.systemFont(ofSize: 13)
|
|
l.font = UIFont.systemFont(ofSize: 13)
|
|
l.textColor = .white
|
|
l.textColor = .white
|
|
l.shadowColor = .black
|
|
l.shadowColor = .black
|
|
- l.shadowOffset = CGSize(width: 1, height: 1)
|
|
|
|
|
|
+ l.shadowOffset = CGSize(width: 0, height: 1)
|
|
l.text = "00:00"
|
|
l.text = "00:00"
|
|
return l
|
|
return l
|
|
}()
|
|
}()
|
|
@@ -170,6 +170,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
btn.backgroundColor = ThemeStyleColor
|
|
btn.backgroundColor = ThemeStyleColor
|
|
btn.setTitle("按住 录音", for: .normal)
|
|
btn.setTitle("按住 录音", for: .normal)
|
|
btn.addCorner(corner: 6)
|
|
btn.addCorner(corner: 6)
|
|
|
|
+ btn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
|
|
btn.adjustsImageWhenHighlighted = false
|
|
btn.adjustsImageWhenHighlighted = false
|
|
btn.addTarget(self, action: #selector(startRecord), for: .touchDown)
|
|
btn.addTarget(self, action: #selector(startRecord), for: .touchDown)
|
|
btn.addTarget(self, action: #selector(endRecord), for: .touchUpInside)
|
|
btn.addTarget(self, action: #selector(endRecord), for: .touchUpInside)
|
|
@@ -179,9 +180,11 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
lazy var deleteRecordBtn: UIButton = {
|
|
lazy var deleteRecordBtn: UIButton = {
|
|
let btn = UIButton(type: .custom)
|
|
let btn = UIButton(type: .custom)
|
|
- btn.backgroundColor = .red
|
|
|
|
|
|
+
|
|
|
|
+ btn.backgroundColor = UIColor.hexColor(hexadecimal: "#FF0000", alpha: 1)
|
|
btn.setTitle("删除录制", for: .normal)
|
|
btn.setTitle("删除录制", for: .normal)
|
|
btn.adjustsImageWhenHighlighted = false
|
|
btn.adjustsImageWhenHighlighted = false
|
|
|
|
+ btn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
|
|
btn.addCorner(corner: 6)
|
|
btn.addCorner(corner: 6)
|
|
btn.addTarget(self, action: #selector(deleteRecordAction), for: .touchUpInside)
|
|
btn.addTarget(self, action: #selector(deleteRecordAction), for: .touchUpInside)
|
|
btn.isHidden = true
|
|
btn.isHidden = true
|
|
@@ -257,7 +260,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
// 字幕设置
|
|
// 字幕设置
|
|
lazy var subtitleBtn: UIButton = {
|
|
lazy var subtitleBtn: UIButton = {
|
|
let btn = UIButton(type: .custom)
|
|
let btn = UIButton(type: .custom)
|
|
- btn.setImage(imageInRecordScreenKit(by: "subtitleBtn"), for: .normal)
|
|
|
|
|
|
+ btn.setImage(imageInRecordScreenKit(by: "subtitleBtn_on"), for: .normal)
|
|
btn.addTarget(self, action: #selector(subTitleClick), for: .touchUpInside)
|
|
btn.addTarget(self, action: #selector(subTitleClick), for: .touchUpInside)
|
|
return btn
|
|
return btn
|
|
}()
|
|
}()
|
|
@@ -644,9 +647,10 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
BFLog(message: "新录制完成::::\(materialsModel?.locationPath ?? "")")
|
|
BFLog(message: "新录制完成::::\(materialsModel?.locationPath ?? "")")
|
|
}
|
|
}
|
|
|
|
|
|
- // 字幕设置回调
|
|
|
|
|
|
+
|
|
// 设置默认值
|
|
// 设置默认值
|
|
setSubtitleStyle(settingModel: subtitleSettingView.subtitle.setting)
|
|
setSubtitleStyle(settingModel: subtitleSettingView.subtitle.setting)
|
|
|
|
+ // 字幕设置回调
|
|
subtitleSettingView.subtitleSettingCallBack = { [weak self] subtitileModel in
|
|
subtitleSettingView.subtitleSettingCallBack = { [weak self] subtitileModel in
|
|
|
|
|
|
self?.setSubtitleStyle(settingModel: subtitileModel.setting)
|
|
self?.setSubtitleStyle(settingModel: subtitileModel.setting)
|
|
@@ -698,7 +702,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
/// - Parameter time: 当前播放的进度
|
|
/// - Parameter time: 当前播放的进度
|
|
func updateSubtitle(time: CMTime) {
|
|
func updateSubtitle(time: CMTime) {
|
|
BFLog(message: "currTime is \(CMTimeGetSeconds(time))")
|
|
BFLog(message: "currTime is \(CMTimeGetSeconds(time))")
|
|
- if isRecording {
|
|
|
|
|
|
+ if isRecording || !subtitleSettingView.subtitle.setting.subtitleIsShow{
|
|
return
|
|
return
|
|
}
|
|
}
|
|
var findShowSubtitle: PQEditSubTitleModel?
|
|
var findShowSubtitle: PQEditSubTitleModel?
|
|
@@ -723,6 +727,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
/// 设置字幕样式和位置
|
|
/// 设置字幕样式和位置
|
|
/// - Parameter settingModel: 样式model
|
|
/// - Parameter settingModel: 样式model
|
|
func setSubtitleStyle(settingModel: BFSubTitileSettingModel) {
|
|
func setSubtitleStyle(settingModel: BFSubTitileSettingModel) {
|
|
|
|
+
|
|
|
|
+ subtitleBtn.setImage(imageInRecordScreenKit(by: settingModel.subtitleIsShow ? "subtitleBtn_on" : "subtitleBtn_off"), for: .normal)
|
|
if settingModel.subtitleIsShow {
|
|
if settingModel.subtitleIsShow {
|
|
// 设置样式
|
|
// 设置样式
|
|
subtitleLabel.strokeColor = settingModel.strokeColor
|
|
subtitleLabel.strokeColor = settingModel.strokeColor
|
|
@@ -743,6 +749,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
} else { // 上
|
|
} else { // 上
|
|
subtitleLabel.frame = CGRect(x: leftPoint, y: cScreenHeigth * 0.12, width: cScreenWidth - 37 * 2, height: height)
|
|
subtitleLabel.frame = CGRect(x: leftPoint, y: cScreenHeigth * 0.12, width: cScreenWidth - 37 * 2, height: height)
|
|
}
|
|
}
|
|
|
|
+ }else{
|
|
|
|
+ subtitleLabel.text = ""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -755,7 +763,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
progreddL.snp.makeConstraints { make in
|
|
progreddL.snp.makeConstraints { make in
|
|
make.width.equalTo(100)
|
|
make.width.equalTo(100)
|
|
make.centerX.equalToSuperview()
|
|
make.centerX.equalToSuperview()
|
|
- make.top.equalToSuperview()
|
|
|
|
|
|
+ make.top.equalToSuperview().offset(-8)
|
|
make.height.equalTo(18)
|
|
make.height.equalTo(18)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -796,16 +804,16 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
// make.height.equalTo(124)
|
|
// make.height.equalTo(124)
|
|
// }
|
|
// }
|
|
|
|
|
|
- subtitleBtn.snp.makeConstraints { make in
|
|
|
|
|
|
+ soundSettingBtn.snp.makeConstraints { make in
|
|
make.right.equalToSuperview().offset(-12)
|
|
make.right.equalToSuperview().offset(-12)
|
|
make.top.equalToSuperview().offset(98)
|
|
make.top.equalToSuperview().offset(98)
|
|
make.width.equalTo(40)
|
|
make.width.equalTo(40)
|
|
make.height.equalTo(62)
|
|
make.height.equalTo(62)
|
|
}
|
|
}
|
|
-
|
|
|
|
- soundSettingBtn.snp.makeConstraints { make in
|
|
|
|
- make.right.equalTo(subtitleBtn)
|
|
|
|
- make.top.equalTo(subtitleBtn.snp.bottom).offset(18)
|
|
|
|
|
|
+
|
|
|
|
+ subtitleBtn.snp.makeConstraints { make in
|
|
|
|
+ make.right.equalTo(soundSettingBtn)
|
|
|
|
+ make.top.equalTo(soundSettingBtn.snp.bottom).offset(18)
|
|
make.width.equalTo(40)
|
|
make.width.equalTo(40)
|
|
make.height.equalTo(62)
|
|
make.height.equalTo(62)
|
|
}
|
|
}
|
|
@@ -837,13 +845,17 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
switch recognizer.state {
|
|
switch recognizer.state {
|
|
case .began:
|
|
case .began:
|
|
touchStart = recognizer.location(in: bottomeView)
|
|
touchStart = recognizer.location(in: bottomeView)
|
|
- beginOnStartBtn = recordBtn.frame.contains(touchStart)
|
|
|
|
|
|
+ beginOnStartBtn = (beginOnStartBtn || recordBtn.frame.contains(touchStart))
|
|
|
|
+ BFLog(1, message: "beginOnStartBtn:\(beginOnStartBtn)")
|
|
case .changed:
|
|
case .changed:
|
|
if beginOnStartBtn == true {
|
|
if beginOnStartBtn == true {
|
|
let nowPoint = recognizer.location(in: bottomeView)
|
|
let nowPoint = recognizer.location(in: bottomeView)
|
|
BFLog(1, message: "nowPoint x: \(nowPoint.x) y:\(nowPoint.y)")
|
|
BFLog(1, message: "nowPoint x: \(nowPoint.x) y:\(nowPoint.y)")
|
|
if recordBtn.frame.contains(nowPoint) {
|
|
if recordBtn.frame.contains(nowPoint) {
|
|
- } else {}
|
|
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
case .ended:
|
|
case .ended:
|
|
@@ -963,12 +975,11 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
if isDragingProgressSlder {
|
|
if isDragingProgressSlder {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- // 开始时间
|
|
|
|
- let model = PQVoiceModel()
|
|
|
|
- model.startCMTime = currentAssetProgress
|
|
|
|
- isRecording = true
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
// progressThumV.progressView.isUserInteractionEnabled = false
|
|
// progressThumV.progressView.isUserInteractionEnabled = false
|
|
- collectionView.isScrollEnabled = false
|
|
|
|
|
|
+// collectionView.isScrollEnabled = false
|
|
// 开始录制时清除屏幕上的字幕
|
|
// 开始录制时清除屏幕上的字幕
|
|
subtitleLabel.text = ""
|
|
subtitleLabel.text = ""
|
|
subtitleLabel.backgroundColor = UIColor.clear
|
|
subtitleLabel.backgroundColor = UIColor.clear
|
|
@@ -978,9 +989,16 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
BFLog(message: "录音机初始化错误!!!")
|
|
BFLog(message: "录音机初始化错误!!!")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 开始时间
|
|
|
|
+ beginOnStartBtn = true
|
|
|
|
+ isRecording = true
|
|
|
|
|
|
- view.isUserInteractionEnabled = false
|
|
|
|
|
|
+ UIApplication.shared.keyWindow?.isUserInteractionEnabled = false
|
|
|
|
|
|
|
|
+ let model = PQVoiceModel()
|
|
|
|
+ model.startCMTime = currentAssetProgress
|
|
model.volume = 100
|
|
model.volume = 100
|
|
recorderManager?.voiceModel = model
|
|
recorderManager?.voiceModel = model
|
|
recorderManager?.startRecord()
|
|
recorderManager?.startRecord()
|
|
@@ -1013,11 +1031,13 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
if !isRecording {
|
|
if !isRecording {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ beginOnStartBtn = false
|
|
|
|
+
|
|
isRecording = false
|
|
isRecording = false
|
|
// progressThumV.progressView.isUserInteractionEnabled = true
|
|
// progressThumV.progressView.isUserInteractionEnabled = true
|
|
- collectionView.isScrollEnabled = true
|
|
|
|
|
|
+// collectionView.isScrollEnabled = true
|
|
|
|
|
|
- view.isUserInteractionEnabled = true
|
|
|
|
|
|
+ UIApplication.shared.keyWindow?.isUserInteractionEnabled = true
|
|
recorderManager?.stopRecord(isCancel: false)
|
|
recorderManager?.stopRecord(isCancel: false)
|
|
|
|
|
|
if currentAssetProgress.seconds - (recorderManager?.voiceModel?.startCMTime.seconds ?? 0) >= 1.0 {
|
|
if currentAssetProgress.seconds - (recorderManager?.voiceModel?.startCMTime.seconds ?? 0) >= 1.0 {
|
|
@@ -1043,8 +1063,9 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
@objc func cancleRecord() {
|
|
@objc func cancleRecord() {
|
|
isRecording = false
|
|
isRecording = false
|
|
recorderManager?.stopRecord(isCancel: true)
|
|
recorderManager?.stopRecord(isCancel: true)
|
|
- progressThumV.progressView.isUserInteractionEnabled = true
|
|
|
|
- collectionView.isScrollEnabled = true
|
|
|
|
|
|
+// progressThumV.progressView.isUserInteractionEnabled = true
|
|
|
|
+// collectionView.isScrollEnabled = true
|
|
|
|
+ UIApplication.shared.keyWindow?.isUserInteractionEnabled = true
|
|
pause()
|
|
pause()
|
|
}
|
|
}
|
|
|
|
|