|
@@ -113,9 +113,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
return CMTimeRangeGetIntersection(originRange, otherRange: newRange).duration.seconds > 0
|
|
return CMTimeRangeGetIntersection(originRange, otherRange: newRange).duration.seconds > 0
|
|
}
|
|
}
|
|
BFLog(1, message: "添加录音文件:\(model.startTime) -- \(model.endTime)")
|
|
BFLog(1, message: "添加录音文件:\(model.startTime) -- \(model.endTime)")
|
|
- sself.withDrawBtn.setTitle("撤销录制", for: .normal)
|
|
|
|
DispatchQueue.main.async {[weak self] in
|
|
DispatchQueue.main.async {[weak self] in
|
|
- self?.changeWithDrawBtnLayout()
|
|
|
|
|
|
+ self?.changeWithDrawBtnLayout(true)
|
|
}
|
|
}
|
|
var event = sself.events.last
|
|
var event = sself.events.last
|
|
if event != nil {
|
|
if event != nil {
|
|
@@ -875,11 +874,9 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
}
|
|
}
|
|
|
|
|
|
if let event = events.last, event.type == 2 {
|
|
if let event = events.last, event.type == 2 {
|
|
- withDrawBtn.setTitle("撤销录制", for: .normal)
|
|
|
|
- changeWithDrawBtnLayout()
|
|
|
|
|
|
+ changeWithDrawBtnLayout(true)
|
|
} else {
|
|
} else {
|
|
- withDrawBtn.setTitle("撤销", for: .normal)
|
|
|
|
- changeWithDrawBtnLayout()
|
|
|
|
|
|
+ changeWithDrawBtnLayout(false)
|
|
}
|
|
}
|
|
searchStopAtRecordRange()
|
|
searchStopAtRecordRange()
|
|
}
|
|
}
|
|
@@ -896,7 +893,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
searchStopAtRecordRange()
|
|
searchStopAtRecordRange()
|
|
} else {
|
|
} else {
|
|
events.append(WithDrawModel(type: 1, timestamp: currentAssetProgress.seconds))
|
|
events.append(WithDrawModel(type: 1, timestamp: currentAssetProgress.seconds))
|
|
- withDrawBtn.setTitle("撤销", for: .normal)
|
|
|
|
|
|
+ changeWithDrawBtnLayout(false)
|
|
play()
|
|
play()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -924,7 +921,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
hadPrepareToPlayRecord = false
|
|
hadPrepareToPlayRecord = false
|
|
BFLog(1, message: isDragingProgressSlder ? "drag false" : "drag tr")
|
|
BFLog(1, message: isDragingProgressSlder ? "drag false" : "drag tr")
|
|
searchStopAtRecordRange()
|
|
searchStopAtRecordRange()
|
|
- withDrawBtn.setTitle("撤销", for: .normal)
|
|
|
|
|
|
+ changeWithDrawBtnLayout(false)
|
|
}
|
|
}
|
|
|
|
|
|
func searchStopAtRecordRange() {
|
|
func searchStopAtRecordRange() {
|
|
@@ -1267,7 +1264,12 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
// MARK: - 录音对应图像绘制
|
|
// MARK: - 录音对应图像绘制
|
|
|
|
|
|
// 撤销按钮修改title,重绘
|
|
// 撤销按钮修改title,重绘
|
|
- func changeWithDrawBtnLayout() {
|
|
|
|
|
|
+ func changeWithDrawBtnLayout(_ recorded:Bool) {
|
|
|
|
+ if recorded {
|
|
|
|
+ withDrawBtn.setTitle("撤销录制", for: .normal)
|
|
|
|
+ }else {
|
|
|
|
+ withDrawBtn.setTitle("撤销", for: .normal)
|
|
|
|
+ }
|
|
withDrawBtn.imageEdgeInsets = UIEdgeInsets(top: -withDrawBtn.imageView!.height, left: 0, bottom: 0, right: -withDrawBtn.titleLabel!.width)
|
|
withDrawBtn.imageEdgeInsets = UIEdgeInsets(top: -withDrawBtn.imageView!.height, left: 0, bottom: 0, right: -withDrawBtn.titleLabel!.width)
|
|
withDrawBtn.titleEdgeInsets = UIEdgeInsets(top: withDrawBtn.titleLabel!.height + 2, left: -withDrawBtn.imageView!.width, bottom: 0, right: 0)
|
|
withDrawBtn.titleEdgeInsets = UIEdgeInsets(top: withDrawBtn.titleLabel!.height + 2, left: -withDrawBtn.imageView!.width, bottom: 0, right: 0)
|
|
|
|
|
|
@@ -1421,23 +1423,28 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
|
|
// 暂停状态
|
|
// 暂停状态
|
|
let lastCell: BFImageCoverViewCell? = collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell
|
|
let lastCell: BFImageCoverViewCell? = collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell
|
|
lastCell?.playBtn.isSelected = false
|
|
lastCell?.playBtn.isSelected = false
|
|
- // 更新当前page
|
|
|
|
- currItemModelIndex = page
|
|
|
|
- let recordItem = itemModels[currItemModelIndex]
|
|
|
|
|
|
+
|
|
|
|
+ let recordItem = itemModels[page]
|
|
// 重绘录音区域
|
|
// 重绘录音区域
|
|
drawOrUpdateRecordProgessLable()
|
|
drawOrUpdateRecordProgessLable()
|
|
// 更新缩略图
|
|
// 更新缩略图
|
|
progressThumV.recordItem = recordItem
|
|
progressThumV.recordItem = recordItem
|
|
progressThumV.isHidden = false
|
|
progressThumV.isHidden = false
|
|
if recordItem.mediaType == .VIDEO {
|
|
if recordItem.mediaType == .VIDEO {
|
|
- let currCell: BFImageCoverViewCell? = collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell
|
|
|
|
|
|
+ let currCell: BFImageCoverViewCell? = collectionView.cellForItem(at: IndexPath(item: page, section: 0)) as? BFImageCoverViewCell
|
|
setVideoPlay(item: recordItem.playItem, imageView: currCell?.playView)
|
|
setVideoPlay(item: recordItem.playItem, imageView: currCell?.playView)
|
|
setAudioPlay(item: recordItem.playItem)
|
|
setAudioPlay(item: recordItem.playItem)
|
|
assetPlayer?.seek(to: .zero, toleranceBefore: CMTime(value: 1, timescale: 1000), toleranceAfter: CMTime(value: 1, timescale: 1000))
|
|
assetPlayer?.seek(to: .zero, toleranceBefore: CMTime(value: 1, timescale: 1000), toleranceAfter: CMTime(value: 1, timescale: 1000))
|
|
}
|
|
}
|
|
if changeItemHandle != nil {
|
|
if changeItemHandle != nil {
|
|
- changeItemHandle!(currItemModelIndex)
|
|
|
|
|
|
+ changeItemHandle!(page)
|
|
}
|
|
}
|
|
|
|
+ // 重设撤销栈
|
|
|
|
+ itemModels[currItemModelIndex].events = events
|
|
|
|
+ events = itemModels[page].events
|
|
|
|
+
|
|
|
|
+ // 更新当前page
|
|
|
|
+ currItemModelIndex = page
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|