|
@@ -901,7 +901,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- BFLog(1, message: "添加录音文件:\(model.startCMTime.seconds) -- \(model.endCMTime.seconds)")
|
|
|
+ BFLog(1, message: "录音文件时长:\(model.startCMTime.seconds) -- \(model.endCMTime.seconds)")
|
|
|
wself.itemModels[wself.currItemModelIndex].voiceStickers.append(model)
|
|
|
// 录制结束回调
|
|
|
wself.recordEndHandle?(model)
|
|
@@ -1421,7 +1421,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
itemModels[currItemModelIndex].materialDuraion = model.startCMTime
|
|
|
}else if currMediaType == .Camera {
|
|
|
let video = rscmanager.recordItem?.videoStickers.last
|
|
|
- rscmanager.revertLast()
|
|
|
+ rscmanager.revertLast(modelIndex)
|
|
|
itemModels[currItemModelIndex].materialDuraion = video?.timelineCMIn ?? .zero
|
|
|
}
|
|
|
}
|
|
@@ -1435,68 +1435,77 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
CMTimeCompare(m1.startCMTime, m2.startCMTime) < 0
|
|
|
}
|
|
|
|
|
|
- if let first = tuples.first, let end = tuples.last {
|
|
|
- let currDuration = end.endCMTime - first.startCMTime
|
|
|
- itemModels[currItemModelIndex].materialDuraion = itemModels[currItemModelIndex].materialDuraion + currDuration
|
|
|
+ var firstTime = 0.0
|
|
|
+ var currDuration : CMTime = .zero
|
|
|
+
|
|
|
+ if currMediaType == .Camera, let first = action.deletedCameras?.first, let end = action.deletedCameras?.last {
|
|
|
+ firstTime = first.timelineCMIn.seconds
|
|
|
+ currDuration = (end.timelineCMOut - first.timelineCMIn)
|
|
|
+ }else if currMediaType == .Image, let first = tuples.first, let end = tuples.last {
|
|
|
+ firstTime = first.startCMTime.seconds
|
|
|
+ currDuration = end.endCMTime - first.startCMTime
|
|
|
+ }
|
|
|
+
|
|
|
+ BFLog(1, message: "恢复删除时长:\(currDuration.seconds)")
|
|
|
+
|
|
|
+ itemModels[currItemModelIndex].materialDuraion = itemModels[currItemModelIndex].materialDuraion + currDuration
|
|
|
+
|
|
|
+ // 恢复录音的时间点
|
|
|
+ let list = itemModels[currItemModelIndex].voiceStickers.filter({ mod in
|
|
|
+ CMTimeCompare(mod.startCMTime, CMTime(seconds: firstTime, preferredTimescale: 1000)) >= 0
|
|
|
+ })
|
|
|
+
|
|
|
+ list.forEach { mod in
|
|
|
+ mod.startCMTime = mod.startCMTime + currDuration
|
|
|
+ mod.endCMTime = mod.endCMTime + currDuration
|
|
|
|
|
|
- // 恢复录音的时间点
|
|
|
- let list = itemModels[currItemModelIndex].voiceStickers.filter({ mod in
|
|
|
- CMTimeCompare(mod.startCMTime, first.startCMTime) >= 0
|
|
|
- })
|
|
|
+ // 恢复字幕的时间点
|
|
|
+ let titlsList = itemModels[currItemModelIndex].titleStickers.filter { tm in
|
|
|
+ tm.recordId == mod.recordId
|
|
|
+ }
|
|
|
+
|
|
|
+ for titleM in titlsList {
|
|
|
+ titleM.timelineIn = titleM.timelineIn + currDuration
|
|
|
+ titleM.timelineOut = titleM.timelineOut + currDuration
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- list.forEach { mod in
|
|
|
- mod.startCMTime = mod.startCMTime + currDuration
|
|
|
- mod.endCMTime = mod.endCMTime + currDuration
|
|
|
-
|
|
|
- // 恢复字幕的时间点
|
|
|
- let titlsList = itemModels[currItemModelIndex].titleStickers.filter { tm in
|
|
|
- tm.recordId == mod.recordId
|
|
|
- }
|
|
|
-
|
|
|
- for titleM in titlsList {
|
|
|
- titleM.timelineIn = titleM.timelineIn + currDuration
|
|
|
- titleM.timelineOut = titleM.timelineOut + currDuration
|
|
|
+ if currMediaType == .Camera {
|
|
|
+ rscmanager.cameraProgressV?.isHidden = false
|
|
|
+ // 恢复录像的时间点
|
|
|
+ _ = itemModels[currItemModelIndex].videoStickers.map { mod in
|
|
|
+ if CMTimeCompare(mod.timelineCMIn, CMTime(seconds: firstTime, preferredTimescale: 1000)) >= 0{
|
|
|
+ mod.timelineCMIn = mod.timelineCMIn + currDuration
|
|
|
+ mod.timelineCMOut = mod.timelineCMOut + currDuration
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if currMediaType == .Camera {
|
|
|
- rscmanager.cameraProgressV?.isHidden = false
|
|
|
- // 恢复录像的时间点
|
|
|
- _ = itemModels[currItemModelIndex].videoStickers.map { mod in
|
|
|
- if CMTimeCompare(mod.timelineCMIn, first.startCMTime) >= 0{
|
|
|
- mod.timelineCMIn = mod.timelineCMIn + currDuration
|
|
|
- mod.timelineCMOut = mod.timelineCMOut + currDuration
|
|
|
- }
|
|
|
+ // 摄像头录制的
|
|
|
+ if let videoTuple = action.deletedCameras {
|
|
|
+ itemModels[currItemModelIndex].videoStickers.append(contentsOf: videoTuple)
|
|
|
+ itemModels[currItemModelIndex].videoStickers.sort { m1, m2 in
|
|
|
+ CMTimeCompare(m1.timelineCMIn, m2.timelineCMIn) < 0
|
|
|
}
|
|
|
-
|
|
|
- // 摄像头录制的
|
|
|
- if let videoTuple = action.deletedCameras {
|
|
|
- itemModels[currItemModelIndex].videoStickers.append(contentsOf: videoTuple)
|
|
|
- itemModels[currItemModelIndex].videoStickers.sort { m1, m2 in
|
|
|
- CMTimeCompare(m1.timelineCMIn, m2.timelineCMIn) < 0
|
|
|
- }
|
|
|
- itemModels[currItemModelIndex].thumbImgs.removeAll()
|
|
|
- itemModels[currItemModelIndex].videoStickers.forEach { mod in
|
|
|
- if let thumImag = mod.thumImgs{
|
|
|
- itemModels[currItemModelIndex].thumbImgs.append(contentsOf: thumImag)
|
|
|
- }
|
|
|
- }
|
|
|
- DispatchQueue.main.async {[weak self] in
|
|
|
- guard let wself = self else { return }
|
|
|
-
|
|
|
- wself.rscmanager.cameraProgressV?.collectionV.reloadData()
|
|
|
+ itemModels[currItemModelIndex].thumbImgs.removeAll()
|
|
|
+ itemModels[currItemModelIndex].videoStickers.forEach { mod in
|
|
|
+ if let thumImag = mod.thumImgs{
|
|
|
+ itemModels[currItemModelIndex].thumbImgs.append(contentsOf: thumImag)
|
|
|
}
|
|
|
}
|
|
|
+ DispatchQueue.main.async {[weak self] in
|
|
|
+ guard let wself = self else { return }
|
|
|
+
|
|
|
+ wself.rscmanager.cameraProgressV?.collectionV.reloadData()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
itemModels[currItemModelIndex].voiceStickers.append(contentsOf: tuples)
|
|
|
itemModels[currItemModelIndex].voiceStickers.sort { m1, m2 in
|
|
|
CMTimeCompare(m1.startCMTime, m2.startCMTime) < 0
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
// 恢复字幕
|
|
|
|