|
@@ -187,16 +187,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
didSet{
|
|
|
if isEndPlay {
|
|
|
|
|
|
- switch currMediaType {
|
|
|
- case .Image:
|
|
|
- recordBtn.isHidden = false
|
|
|
- case .Video:
|
|
|
- recordBtn.isHidden = true
|
|
|
- case .Camera:
|
|
|
- recordBtn.isHidden = false
|
|
|
- }
|
|
|
+ updateRecordBtnStatus()
|
|
|
|
|
|
- deleteRecordBtn.isHidden = true
|
|
|
subtitleBtn.isHidden = false
|
|
|
soundSettingBtn.isHidden = false
|
|
|
}else {
|
|
@@ -1226,7 +1218,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
// 判断是否无录音了
|
|
|
if itemModels[currItemModelIndex].materialDuraion == .zero {
|
|
|
playBtn.isSelected = true
|
|
|
- playBtn.isHidden = playBtn.isSelected
|
|
|
+ playBtn.isHidden = true
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1296,7 +1288,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
rscurrentManager.startRecord()
|
|
|
// 录制中不显示播放按钮
|
|
|
playBtn.isSelected = true
|
|
|
- playBtn.isHidden = playBtn.isSelected
|
|
|
+ playBtn.isHidden = true
|
|
|
let cell = collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell
|
|
|
if cell?.contentView.viewWithTag(100_100)?.superview == nil {
|
|
|
cell?.contentView.addSubview(subtitleLabel)
|
|
@@ -1627,8 +1619,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
BFLog(1, message: "isDragingProgressSlder : \(isDragingProgressSlder)")
|
|
|
BFLog(3, message: "重置播放index-\(#function) = \(currentPlayRecordIndex)")
|
|
|
|
|
|
+ isEndPlay = (progress == 1)
|
|
|
searchStopAtRecordRange()
|
|
|
- isEndPlay = (progress == 1) // 在searchStopAtRecordRange后边是保证拖动到结尾时,视频的按钮隐藏
|
|
|
|
|
|
changeWithDrawBtnLayout(0)
|
|
|
recorderManager?.voiceModel = nil
|
|
@@ -1725,15 +1717,14 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
BFLog(1, message: "停在了录音区间里 \(isStopAtRecordRange), currTime:\(currentAssetProgress.seconds), 录音范围:\(startTime!.seconds) - \(endTime!.seconds)")
|
|
|
}
|
|
|
} else {
|
|
|
- deleteRecordBtn.isHidden = false
|
|
|
- recordBtn.isHidden = true
|
|
|
+ updateRecordBtnStatus(true)
|
|
|
|
|
|
BFLog(1, message: "停在了录音区间里 \(isStopAtRecordRange), currTime:\(currentAssetProgress.seconds), 录音范围:\(startTime!.seconds) - \(endTime!.seconds)")
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- deleteRecordBtn.isHidden = true
|
|
|
- recordBtn.isHidden = false
|
|
|
+ updateRecordBtnStatus(false)
|
|
|
+
|
|
|
|
|
|
isStopAtRecordRange = -1
|
|
|
BFLog(1, message: "停在了录音区间外 \(isStopAtRecordRange), currTime:\(currentAssetProgress.seconds)")
|
|
@@ -1756,6 +1747,20 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
playBtn.isHidden = playBtn.isSelected
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ func updateRecordBtnStatus(_ show:Bool? = nil){
|
|
|
+ let su = show ?? false
|
|
|
+ switch currMediaType {
|
|
|
+ case .Image:
|
|
|
+ recordBtn.isHidden = isEndPlay ? false : su
|
|
|
+ case .Video:
|
|
|
+ recordBtn.isHidden = isEndPlay ? true : su
|
|
|
+ case .Camera:
|
|
|
+ recordBtn.isHidden = isEndPlay ? false : su
|
|
|
+ }
|
|
|
+
|
|
|
+ deleteRecordBtn.isHidden = isEndPlay ? true : !su
|
|
|
+ }
|
|
|
|
|
|
// MARK: - 权限申请
|
|
|
|
|
@@ -1885,7 +1890,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
BFLog(3, message: "wself为空")
|
|
|
return
|
|
|
}
|
|
|
- BFLog(1, message: "当前播放---\(time),\(time.seconds),\(rPlay.currentItem?.currentTime().seconds ?? 0),\(rPlay.currentItem?.duration.seconds ?? 0)")
|
|
|
+ BFLog(1, message: "当前播放--- \(time.seconds), \(rPlay.currentItem?.duration.seconds ?? 0)")
|
|
|
if CMTimeGetSeconds(wself.currenStartPlayTime) <= 0 {
|
|
|
BFLog(message: "重新更新开始播放进度\(#function)-\(wself.currenStartPlayTime.seconds)")
|
|
|
wself.currenStartPlayTime = time
|
|
@@ -2129,6 +2134,9 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
} else {
|
|
|
assetPlayer.replaceCurrentItem(with: item)
|
|
|
BFLog(message: "设置播放器item-替换:\(String(describing: item))")
|
|
|
+ if avplayerTimeObserver != nil{
|
|
|
+ avplayerTimeObserver?.invalidate()
|
|
|
+ }
|
|
|
avplayerTimeObserver = assetPlayer.addPeriodicTimeObserver(forInterval: CMTime(value: 1, timescale: 1000), queue: DispatchQueue.global()) { [weak self] time in
|
|
|
// 进度监控
|
|
|
guard let wself = self else { return }
|
|
@@ -2159,6 +2167,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
cShowHUB(superView: nil, msg: "tips_full".BFLocale)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// 音视频播放进度-视频跟图片单独处理
|
|
@@ -2283,11 +2292,11 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
if currMediaType == .Image {
|
|
|
percenWidth = progressThumV.thumbImageWidth / 2.0
|
|
|
} else {
|
|
|
- percenWidth = progressThumV.progessIndicateBackV.frame.width / CGFloat(itemModels[currItemModelIndex].materialDuraion.seconds)
|
|
|
+ percenWidth = progressThumV.progessIndicateBackV.frame.width / CGFloat(rscurrentManager.recordItem?.materialDuraion.seconds ?? 0)
|
|
|
}
|
|
|
// progressThumV.progressView.contentSize
|
|
|
// progressThumV.progessIndicateBackV.origin
|
|
|
- indirectionView = BFIndirectionProgressView(frame: CGRect(x: progressThumV.progessIndicateBackV.x, y: 44, width: progressThumV.progressView.contentSize.width, height: 6), percenWidth: percenWidth, totalDuration: itemModels[currItemModelIndex].materialDuraion.seconds)
|
|
|
+ indirectionView = BFIndirectionProgressView(frame: CGRect(x: progressThumV.progessIndicateBackV.x, y: 44, width: progressThumV.progressView.contentSize.width, height: 6), percenWidth: percenWidth, totalDuration: rscurrentManager.recordItem?.materialDuraion.seconds ?? 0)
|
|
|
progressThumV.progressView.addSubview((indirectionView)!)
|
|
|
}
|
|
|
// 更新录制进度
|
|
@@ -2431,7 +2440,8 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
|
|
|
|
|
|
wself.collectionView.deleteItems(at: [IndexPath(row: wself.currItemModelIndex, section: 0)])
|
|
|
}
|
|
|
- currItemModelIndex -= 1
|
|
|
+ currItemModelIndex = max(0, currItemModelIndex - 1)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2467,7 +2477,6 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
|
|
|
// 更新缩略图
|
|
|
// progressThumV.isHidden = false
|
|
|
|
|
|
- searchStopAtRecordRange()
|
|
|
// 切换要更新当前录制index,避免在录制完以后切换素材这种时候为-3会拦截
|
|
|
currentPlayRecordIndex = -1
|
|
|
showSubtitleIndex = -1
|
|
@@ -2517,7 +2526,7 @@ public extension BFRecordScreenController {
|
|
|
if currMediaType == .Image {
|
|
|
if itemModels[currItemModelIndex].materialDuraion.seconds <= 0 {
|
|
|
playBtn.isSelected = true
|
|
|
- playBtn.isHidden = playBtn.isSelected
|
|
|
+ playBtn.isHidden = true
|
|
|
return
|
|
|
}
|
|
|
isNormalPlaying = true
|