|
@@ -174,8 +174,8 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3, execute: { [weak self] in
|
|
|
guard let wself = self else { return }
|
|
|
while wself.groupCount > 0{
|
|
|
- wself.gropQueue.leave()
|
|
|
wself.groupCount -= 1
|
|
|
+ wself.gropQueue.leave()
|
|
|
}
|
|
|
|
|
|
wself.endRecord()
|
|
@@ -286,6 +286,7 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
}else {
|
|
|
wself.recordEndCallBack?(false, nil)
|
|
|
wself.videoModel.locationPath = "nil"
|
|
|
+ wself.cameraProgressV?.newRecordLine = true
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -325,7 +326,9 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
|
|
|
override func recordFinished(isSuccess:Bool) {
|
|
|
recordFinishedResult = isSuccess
|
|
|
+ groupCount = groupCount - 1
|
|
|
gropQueue.leave()
|
|
|
+
|
|
|
}
|
|
|
|
|
|
override func deleteRecord(at: CMTime) {
|
|
@@ -739,6 +742,62 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
}
|
|
|
|
|
|
// MARK: - 私有方法
|
|
|
+
|
|
|
+ /// 为播放/录制启动定时器
|
|
|
+ /// - Parameter isPlay: 是播放么? true为播放,false为录制
|
|
|
+ func startTimer(isPlay: Bool) {
|
|
|
+
|
|
|
+ let startPlayTime = Date()
|
|
|
+ let startProgress = currentAssetProgress
|
|
|
+
|
|
|
+ timerr?.invalidate()
|
|
|
+ timerr = Timer.scheduledTimer(withTimeInterval: 0.01, repeats: true, block: {[weak self] _ in
|
|
|
+ guard let wself = self else { return }
|
|
|
+
|
|
|
+ let currTime = startProgress + CMTime(seconds: Date().timeIntervalSince(startPlayTime), preferredTimescale: 1000)
|
|
|
+
|
|
|
+ if isPlay {
|
|
|
+ wself.timerForPlay(currTime: currTime)
|
|
|
+ } else {
|
|
|
+ wself.timerForRecord(currTime: currTime)
|
|
|
+ }
|
|
|
+
|
|
|
+// wself.getThumImage()
|
|
|
+ })
|
|
|
+ RunLoop.current.add(timerr!, forMode: .common)
|
|
|
+ }
|
|
|
+
|
|
|
+ func timerForPlay(currTime:CMTime){
|
|
|
+ dele?.progreddL.text = String(format: "%@", max(0, min(currTime.seconds, (recordItem?.materialDuraion.seconds ?? 0))).formatDurationToHMS())
|
|
|
+ currentAssetProgress = min(currTime, (recordItem?.materialDuraion ?? .zero))
|
|
|
+ dele?.progressThumV.progress = currentAssetProgress
|
|
|
+ dele?.updateSubtitle(time: currentAssetProgress)
|
|
|
+
|
|
|
+ if currTime.seconds >= (recordItem?.materialDuraion.seconds ?? 0) {
|
|
|
+ dele?.pause()
|
|
|
+ isPlaying = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ checkCurrentPlayStatus()
|
|
|
+ }
|
|
|
+
|
|
|
+ func timerForRecord(currTime:CMTime){
|
|
|
+ if BFRecordScreenCameraManager.initOpenCamera {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //MARK: 进度计时器
|
|
|
+
|
|
|
+ let currDur = CMTime(seconds: videoModel.timelineCMIn.seconds + (movieWrite?.duration.seconds ?? 0), preferredTimescale: 1000)
|
|
|
+ if CMTimeCompare(currDur, currentAssetProgress) > 0 {
|
|
|
+ increaseTime = currDur - currentAssetProgress
|
|
|
+ currentAssetProgress = currDur
|
|
|
+ videoModel.timelineCMOut = currDur
|
|
|
+ recordProgressCallBack?(currDur)
|
|
|
+ updateUI(progress: currDur)
|
|
|
+// BFLog(1, message: "frame: \(currentAssetProgress.seconds)")
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 定位到某个时间点,相应进度条的UI更新
|
|
|
func locationTo(time:CMTime) {
|