|
@@ -88,17 +88,17 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
// MARK: 行为参数
|
|
// MARK: 行为参数
|
|
|
|
|
|
var movieIsProcessing = false
|
|
var movieIsProcessing = false
|
|
-
|
|
|
|
|
|
+
|
|
// 行为记录,方便撤销
|
|
// 行为记录,方便撤销
|
|
var events = [WithDrawModel]() {
|
|
var events = [WithDrawModel]() {
|
|
didSet {
|
|
didSet {
|
|
withDrawBtn.isEnabled = (events.count != 0)
|
|
withDrawBtn.isEnabled = (events.count != 0)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 是否在拖动进度条
|
|
// 是否在拖动进度条
|
|
var isDragingProgressSlder: Bool = false
|
|
var isDragingProgressSlder: Bool = false
|
|
-
|
|
|
|
|
|
+
|
|
var isStopAtRecordRange = -1
|
|
var isStopAtRecordRange = -1
|
|
|
|
|
|
// 保存识别出来的字幕信息,用于回放,和合成使用
|
|
// 保存识别出来的字幕信息,用于回放,和合成使用
|
|
@@ -987,15 +987,15 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
if itemModels[currItemModelIndex].mediaType == .IMAGE {
|
|
if itemModels[currItemModelIndex].mediaType == .IMAGE {
|
|
itemModels[currItemModelIndex].materialDuraion = itemModels[currItemModelIndex].voiceStickers.last?.endTime ?? 0
|
|
itemModels[currItemModelIndex].materialDuraion = itemModels[currItemModelIndex].voiceStickers.last?.endTime ?? 0
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
} else {}
|
|
} else {}
|
|
events.removeLast()
|
|
events.removeLast()
|
|
|
|
|
|
let dur = itemModels[currItemModelIndex].materialDuraion
|
|
let dur = itemModels[currItemModelIndex].materialDuraion
|
|
if dur > 0 {
|
|
if dur > 0 {
|
|
- changeProgress(progress: Float(jumpTime / dur))
|
|
|
|
|
|
+ changeProgress(isBack: true, progress: itemModels[currItemModelIndex].mediaType == .IMAGE ? Float(jumpTime) : Float(jumpTime / dur))
|
|
} else {
|
|
} else {
|
|
- changeProgress(progress: Float(0))
|
|
|
|
|
|
+ changeProgress(isBack: true, progress: Float(0))
|
|
}
|
|
}
|
|
isDragingProgressSlder = false
|
|
isDragingProgressSlder = false
|
|
currentPlayRecordIndex = -1
|
|
currentPlayRecordIndex = -1
|
|
@@ -1008,8 +1008,12 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
changeWithDrawBtnLayout(false)
|
|
changeWithDrawBtnLayout(false)
|
|
}
|
|
}
|
|
searchStopAtRecordRange()
|
|
searchStopAtRecordRange()
|
|
|
|
+ // 重置进度条
|
|
indirectionView?.resetAllSubViews(items: itemModels[currItemModelIndex].voiceStickers, percenWidth: progressThumV.thumbImageWidth / 2.0, totalDuration: itemModels[currItemModelIndex].materialDuraion)
|
|
indirectionView?.resetAllSubViews(items: itemModels[currItemModelIndex].voiceStickers, percenWidth: progressThumV.thumbImageWidth / 2.0, totalDuration: itemModels[currItemModelIndex].materialDuraion)
|
|
-
|
|
|
|
|
|
+ // 如果是图片需重置播放按钮
|
|
|
|
+ if itemModels[currItemModelIndex].mediaType == .IMAGE {
|
|
|
|
+ (collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell)?.playBtn.isSelected = itemModels[currItemModelIndex].voiceStickers.count <= 0
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1463,7 +1467,11 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
}
|
|
}
|
|
|
|
|
|
// 通过缩略图进度条控制播放进度
|
|
// 通过缩略图进度条控制播放进度
|
|
- func changeProgress(progress: Float) {
|
|
|
|
|
|
+ func changeProgress(isBack: Bool = false, progress: Float) {
|
|
|
|
+ // 偶现拖动过程回调中process为NaN情况
|
|
|
|
+ guard !progress.isNaN else {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
if itemModels[currItemModelIndex].mediaType == .VIDEO {
|
|
if itemModels[currItemModelIndex].mediaType == .VIDEO {
|
|
if let duration = assetPlayer?.currentItem?.duration {
|
|
if let duration = assetPlayer?.currentItem?.duration {
|
|
currentAssetProgress = CMTime(value: CMTimeValue(progress * Float(CMTimeGetSeconds(duration)) * 1000), timescale: 1000)
|
|
currentAssetProgress = CMTime(value: CMTimeValue(progress * Float(CMTimeGetSeconds(duration)) * 1000), timescale: 1000)
|
|
@@ -1474,13 +1482,11 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if itemModels[currItemModelIndex].materialDuraion >= 0 {
|
|
|
|
- currentAssetProgress = CMTime(value: CMTimeValue(progress * Float(itemModels[currItemModelIndex].materialDuraion) * 1000), timescale: 1000)
|
|
|
|
- DispatchQueue.main.async { [weak self] in
|
|
|
|
- self?.progreddL.text = String(format: "%@", CMTimeGetSeconds(self!.currentAssetProgress).formatDurationToHMS())
|
|
|
|
- }
|
|
|
|
- BFLog(message: "progress = \(progress),currentAssetProgress = \(currentAssetProgress.seconds),materialDuraion = \(itemModels[currItemModelIndex].materialDuraion)")
|
|
|
|
|
|
+ currentAssetProgress = isBack ? CMTime(value: CMTimeValue(progress * 1000), timescale: 1000) : CMTime(value: CMTimeValue(progress * Float(itemModels[currItemModelIndex].materialDuraion) * 1000), timescale: 1000)
|
|
|
|
+ DispatchQueue.main.async { [weak self] in
|
|
|
|
+ self?.progreddL.text = String(format: "%@", CMTimeGetSeconds(self!.currentAssetProgress).formatDurationToHMS())
|
|
}
|
|
}
|
|
|
|
+ BFLog(message: "progress = \(progress),currentAssetProgress = \(currentAssetProgress.seconds),materialDuraion = \(itemModels[currItemModelIndex].materialDuraion)")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|