|
@@ -132,8 +132,6 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
make.edges.equalToSuperview()
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
} else {
|
|
|
cell.playView.setInputRotation(GPUImageRotationMode(rawValue: 0), at: 0)
|
|
|
progressThumV.isHidden = false
|
|
@@ -172,7 +170,17 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var isEndPlay = false
|
|
|
+ var isEndPlay = false {
|
|
|
+ didSet{
|
|
|
+ recordBtn.isHidden = (itemModels[currItemModelIndex].mediaType != .Video) ? false : true
|
|
|
+
|
|
|
+ subtitleBtn.isHidden = false
|
|
|
+ soundSettingBtn.isHidden = false
|
|
|
+
|
|
|
+ playBtn.isSelected = false
|
|
|
+ playBtn.isHidden = playBtn.isSelected
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
public var isNormalPlaying = false {
|
|
|
didSet {
|
|
@@ -931,7 +939,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
wself.resetCurrentProgress()
|
|
|
wself.deleteRecordBtn.isHidden = true
|
|
|
- wself.recordBtn.isHidden = (wself.itemModels[wself.currItemModelIndex ?? 0].mediaType != .Video && (wself.isEndPlay ?? false)) ? false : (wself.isEndPlay ?? false)
|
|
|
+ wself.recordBtn.isHidden = (wself.itemModels[wself.currItemModelIndex ].mediaType != .Video && (wself.isEndPlay )) ? false : (wself.isEndPlay ?? false)
|
|
|
}
|
|
|
wself.currentPlayRecordIndex = -3
|
|
|
BFLog(3, message: "重置播放index-\(#function) = \(wself.currentPlayRecordIndex)")
|
|
@@ -1275,7 +1283,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
|
|
|
@objc func endRecord() {
|
|
|
- pause()
|
|
|
+
|
|
|
|
|
|
if !isRecording {
|
|
|
return
|
|
@@ -1823,20 +1831,26 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if !hadPrepareToPlayRecord,
|
|
|
+ if !wself.hadPrepareToPlayRecord,
|
|
|
CMTimeGetSeconds(currentT) >= (recordedAudio.startCMTime.seconds - 0.1),
|
|
|
CMTimeGetSeconds(currentT) <= recordedAudio.endCMTime.seconds - 0.2
|
|
|
{
|
|
|
- if itemModels[currItemModelIndex].mediaType == .Video, recordPlayer.currentItem?.duration.timescale == 0 {
|
|
|
+ if wself.itemModels[wself.currItemModelIndex].mediaType == .Video, wself.recordPlayer.currentItem?.duration.timescale == 0 {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
|
|
|
- if currentPlayRecordIndex == -1, wself.isNormalPlaying {
|
|
|
+ if wself.currentPlayRecordIndex == -1, wself.isNormalPlaying {
|
|
|
let second = currentT - recordedAudio.startCMTime
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
|
+
|
|
|
+ guard let wself = self else { return }
|
|
|
+
|
|
|
wself.recordPlayer.seek(to: second, toleranceBefore: CMTime(value: 1, timescale: 1_000_000), toleranceAfter: CMTime(value: 1, timescale: 1_000_000), completionHandler: { [weak self] finished in
|
|
|
- if finished, wself.isNormalPlaying ?? false {
|
|
|
+
|
|
|
+ guard let wself = self else { return }
|
|
|
+
|
|
|
+ if finished, wself.isNormalPlaying {
|
|
|
wself.recordPlayer.play()
|
|
|
|
|
|
|
|
@@ -1863,19 +1877,19 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
guard let wself = self, wself.isNormalPlaying else {
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
|
|
|
if CMTimeGetSeconds(currentT) >= (recordedAudio.startCMTime.seconds - 0.1),
|
|
|
- CMTimeCompare(currentT, recordedAudio.endCMTime) <= 0
|
|
|
- {
|
|
|
+ CMTimeCompare(currentT, recordedAudio.endCMTime) <= 0 {
|
|
|
|
|
|
|
|
|
if wself.isNormalPlaying {
|
|
|
let second = currentT - recordedAudio.startCMTime
|
|
|
- wself.recordPlayer.seek(to: second, toleranceBefore: CMTime(seconds: 1, preferredTimescale: 1000), toleranceAfter: CMTime(seconds: 1, preferredTimescale: 1000), completionHandler: { isFinished in
|
|
|
+ wself.recordPlayer.seek(to: second, toleranceBefore: CMTime(seconds: 1, preferredTimescale: 1000), toleranceAfter: CMTime(seconds: 1, preferredTimescale: 1000), completionHandler: { [weak self] isFinished in
|
|
|
+ guard let wself = self else { return }
|
|
|
+
|
|
|
+ wself.recordPlayer.play()
|
|
|
})
|
|
|
- wself.recordPlayer.play()
|
|
|
- BFLog(3, message: "录音开始播放2, \(second), \(CMTimeGetSeconds(recordPlayer.currentItem?.duration ?? .zero)),index = \(currentPlayRecordIndex)")
|
|
|
+ BFLog(3, message: "录音开始播放2, \(second), \(CMTimeGetSeconds(recordPlayer.currentItem?.duration ?? .zero)),index = \(wself.currentPlayRecordIndex)")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2031,17 +2045,12 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
wself.isNormalPlaying = false
|
|
|
wself.isEndPlay = true
|
|
|
- wself.recordBtn.isHidden = (wself.itemModels[wself.currItemModelIndex].mediaType == .Image) ? false : true
|
|
|
|
|
|
- wself.subtitleBtn.isHidden = false
|
|
|
- wself.soundSettingBtn.isHidden = false
|
|
|
|
|
|
if wself.isRecording {
|
|
|
wself.endRecord()
|
|
|
cShowHUB(superView: nil, msg: "tips_full".BFLocale)
|
|
|
}
|
|
|
- wself.playBtn.isSelected = false
|
|
|
- wself.playBtn.isHidden = wself.playBtn.isSelected
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2146,7 +2155,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
|
guard let wself = self else { return }
|
|
|
|
|
|
- BFLog(message: "更新录音进度\(#function)- \(wself.currentAssetProgress.seconds ?? 0)")
|
|
|
+
|
|
|
wself.progreddL.text = String(format: "%@", CMTimeGetSeconds(self!.currentAssetProgress).formatDurationToHMS())
|
|
|
}
|
|
|
BFLog(message: "progress = \(progress),currentAssetProgress = \(currentAssetProgress.seconds),materialDuraion = \(itemModels[currItemModelIndex].materialDuraion.seconds)")
|
|
@@ -2325,7 +2334,7 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
|
|
|
|
|
|
func endScrollItem(page: Int) {
|
|
|
BFLog(1, message: "endScrollItem")
|
|
|
-
|
|
|
+
|
|
|
currItemModelIndex = page
|
|
|
|
|
|
pause()
|
|
@@ -2353,7 +2362,7 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
|
|
|
wself.recordBtn.isEnabled = true
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
searchStopAtRecordRange()
|
|
|
|