|
@@ -307,6 +307,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
BFLog(1, message: "haveSpeak is:\(haveSpeak),noHaveSpeak is:\(noHaveSpeak)")
|
|
|
self?.haveSpeakVolume = haveSpeak / 100.0
|
|
|
self?.noSpeakVolume = noHaveSpeak / 100.0
|
|
|
+
|
|
|
+// self?.assetPlayer?.volume = self?.noSpeakVolume
|
|
|
}
|
|
|
|
|
|
return audioSettingView
|
|
@@ -459,6 +461,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
// 加入到语音数组里
|
|
|
model.endTime = sself.currentAssetProgress.seconds
|
|
|
|
|
|
+ let recordItem = sself.itemModels[sself.currItemModelIndex]
|
|
|
// ********** 开始处理冲突的录制部分
|
|
|
let newRange = CMTimeRange(start: CMTime(seconds: model.startTime, preferredTimescale: 1000), end: CMTime(seconds: model.endTime, preferredTimescale: 1000))
|
|
|
|
|
@@ -507,7 +510,12 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
// 录音完,重绘撤销按钮,更新录音按钮,
|
|
|
self?.changeWithDrawBtnLayout(true)
|
|
|
// 注:在录制结束时矫正当前位置,避免跟指针无法对其
|
|
|
- self?.indirectionView?.resetCurrentItem(start: model.startTime, end: model.endTime)
|
|
|
+ if deletedVoices.count == 0 {
|
|
|
+ self?.indirectionView?.resetCurrentItem(start: model.startTime, end: model.endTime)
|
|
|
+ }else {
|
|
|
+ self?.indirectionView?.resetAllSubViews(items: recordItem.voiceStickers, percenWidth: recordItem.mediaType == .IMAGE ? (self?.progressThumV.thumbImageWidth ?? 0) / 2.0 : 0, totalDuration: recordItem.materialDuraion)
|
|
|
+
|
|
|
+ }
|
|
|
// 矫正进度
|
|
|
self?.resetCurrentProgress()
|
|
|
self?.deleteRecordBtn.isHidden = true
|
|
@@ -1026,10 +1034,12 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
searchStopAtRecordRange()
|
|
|
let itemModel = itemModels[currItemModelIndex]
|
|
|
+
|
|
|
+ // 重置进度条
|
|
|
+ indirectionView?.resetAllSubViews(items: itemModels[currItemModelIndex].voiceStickers, percenWidth: itemModels[currItemModelIndex].mediaType == .IMAGE ? (progressThumV.thumbImageWidth ) / 2.0 : 0, totalDuration: itemModels[currItemModelIndex].materialDuraion)
|
|
|
+
|
|
|
// 如果是图片需重置播放按钮
|
|
|
if itemModel.mediaType == .IMAGE {
|
|
|
- // 重置进度条
|
|
|
- indirectionView?.resetAllSubViews(items: itemModels[currItemModelIndex].voiceStickers, percenWidth: progressThumV.thumbImageWidth / 2.0, totalDuration: itemModels[currItemModelIndex].materialDuraion)
|
|
|
(collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell)?.playBtn.isSelected = itemModels[currItemModelIndex].voiceStickers.count <= 0
|
|
|
}
|
|
|
}
|
|
@@ -1235,11 +1245,12 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
periodicTimeObserver(CMTime(seconds: CMTimeGetSeconds(time) - CMTimeGetSeconds(self?.currenStartPlayTime ?? CMTime.zero), preferredTimescale: 1000), newItem)
|
|
|
} as? NSKeyValueObservation
|
|
|
}
|
|
|
- if recordPlayer?.currentItem?.duration.timescale == 0 {
|
|
|
- BFLog(1, message: "时间timescale == 0")
|
|
|
- playFailed((shouldPlayRecordIndex, recordedAudio) as? (Int, PQVoiceModel), recordPlayer?.currentItem)
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
+// if recordPlayer?.currentItem?.duration.timescale == 0 {
|
|
|
+// BFLog(1, message: "时间timescale == 0")
|
|
|
+// playFailed((shouldPlayRecordIndex, recordedAudio) as? (Int, PQVoiceModel), recordPlayer?.currentItem)
|
|
|
+// return
|
|
|
+// }
|
|
|
synced(currentPlayRecordIndex) { [weak self] in
|
|
|
guard let sself = self else {
|
|
|
return
|
|
@@ -1247,10 +1258,13 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
BFLog(1, message: "判断是否开始录音播放** hadPrepareToPlayRecord:\(hadPrepareToPlayRecord), currentPlayRecordIndex:\(currentPlayRecordIndex), isNormalPlaying :\(sself.isNormalPlaying),\(recordPlayer?.currentItem?.duration.timescale ?? 0),\(CMTimeGetSeconds(currentT) >= recordedAudio.startTime),\(CMTimeGetSeconds(currentT) <= recordedAudio.endTime - 0.2)")
|
|
|
|
|
|
if !hadPrepareToPlayRecord,
|
|
|
- recordPlayer?.currentItem?.duration.timescale != 0,
|
|
|
CMTimeGetSeconds(currentT) >= (recordedAudio.startTime - 0.1),
|
|
|
CMTimeGetSeconds(currentT) <= recordedAudio.endTime - 0.2 // 这个条件是避免录音结束后有小幅度回退导致播放最新录音
|
|
|
{
|
|
|
+ if itemModels[currItemModelIndex].mediaType == .VIDEO && recordPlayer?.currentItem?.duration.timescale == 0{
|
|
|
+ return
|
|
|
+
|
|
|
+ }
|
|
|
// 应当开始播放了
|
|
|
// 两个逻辑:如果在播,则跳过;如果暂停拖动到中间,则seek
|
|
|
if currentPlayRecordIndex == -1, sself.isNormalPlaying {
|