|
@@ -70,9 +70,9 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
// MARK: 摄像头结束回调
|
|
|
m.recordEndCallBack = { [weak self] isSuccess, sticker in
|
|
|
- guard let wself = self, let sticker = sticker else { return }
|
|
|
+ guard let wself = self else { return }
|
|
|
|
|
|
- if isSuccess{
|
|
|
+ if isSuccess, let sticker = sticker{
|
|
|
wself.rscurrentManager.currentAssetProgress = sticker.timelineCMOut
|
|
|
let dur = wself.rscmanager.recordItem?.videoStickers.reduce(0, { partialResult, mod in
|
|
|
(mod.timelineCMOut - mod.timelineCMIn).seconds + partialResult
|
|
@@ -1381,7 +1381,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
let model = itemModels[currItemModelIndex].voiceStickers[isStopAtRecordRange]
|
|
|
itemModels[currItemModelIndex].voiceStickers.remove(at: isStopAtRecordRange)
|
|
|
indirectionView?.deleteItem(index: isStopAtRecordRange)
|
|
|
- var event = WithDrawModel(type: 3, timestamp: currentAssetProgress, deletedVoices: [model], recordItem: rscurrentManager.recordItem!)
|
|
|
+ var event = WithDrawModel(type: 3, timestamp: currentAssetProgress, recordItem: rscurrentManager.recordItem!.mutableCopy() as! BFRecordItemModel)
|
|
|
event.deletedTittles = deleteTitles(voiceModel: model)
|
|
|
events.append(event)
|
|
|
|
|
@@ -1429,7 +1429,11 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
BFLog(message: "录音机初始化错误!!!")
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ // 添加撤销记录点
|
|
|
+ let event = WithDrawModel(type: 2, timestamp: currentAssetProgress, recordItem: rscurrentManager.recordItem!.mutableCopy() as! BFRecordItemModel)
|
|
|
+ events.append(event)
|
|
|
+
|
|
|
DispatchQueue.global().async {[weak self] in
|
|
|
guard let wself = self else { return }
|
|
|
|
|
@@ -1444,9 +1448,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
wself.recorderManager?.startRecord()
|
|
|
wself.recorderManager?.audioRecorder?.startNeoNui(wself.NeoNuiToken ?? "", appid: wself.NeoNuiAPPID ?? "")
|
|
|
|
|
|
- // 添加撤销记录点
|
|
|
- let event = WithDrawModel(type: 2, timestamp: model.startCMTime, recordItem: wself.rscurrentManager.recordItem!)
|
|
|
- wself.events.append(event)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1561,8 +1563,9 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
wself.resetCurrentProgress()
|
|
|
}
|
|
|
// 移除
|
|
|
-
|
|
|
- wself.resetAllIndirectionView()
|
|
|
+ if wself.currMediaType != .Camera{
|
|
|
+ wself.resetAllIndirectionView()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
recorderManager?.voiceModel = nil
|
|
@@ -1729,7 +1732,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
canInsertVideo = true
|
|
|
|
|
|
changeProgress(changCMTime: endTime!)
|
|
|
- progressThumV.progress = endTime!.seconds
|
|
|
+ progressThumV.progress = endTime!
|
|
|
|
|
|
BFLog(1, message: "可以插入录音")
|
|
|
}
|
|
@@ -1790,12 +1793,39 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
func recoverRecord() {
|
|
|
if let action = events.last {
|
|
|
// 重置播放器进度,按钮状态,缩略图展示,当前进度
|
|
|
- rscurrentManager.recordItem = action.recordItem
|
|
|
- changeProgress(changCMTime: action.timestamp)
|
|
|
- progressThumV.progress = action.timestamp.seconds
|
|
|
- searchStopAtRecordRange()
|
|
|
- resetAllIndirectionView()
|
|
|
+ if action.type > 1 {
|
|
|
+ rscurrentManager.recordItem = action.recordItem
|
|
|
+ itemModels[currItemModelIndex] = action.recordItem
|
|
|
+ }
|
|
|
+
|
|
|
events.removeLast()
|
|
|
+
|
|
|
+ let dur = itemModels[currItemModelIndex].materialDuraion.seconds
|
|
|
+ changeProgress(changCMTime: (dur > 0) ? action.timestamp : .zero)
|
|
|
+
|
|
|
+ isDragingProgressSlder = false
|
|
|
+ currentPlayRecordIndex = -1
|
|
|
+ BFLog(3, message: "重置播放index-\(#function) = \(currentPlayRecordIndex)")
|
|
|
+ hadPrepareToPlayRecord = false
|
|
|
+ progressThumV.progress = action.timestamp
|
|
|
+
|
|
|
+ if let event = events.last {
|
|
|
+ changeWithDrawBtnLayout(event.type)
|
|
|
+ } else {
|
|
|
+ changeWithDrawBtnLayout(0)
|
|
|
+ withDrawBtn.isEnabled = false
|
|
|
+ }
|
|
|
+ searchStopAtRecordRange()
|
|
|
+ let itemModel = itemModels[currItemModelIndex]
|
|
|
+ /// 重绘录音进度视图
|
|
|
+ if action.type > 1 {
|
|
|
+ resetAllIndirectionView()
|
|
|
+ }
|
|
|
+ // 如果是图片需重置播放按钮
|
|
|
+ if itemModel.mediaType != .Video {
|
|
|
+ playBtn.isSelected = itemModels[currItemModelIndex].voiceStickers.count <= 0
|
|
|
+ playBtn.isHidden = playBtn.isSelected
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2049,7 +2079,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
if isEndPlay || (currMediaType == .Image && CMTimeCompare(currentAssetProgress, itemModels[currItemModelIndex].materialDuraion) >= 0) {
|
|
|
isEndPlay = false
|
|
|
assetPlayer.seek(to: CMTime.zero)
|
|
|
- progressThumV.progress = 0
|
|
|
+ progressThumV.progress = .zero
|
|
|
currentPlayRecordIndex = -1
|
|
|
BFLog(3, message: "重置播放index-\(#function) = \(currentPlayRecordIndex)")
|
|
|
|
|
@@ -2232,7 +2262,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
wself.progreddL.text = String(format: "%@", CMTimeGetSeconds(time).formatDurationToHMS())
|
|
|
let su = !wself.isDragingProgressSlder || wself.isRecording || wself.isNormalPlaying
|
|
|
if su { // 不拖动,正常播放和录音时更新进度条
|
|
|
- wself.progressThumV.progress = time.seconds
|
|
|
+ wself.progressThumV.progress = time
|
|
|
}
|
|
|
// 更新字幕
|
|
|
if !wself.isRecording {
|
|
@@ -2659,7 +2689,7 @@ public extension BFRecordScreenController {
|
|
|
}
|
|
|
// BFLog(1, message: "更新录音进度\(#function)-\(wself.currentAssetProgress.seconds ?? 0)")
|
|
|
wself.progreddL.text = String(format: "%@", (wself.currentAssetProgress.seconds).formatDurationToHMS())
|
|
|
- wself.progressThumV.progress = (wself.currentAssetProgress.seconds)
|
|
|
+ wself.progressThumV.progress = wself.currentAssetProgress
|
|
|
wself.updateSubtitle(time: wself.currentAssetProgress)
|
|
|
}
|
|
|
}
|