|
@@ -461,11 +461,12 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
// 进入非活跃状态
|
|
// 进入非活跃状态
|
|
PQNotification.addObserver(self, selector: #selector(willResignActive), name: UIApplication.willResignActiveNotification, object: nil)
|
|
PQNotification.addObserver(self, selector: #selector(willResignActive), name: UIApplication.willResignActiveNotification, object: nil)
|
|
|
|
|
|
- checkStatus()
|
|
|
|
|
|
+ _ = checkStatus()
|
|
// mdf by ak 切换外放和请求权限分开 否则会导致首次安装时不能执行切换操作
|
|
// mdf by ak 切换外放和请求权限分开 否则会导致首次安装时不能执行切换操作
|
|
let options:AVAudioSession.CategoryOptions = [.defaultToSpeaker,.allowBluetooth]
|
|
let options:AVAudioSession.CategoryOptions = [.defaultToSpeaker,.allowBluetooth]
|
|
try? AVAudioSession.sharedInstance().setCategory(.playAndRecord, options: options)
|
|
try? AVAudioSession.sharedInstance().setCategory(.playAndRecord, options: options)
|
|
|
|
|
|
|
|
+
|
|
// add by ak 取 nsl token
|
|
// add by ak 取 nsl token
|
|
BFRecordScreenViewModel.getNlsAccessToken { [weak self] token, appkey in
|
|
BFRecordScreenViewModel.getNlsAccessToken { [weak self] token, appkey in
|
|
BFLog(message: "nls appkey is \(appkey), token is \(token)")
|
|
BFLog(message: "nls appkey is \(appkey), token is \(token)")
|
|
@@ -1095,6 +1096,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
}
|
|
}
|
|
beginOnStartBtn = false
|
|
beginOnStartBtn = false
|
|
|
|
|
|
|
|
+ BFLog(1, message: "停止录音-")
|
|
recordBtn.isEnabled = false
|
|
recordBtn.isEnabled = false
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) { [weak self] in
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) { [weak self] in
|
|
self?.recordBtn.isEnabled = true
|
|
self?.recordBtn.isEnabled = true
|
|
@@ -1109,8 +1111,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
if currentAssetProgress.seconds - (recorderManager?.voiceModel?.startCMTime.seconds ?? 0) >= 1.0 {
|
|
if currentAssetProgress.seconds - (recorderManager?.voiceModel?.startCMTime.seconds ?? 0) >= 1.0 {
|
|
} else {
|
|
} else {
|
|
- let startTime = recorderManager?.voiceModel?.startCMTime.seconds ?? 0
|
|
|
|
- changeProgress(progress: Float(startTime / itemModels[currItemModelIndex].materialDuraion))
|
|
|
|
|
|
+ changeProgress(changCMTime: recorderManager?.voiceModel?.startCMTime ?? .zero)
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -1260,9 +1261,13 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
let dur = itemModels[currItemModelIndex].materialDuraion
|
|
let dur = itemModels[currItemModelIndex].materialDuraion
|
|
if dur > 0 {
|
|
if dur > 0 {
|
|
- changeProgress(isBack: true, progress: itemModels[currItemModelIndex].mediaType == .IMAGE ? Float(jumpTime) : Float(jumpTime / dur))
|
|
|
|
|
|
+ if itemModels[currItemModelIndex].mediaType == .IMAGE {
|
|
|
|
+ changeProgress(isBack: true, progress: Float(jumpTime))
|
|
|
|
+ }else {
|
|
|
|
+ changeProgress(changCMTime: CMTime(seconds: jumpTime, preferredTimescale: 1000))
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- changeProgress(isBack: true, progress: Float(0))
|
|
|
|
|
|
+ changeProgress(progress: Float(0))
|
|
}
|
|
}
|
|
isDragingProgressSlder = false
|
|
isDragingProgressSlder = false
|
|
currentPlayRecordIndex = -1
|
|
currentPlayRecordIndex = -1
|
|
@@ -1367,7 +1372,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
if fabs(elems[0].1.startCMTime.seconds - currentAssetProgress.seconds) < 0.5 {
|
|
if fabs(elems[0].1.startCMTime.seconds - currentAssetProgress.seconds) < 0.5 {
|
|
BFLog(1, message: "吸附在录音开始")
|
|
BFLog(1, message: "吸附在录音开始")
|
|
// changeWithDrawBtnLayout(true)
|
|
// changeWithDrawBtnLayout(true)
|
|
- changeProgress(progress: Float(elems[0].1.startCMTime.seconds / itemModels[currItemModelIndex].materialDuraion))
|
|
|
|
|
|
+ changeProgress(changCMTime: elems[0].1.startCMTime)
|
|
progressThumV.progress = elems[0].1.startCMTime.seconds
|
|
progressThumV.progress = elems[0].1.startCMTime.seconds
|
|
}
|
|
}
|
|
deleteRecordBtn.isHidden = false
|
|
deleteRecordBtn.isHidden = false
|
|
@@ -1910,7 +1915,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- currentAssetProgress = isBack ? CMTime(value: CMTimeValue(newProgress * 1000), timescale: 1000) : CMTime(value: CMTimeValue(newProgress * Float(itemModels[currItemModelIndex].materialDuraion) * 1000), timescale: 1000)
|
|
|
|
|
|
+ currentAssetProgress = isBack ? CMTime(value: CMTimeValue(newProgress * 1000), timescale: 1000) : (progress != -1 ? CMTime(value: CMTimeValue(newProgress * Float(itemModels[currItemModelIndex].materialDuraion) * 1000), timescale: 1000) : changCMTime)
|
|
DispatchQueue.main.async { [weak self] in
|
|
DispatchQueue.main.async { [weak self] in
|
|
BFLog(message: "更新录音进度\(#function)- \(self?.currentAssetProgress.seconds ?? 0)")
|
|
BFLog(message: "更新录音进度\(#function)- \(self?.currentAssetProgress.seconds ?? 0)")
|
|
self?.progreddL.text = String(format: "%@", CMTimeGetSeconds(self!.currentAssetProgress).formatDurationToHMS())
|
|
self?.progreddL.text = String(format: "%@", CMTimeGetSeconds(self!.currentAssetProgress).formatDurationToHMS())
|