|
@@ -267,16 +267,20 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
let cameraSuccess = wself.recordFinishedResult && ((wself.videoModel.timelineCMOut - wself.videoModel.timelineCMIn).seconds > 1)
|
|
let cameraSuccess = wself.recordFinishedResult && ((wself.videoModel.timelineCMOut - wself.videoModel.timelineCMIn).seconds > 1)
|
|
if cameraSuccess {
|
|
if cameraSuccess {
|
|
wself.increaseTime = wself.videoModel.timelineCMOut - wself.currentAssetProgress
|
|
wself.increaseTime = wself.videoModel.timelineCMOut - wself.currentAssetProgress
|
|
|
|
+
|
|
wself.currentAssetProgress = wself.videoModel.timelineCMOut
|
|
wself.currentAssetProgress = wself.videoModel.timelineCMOut
|
|
|
|
+
|
|
wself.recordEndCallBack?(true, wself.videoModel)
|
|
wself.recordEndCallBack?(true, wself.videoModel)
|
|
|
|
+ // 更新各录音时间点,在插入的时候
|
|
|
|
+ wself.coculationTotalDur()
|
|
|
|
+
|
|
wself.updateUI(progress: wself.currentAssetProgress)
|
|
wself.updateUI(progress: wself.currentAssetProgress)
|
|
if let img = wself.videoModel.thumImgs?.last{
|
|
if let img = wself.videoModel.thumImgs?.last{
|
|
wself.cameraProgressV?.changeSepline(img: img)
|
|
wself.cameraProgressV?.changeSepline(img: img)
|
|
}
|
|
}
|
|
- wself.coculationTotalDur()
|
|
|
|
}else {
|
|
}else {
|
|
- wself.videoModel.locationPath = "nil"
|
|
|
|
wself.recordEndCallBack?(false, nil)
|
|
wself.recordEndCallBack?(false, nil)
|
|
|
|
+ wself.videoModel.locationPath = "nil"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -296,9 +300,9 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
if !su {
|
|
if !su {
|
|
if let finalPath = PQBridgeObject.p_setupFileRename(vpath), finalPath.count > 0 {
|
|
if let finalPath = PQBridgeObject.p_setupFileRename(vpath), finalPath.count > 0 {
|
|
let dur = AVURLAsset(url: URL(fileURLWithPath: finalPath))
|
|
let dur = AVURLAsset(url: URL(fileURLWithPath: finalPath))
|
|
- BFLog(1, message: "文件时长camera:\(wself.recordItem?.videoStickers.count ?? 0), \(wself.videoModel.timelineCMIn.seconds)~\(wself.videoModel.timelineCMOut.seconds), \(dur.duration.seconds)")
|
|
|
|
|
|
|
|
wself.videoModel.timelineCMOut = wself.videoModel.timelineCMIn + CMTime(seconds: dur.duration.seconds, preferredTimescale: 1000)
|
|
wself.videoModel.timelineCMOut = wself.videoModel.timelineCMIn + CMTime(seconds: dur.duration.seconds, preferredTimescale: 1000)
|
|
|
|
+ BFLog(1, message: "文件时长camera:\(wself.recordItem?.videoStickers.count ?? 0), \(wself.videoModel.timelineCMIn.seconds)~\(wself.videoModel.timelineCMOut.seconds), \(dur.duration.seconds)")
|
|
wself.videoModel.locationPath = finalPath
|
|
wself.videoModel.locationPath = finalPath
|
|
}else{
|
|
}else{
|
|
cShowHUB(superView: nil, msg: "shoot_tips_least".BFLocale)
|
|
cShowHUB(superView: nil, msg: "shoot_tips_least".BFLocale)
|
|
@@ -361,16 +365,27 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- coculationTotalDur()
|
|
|
|
-
|
|
|
|
|
|
+ item.materialDuraion = item.videoStickers.last?.timelineCMOut ?? .zero
|
|
}
|
|
}
|
|
changeRecordMaterail()
|
|
changeRecordMaterail()
|
|
BFLog(1, message: "delete: video- \(recordItem?.videoStickers.count ?? 0), voice-\(recordItem?.voiceStickers.count ?? 0)")
|
|
BFLog(1, message: "delete: video- \(recordItem?.videoStickers.count ?? 0), voice-\(recordItem?.voiceStickers.count ?? 0)")
|
|
}
|
|
}
|
|
|
|
|
|
func coculationTotalDur(){
|
|
func coculationTotalDur(){
|
|
- recordItem?.materialDuraion = recordItem?.voiceStickers.reduce(.zero, { partialResult, voice in
|
|
|
|
- voice.endCMTime - voice.startCMTime + partialResult
|
|
|
|
|
|
+
|
|
|
|
+ if videoModel.locationPath != "nil" {
|
|
|
|
+ recordItem?.videoStickers.forEach({ mod in
|
|
|
|
+ if mod != videoModel, mod.timelineCMOut.seconds > videoModel.timelineCMIn.seconds {
|
|
|
|
+ mod.timelineCMIn = mod.timelineCMIn + videoModel.timelineCMOut - videoModel.timelineCMIn
|
|
|
|
+ mod.timelineCMOut = mod.timelineCMOut + videoModel.timelineCMOut - videoModel.timelineCMIn
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// resetThumbImg()
|
|
|
|
+
|
|
|
|
+ recordItem?.materialDuraion = recordItem?.videoStickers.reduce(.zero, { partialResult, voice in
|
|
|
|
+ voice.timelineCMOut - voice.timelineCMIn + partialResult
|
|
}) ?? .zero
|
|
}) ?? .zero
|
|
}
|
|
}
|
|
|
|
|
|
@@ -581,6 +596,8 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
avplayerReplaceItem(newItem: AVPlayerItem(url: URL(fileURLWithPath: mod.locationPath)))
|
|
avplayerReplaceItem(newItem: AVPlayerItem(url: URL(fileURLWithPath: mod.locationPath)))
|
|
|
|
|
|
// prepareToPlayNext(needPlay: false)
|
|
// prepareToPlayNext(needPlay: false)
|
|
|
|
+ }else{
|
|
|
|
+ playerCoverIV.isHidden = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -638,6 +655,8 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
cameraProgressV?.progressView.contentOffset = p
|
|
cameraProgressV?.progressView.contentOffset = p
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// 更新录音进度
|
|
|
|
+ /// - Parameter progress: 当前的进度
|
|
func updateUI(progress:CMTime){
|
|
func updateUI(progress:CMTime){
|
|
DispatchQueue.main.async {[weak self] in
|
|
DispatchQueue.main.async {[weak self] in
|
|
guard let wself = self else { return }
|
|
guard let wself = self else { return }
|
|
@@ -648,14 +667,6 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
if wself.recordItem?.thumbImgs.count ?? 0 > 0, let sticker = wself.recordItem?.videoStickers.first(where: { mod in
|
|
if wself.recordItem?.thumbImgs.count ?? 0 > 0, let sticker = wself.recordItem?.videoStickers.first(where: { mod in
|
|
CMTimeCompare(mod.timelineCMIn, progress) <= 0 && CMTimeCompare(mod.timelineCMOut, progress) >= 0
|
|
CMTimeCompare(mod.timelineCMIn, progress) <= 0 && CMTimeCompare(mod.timelineCMOut, progress) >= 0
|
|
}) {
|
|
}) {
|
|
- wself.recordItem?.videoStickers.forEach({ mod in
|
|
|
|
- if mod.timelineCMOut.seconds > progress.seconds {
|
|
|
|
-// BFLog(1, message: "insert before: \(mod.timelineCMIn.seconds)")
|
|
|
|
- mod.timelineCMIn = mod.timelineCMIn + wself.increaseTime
|
|
|
|
- mod.timelineCMOut = mod.timelineCMOut + wself.increaseTime
|
|
|
|
-// BFLog(1, message: "insert after: \(mod.timelineCMIn.seconds)")
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
wself.cameraProgressV?.updateCellWidth(sticker: sticker, progress: progress)
|
|
wself.cameraProgressV?.updateCellWidth(sticker: sticker, progress: progress)
|
|
}
|
|
}
|
|
|
|
|