|
@@ -1172,6 +1172,28 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
return stickers
|
|
|
}
|
|
|
+
|
|
|
+ //更新 playeTimeRange & finallyUserAudioTime
|
|
|
+ func updateTimeInfomation(){
|
|
|
+ // 四,背景音乐时长处理)计算最后使用的音频时长, 如果不用拼接音频时长度是卡点的倒数第二位时间
|
|
|
+ let asset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + (stuckPointMusicData?.localPath ?? "")), options: nil)
|
|
|
+
|
|
|
+ // 原推荐卡点的倒数第二位时间
|
|
|
+ let lastSecondPoint = Float((stuckPointMusicData!.rhythmSdata[0].pointTimes[stuckPointMusicData!.rhythmSdata[0].pointTimes.count - 2])) / Float(BASE_FILTER_TIMESCALE)
|
|
|
+
|
|
|
+ finallyUserAudioTime = Float(lastSecondPoint)
|
|
|
+ if (finallyStuckPoints.last ?? 0) > Float(CMTimeGetSeconds(asset.duration)) {
|
|
|
+ finallyUserAudioTime = Float(finallyStuckPoints.last ?? 0) + (Float(CMTimeGetSeconds(asset.duration)) - Float(lastSecondPoint))
|
|
|
+ }
|
|
|
+
|
|
|
+ playeTimeRange = CMTimeRange(start: CMTime(value: CMTimeValue(Float64(finallyStuckPoints.first ?? 0) * Float64(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE), end: CMTime(value: CMTimeValue((Float64(finallyStuckPoints.last ?? 0)) * Float64(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE))
|
|
|
+
|
|
|
+ for (index, usePoint) in finallyStuckPoints.enumerated() {
|
|
|
+ BFLog(message: "测试人员最后使用的卡点信息 \(index) : \(usePoint)")
|
|
|
+ }
|
|
|
+
|
|
|
+ BFLog(message: "计算后给播放器使用的开始:\(CMTimeGetSeconds(playeTimeRange.start)) 结束时间\(CMTimeGetSeconds(playeTimeRange.end)) 播放总时长:\(CMTimeGetSeconds(playeTimeRange.end) - CMTimeGetSeconds(playeTimeRange.start))")
|
|
|
+ }
|
|
|
|
|
|
/// 创建sticker
|
|
|
/// - Parameters:
|
|
@@ -1214,6 +1236,25 @@ extension PQStuckPointEditerController {
|
|
|
if model == .createStickersModelPoint { // 跳跃卡点
|
|
|
// 第二种情况:有视频要进行分割
|
|
|
let clipFilters = clipVideoMerage(section: section, stuckPoints: finallyStuckPoints)
|
|
|
+
|
|
|
+ //
|
|
|
+ if(clipFilters.count > finallyStuckPoints.count){
|
|
|
+
|
|
|
+ clipPoint(clipNum: clipFilters.count - finallyStuckPoints.count, oldPoints: finallyStuckPoints)
|
|
|
+
|
|
|
+ // 四,背景音乐时长处理)计算最后使用的音频时长, 如果不用拼接音频时长度是卡点的倒数第二位时间
|
|
|
+ let asset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + (stuckPointMusicData?.localPath ?? "")), options: nil)
|
|
|
+
|
|
|
+ }else if(clipFilters.count < finallyStuckPoints.count){
|
|
|
+
|
|
|
+ while (clipFilters.count < finallyStuckPoints.count) {
|
|
|
+ finallyStuckPoints.removeLast()
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //更新最终使用值
|
|
|
+ updateTimeInfomation()
|
|
|
+
|
|
|
for (index, point) in finallyStuckPoints.enumerated() {
|
|
|
BFLog(message: "aaaaaindexindeindexxindexindexindex \(index) \(point)")
|
|
|
if index + 1 < finallyStuckPoints.count, index < clipFilters.count {
|
|
@@ -1247,8 +1288,8 @@ extension PQStuckPointEditerController {
|
|
|
sticker.model_in = sticker.model_in - offsetAssetDuration
|
|
|
sticker.out = sticker.out - offsetAssetDuration
|
|
|
}
|
|
|
-
|
|
|
- BFLog(message: "跳跃卡点测试人员index is \(index)分割后 创建 filter timelineIn :\(sticker.timelineIn) timelineOut :\(sticker.timelineOut) in :\(sticker.model_in) out:\(sticker.out) type is \(sticker.type) 显示总时长为:\(sticker.timelineOut - sticker.timelineIn) 裁剪总时长\(sticker.out - sticker.model_in)")
|
|
|
+ print("跳跃卡点测试人员index is \(index)分割后 创建 filter timelineIn :\(sticker.timelineIn) timelineOut :\(sticker.timelineOut) in :\(sticker.model_in) out:\(sticker.out) type is \(sticker.type) 显示总时长为:\(sticker.timelineOut - sticker.timelineIn) 裁剪总时长\(sticker.out - sticker.model_in)")
|
|
|
+
|
|
|
|
|
|
stickers.append(sticker)
|
|
|
}
|
|
@@ -1650,24 +1691,7 @@ extension PQStuckPointEditerController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 四,背景音乐时长处理)计算最后使用的音频时长, 如果不用拼接音频时长度是卡点的倒数第二位时间
|
|
|
- let asset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + (stuckPointMusicData?.localPath ?? "")), options: nil)
|
|
|
-
|
|
|
- // 原推荐卡点的倒数第二位时间
|
|
|
- let lastSecondPoint = Float((stuckPointMusicData!.rhythmSdata[0].pointTimes[stuckPointMusicData!.rhythmSdata[0].pointTimes.count - 2])) / Float(BASE_FILTER_TIMESCALE)
|
|
|
-
|
|
|
- finallyUserAudioTime = Float(lastSecondPoint)
|
|
|
- if (finallyStuckPoints.last ?? 0) > Float(CMTimeGetSeconds(asset.duration)) {
|
|
|
- finallyUserAudioTime = Float(finallyStuckPoints.last ?? 0) + (Float(CMTimeGetSeconds(asset.duration)) - Float(lastSecondPoint))
|
|
|
- }
|
|
|
-
|
|
|
- playeTimeRange = CMTimeRange(start: CMTime(value: CMTimeValue(Float64(finallyStuckPoints.first ?? 0) * Float64(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE), end: CMTime(value: CMTimeValue((Float64(finallyStuckPoints.last ?? 0)) * Float64(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE))
|
|
|
-
|
|
|
- for (index, usePoint) in finallyStuckPoints.enumerated() {
|
|
|
- BFLog(message: "测试人员最后使用的卡点信息 \(index) : \(usePoint)")
|
|
|
- }
|
|
|
-
|
|
|
- BFLog(message: "计算后给播放器使用的开始:\(CMTimeGetSeconds(playeTimeRange.start)) 结束时间\(CMTimeGetSeconds(playeTimeRange.end)) 播放总时长:\(CMTimeGetSeconds(playeTimeRange.end) - CMTimeGetSeconds(playeTimeRange.start))")
|
|
|
+ updateTimeInfomation()
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1935,6 +1959,8 @@ extension PQStuckPointEditerController {
|
|
|
}else{
|
|
|
editModelClick(sender: lastEditModelBtn ?? jumpPointBtn, reportLog: false)
|
|
|
}
|
|
|
+
|
|
|
+ updateTimeInfomation()
|
|
|
|
|
|
}
|
|
|
}
|