|
@@ -1136,6 +1136,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
BFLog(3, message: "开始录制-取消:currentAssetProgress=\(currentAssetProgress.seconds),cuInde=\(currItemModelIndex),currIndex=\(voiceModel?.currIndex ?? 0),\(String(describing: voiceModel)),\(String(describing: recorderManager?.voiceModel))")
|
|
BFLog(3, message: "开始录制-取消:currentAssetProgress=\(currentAssetProgress.seconds),cuInde=\(currItemModelIndex),currIndex=\(voiceModel?.currIndex ?? 0),\(String(describing: voiceModel)),\(String(describing: recorderManager?.voiceModel))")
|
|
if voiceModel != nil, currentAssetProgress.seconds - (recorderManager?.voiceModel?.startCMTime.seconds ?? 0) < 1.0 {
|
|
if voiceModel != nil, currentAssetProgress.seconds - (recorderManager?.voiceModel?.startCMTime.seconds ?? 0) < 1.0 {
|
|
cShowHUB(superView: nil, msg: "最短录制1秒")
|
|
cShowHUB(superView: nil, msg: "最短录制1秒")
|
|
|
|
+ recorderManager?.cancelTitleService()
|
|
}
|
|
}
|
|
// 删除文件
|
|
// 删除文件
|
|
recorderManager?.deleteFile(outfile: voiceModel?.wavFilePath ?? "")
|
|
recorderManager?.deleteFile(outfile: voiceModel?.wavFilePath ?? "")
|
|
@@ -1343,9 +1344,9 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
// TODO: 停在了录音区间,显示删除按钮
|
|
// TODO: 停在了录音区间,显示删除按钮
|
|
if needAdsorb {
|
|
if needAdsorb {
|
|
if fabs(elems[0].1.endCMTime.seconds - currentAssetProgress.seconds) < 0.5 {
|
|
if fabs(elems[0].1.endCMTime.seconds - currentAssetProgress.seconds) < 0.5 {
|
|
- BFLog(1, message: "吸附在录音结尾")
|
|
|
|
|
|
+ BFLog(1, message: "吸附在录音结尾, \(elems[0].1.endCMTime.seconds)")
|
|
// changeWithDrawBtnLayout(false)
|
|
// changeWithDrawBtnLayout(false)
|
|
- changeProgress(progress: Float(elems[0].1.endCMTime.seconds / itemModels[currItemModelIndex].materialDuraion))
|
|
|
|
|
|
+ changeProgress(changCMTime:elems[0].1.endCMTime)
|
|
progressThumV.progress = elems[0].1.endCMTime.seconds
|
|
progressThumV.progress = elems[0].1.endCMTime.seconds
|
|
|
|
|
|
// deleteRecordBtn.isHidden = true
|
|
// deleteRecordBtn.isHidden = true
|
|
@@ -1461,7 +1462,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
assetPlayer?.volume = noSpeakVolume
|
|
assetPlayer?.volume = noSpeakVolume
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- BFLog(1, message: "volume:\(assetPlayer?.volume ?? -1)")
|
|
|
|
|
|
+// BFLog(1, message: "volume:\(assetPlayer?.volume ?? -1)")
|
|
|
|
|
|
if currentPlayRecordIndex == -3 { // 刚录音完,不需要播放
|
|
if currentPlayRecordIndex == -3 { // 刚录音完,不需要播放
|
|
return
|
|
return
|
|
@@ -1877,7 +1878,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
// 通过缩略图进度条控制播放进度
|
|
// 通过缩略图进度条控制播放进度
|
|
// progress : 图片且isback为true时,表示是时长; 其他情况: 0 - 1,百分比
|
|
// progress : 图片且isback为true时,表示是时长; 其他情况: 0 - 1,百分比
|
|
- func changeProgress(isBack: Bool = false, progress: Float) {
|
|
|
|
|
|
+ func changeProgress(isBack: Bool = false, progress: Float = -1, changCMTime:CMTime = .zero) {
|
|
var newProgress = progress
|
|
var newProgress = progress
|
|
if progress.isNaN || progress.isInfinite {
|
|
if progress.isNaN || progress.isInfinite {
|
|
newProgress = 0
|
|
newProgress = 0
|
|
@@ -1885,7 +1886,11 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
if itemModels[currItemModelIndex].mediaType == .VIDEO {
|
|
if itemModels[currItemModelIndex].mediaType == .VIDEO {
|
|
let duration = itemModels[currItemModelIndex].materialDuraion
|
|
let duration = itemModels[currItemModelIndex].materialDuraion
|
|
if duration > 0 {
|
|
if duration > 0 {
|
|
- currentAssetProgress = CMTime(seconds: Double(newProgress) * duration, preferredTimescale: 1000)
|
|
|
|
|
|
+ if progress == -1 {
|
|
|
|
+ currentAssetProgress = changCMTime
|
|
|
|
+ }else{
|
|
|
|
+ currentAssetProgress = CMTime(seconds: Double(newProgress) * duration, preferredTimescale: 1000)
|
|
|
|
+ }
|
|
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())
|