|
@@ -494,7 +494,7 @@ class PQStuckPointEditerController: PQBaseViewController {
|
|
|
// 1,音乐面板点击了使用
|
|
|
stuckPointMusicData = musicData
|
|
|
// 2,同步最新音乐数据
|
|
|
- synchroMusicInfoData()
|
|
|
+ synchroMusicInfoData(resetSelectIndex: false)
|
|
|
|
|
|
// 3,更新音乐标题UI
|
|
|
let nameWidth: CGFloat = sizeWithText(text: "\(stuckPointMusicData?.musicName ?? "")", font: UIFont.systemFont(ofSize: 13), size: CGSize(width: (view.frame.width) - ((cDefaultMargin * 6 + 16 * 2) * 2) - (25 + cDefaultMargin * 3), height: cDefaultMargin * 3)).width
|
|
@@ -1641,7 +1641,7 @@ extension PQStuckPointEditerController {
|
|
|
extension PQStuckPointEditerController {
|
|
|
/// 同步音乐相关数据
|
|
|
/// - Returns: <#description#>
|
|
|
- func synchroMusicInfoData() {
|
|
|
+ func synchroMusicInfoData(resetSelectIndex:Bool = true) {
|
|
|
if (stuckPointMusicData?.rhythmSdata.count ?? 0) <= 0 {
|
|
|
if synchroMarskView.superview == nil {
|
|
|
UIApplication.shared.keyWindow?.addSubview(synchroMarskView)
|
|
@@ -1663,14 +1663,14 @@ extension PQStuckPointEditerController {
|
|
|
self?.isSynchroMusicInfoSuccess = true
|
|
|
self?.stuckPointMusicData?.localPath = filePath?.replacingOccurrences(of: documensDirectory, with: "")
|
|
|
// 处理所有数据完成
|
|
|
- self?.dealWithDataSuccess()
|
|
|
+ self?.dealWithDataSuccess(resetSelectIndex: resetSelectIndex)
|
|
|
}
|
|
|
self?.synchroMarskView.removeMarskView()
|
|
|
}
|
|
|
} else {
|
|
|
self?.isSynchroMusicInfoSuccess = true
|
|
|
// 处理所有数据完成
|
|
|
- self?.dealWithDataSuccess()
|
|
|
+ self?.dealWithDataSuccess(resetSelectIndex: resetSelectIndex)
|
|
|
}
|
|
|
// 添加子视图
|
|
|
self?.addSubViews()
|
|
@@ -1689,7 +1689,7 @@ extension PQStuckPointEditerController {
|
|
|
self?.isSynchroMusicInfoSuccess = true
|
|
|
self?.stuckPointMusicData?.localPath = filePath?.replacingOccurrences(of: documensDirectory, with: "")
|
|
|
// 处理所有数据完成
|
|
|
- self?.dealWithDataSuccess()
|
|
|
+ self?.dealWithDataSuccess(resetSelectIndex: resetSelectIndex)
|
|
|
} else {
|
|
|
self?.synchroMarskView.removeMarskView()
|
|
|
// PQUploadRemindView.showUploadRemindView(title: nil, attributedTitle: NSAttributedString(string: "加载音乐失败,请重新选择音乐"), summary: "", confirmTitle: nil) { [weak self] _, _ in
|
|
@@ -1700,7 +1700,7 @@ extension PQStuckPointEditerController {
|
|
|
} else {
|
|
|
isStuckPointDataSuccess = true
|
|
|
// 处理所有数据完成
|
|
|
- dealWithDataSuccess()
|
|
|
+ dealWithDataSuccess(resetSelectIndex: resetSelectIndex)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1791,7 +1791,8 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
/// 处理所有数据完成
|
|
|
/// - Returns: <#description#>
|
|
|
- func dealWithDataSuccess() {
|
|
|
+ /// resetSelectIndex : 是否重置用户选择的速度设置,在编辑界面切换音乐时不重置
|
|
|
+ func dealWithDataSuccess(resetSelectIndex:Bool = true) {
|
|
|
BFLog(message: "三组参数:\(isSynchroMusicInfoSuccess) \(isStuckPointDataSuccess) \(isExportVideosSuccess)")
|
|
|
if !isSynchroMusicInfoSuccess || !isStuckPointDataSuccess || !isExportVideosSuccess {
|
|
|
return
|
|
@@ -1800,100 +1801,104 @@ extension PQStuckPointEditerController {
|
|
|
createPorjectData()
|
|
|
BFLog(message: "界面编辑界面时参数 选择素材时长:\(selectedTotalDuration) 选择素材总数:\(selectedDataCount) 选择图片总数\(selectedImageDataCount) 再创建类型:\(String(describing: reCreateVideoData?.rhythmMode))")
|
|
|
|
|
|
- // 1 生成默认参数值
|
|
|
- /*
|
|
|
- - 当素材总时长∈[0-6)s 时,提示推荐仅配乐模式 or 快慢速模式
|
|
|
- - 当素材总时长∈[6-80)s 时,卡点抛留倍数为1x,即留1抛1
|
|
|
- - 当素材总时长∈[80,120)s 时,卡点抛留倍数为2x,即留1抛2
|
|
|
- - 当素材总时长∈[120,160)s 时,卡点抛留倍数为3x,即留1抛3
|
|
|
- - 当素材总时长∈[160,200)s 时,卡点抛留倍数为4x,即留1抛4
|
|
|
- - 当素材总时长∈[200,240)s 时,卡点抛留倍数为5x,即留1抛5
|
|
|
- - 当素材总时长∈[240,∞)s 时,卡点抛留倍数为5x,即留1抛5
|
|
|
- */
|
|
|
- // 1.1) 生成跳跃卡点的默认值
|
|
|
- if selectedTotalDuration >= 6 && selectedTotalDuration < 80 {
|
|
|
- lastJumpSpeedSelectIndex = 0
|
|
|
- } else if selectedTotalDuration >= 80 && selectedTotalDuration < 120 {
|
|
|
- lastJumpSpeedSelectIndex = 1
|
|
|
- } else if selectedTotalDuration >= 120 && selectedTotalDuration < 160 {
|
|
|
- lastJumpSpeedSelectIndex = 2
|
|
|
- } else if selectedTotalDuration >= 160 && selectedTotalDuration < 200 {
|
|
|
- lastJumpSpeedSelectIndex = 3
|
|
|
- } else if (selectedTotalDuration >= 200 && selectedTotalDuration < 240) || selectedTotalDuration >= 240 {
|
|
|
- lastJumpSpeedSelectIndex = 4
|
|
|
- }
|
|
|
-
|
|
|
- /* 默认进入快慢速模式
|
|
|
- - 当素材总时长∈[120,144]s 时,快慢速处理方式:快速为 6x,慢速为 1.2x,效果是快&快
|
|
|
- - 当素材总时长∈[70,120)s 时,快慢速处理方式:快速为5x,慢速为 1x,效果是快&正常
|
|
|
- - 当素材总时长∈[56,70)s 时,快慢速处理方式:快速为3x,慢速为 0.5x,效果是快&慢
|
|
|
- - 当素材总时长∈[17.5,56)s 时,快慢速处理方式:快速为 2.4x,慢速为 0.4x,效果是快&慢
|
|
|
- - 当素材总时长∈[10.5,17.5)s 时,快慢速处理方式:快速为 1.8x,慢速为 0.3x,效果是快&慢
|
|
|
- - 当素材总时长∈(0,10.5)s 时,快慢速处理方式:快速为 1x,慢速为 0.2x,效果是正常&慢
|
|
|
+ if(resetSelectIndex){
|
|
|
+ // 1 生成默认参数值
|
|
|
+ /*
|
|
|
+ - 当素材总时长∈[0-6)s 时,提示推荐仅配乐模式 or 快慢速模式
|
|
|
+ - 当素材总时长∈[6-80)s 时,卡点抛留倍数为1x,即留1抛1
|
|
|
+ - 当素材总时长∈[80,120)s 时,卡点抛留倍数为2x,即留1抛2
|
|
|
+ - 当素材总时长∈[120,160)s 时,卡点抛留倍数为3x,即留1抛3
|
|
|
+ - 当素材总时长∈[160,200)s 时,卡点抛留倍数为4x,即留1抛4
|
|
|
+ - 当素材总时长∈[200,240)s 时,卡点抛留倍数为5x,即留1抛5
|
|
|
+ - 当素材总时长∈[240,∞)s 时,卡点抛留倍数为5x,即留1抛5
|
|
|
+ */
|
|
|
+ // 1.1) 生成跳跃卡点的默认值
|
|
|
+ if selectedTotalDuration >= 6 && selectedTotalDuration < 80 {
|
|
|
+ lastJumpSpeedSelectIndex = 0
|
|
|
+ } else if selectedTotalDuration >= 80 && selectedTotalDuration < 120 {
|
|
|
+ lastJumpSpeedSelectIndex = 1
|
|
|
+ } else if selectedTotalDuration >= 120 && selectedTotalDuration < 160 {
|
|
|
+ lastJumpSpeedSelectIndex = 2
|
|
|
+ } else if selectedTotalDuration >= 160 && selectedTotalDuration < 200 {
|
|
|
+ lastJumpSpeedSelectIndex = 3
|
|
|
+ } else if (selectedTotalDuration >= 200 && selectedTotalDuration < 240) || selectedTotalDuration >= 240 {
|
|
|
+ lastJumpSpeedSelectIndex = 4
|
|
|
+ }
|
|
|
|
|
|
- */
|
|
|
- // 1.2)生成快慢速的默认值
|
|
|
- if selectedTotalDuration >= 120 && selectedTotalDuration <= 144 || selectedTotalDuration > 144 {
|
|
|
- lastSpeedSelectIndex = 5
|
|
|
- } else if selectedTotalDuration >= 70 && selectedTotalDuration < 120 {
|
|
|
- lastSpeedSelectIndex = 4
|
|
|
- } else if selectedTotalDuration >= 56 && selectedTotalDuration < 70 {
|
|
|
- lastSpeedSelectIndex = 3
|
|
|
- } else if selectedTotalDuration >= 17.5 && selectedTotalDuration < 56 {
|
|
|
- lastSpeedSelectIndex = 2
|
|
|
- } else if selectedTotalDuration >= 10.5 && selectedTotalDuration < 17.5 {
|
|
|
- lastSpeedSelectIndex = 1
|
|
|
- } else if selectedTotalDuration > 0 && selectedTotalDuration < 10.5 {
|
|
|
- lastSpeedSelectIndex = 0
|
|
|
- }
|
|
|
-
|
|
|
- // 如果是再创作进来的安原视频的模式
|
|
|
- if reCreateVideoData != nil {
|
|
|
- BFLog(message: "是再创作进来的 \(reCreateVideoData!.rhythmMode)")
|
|
|
- switch reCreateVideoData!.rhythmMode {
|
|
|
- case 1:
|
|
|
- editModelClick(sender: jumpPointBtn, reportLog: false)
|
|
|
- break
|
|
|
- case 2:
|
|
|
- editModelClick(sender: speedStuckBtn, reportLog: false)
|
|
|
+ /* 默认进入快慢速模式
|
|
|
+ - 当素材总时长∈[120,144]s 时,快慢速处理方式:快速为 6x,慢速为 1.2x,效果是快&快
|
|
|
+ - 当素材总时长∈[70,120)s 时,快慢速处理方式:快速为5x,慢速为 1x,效果是快&正常
|
|
|
+ - 当素材总时长∈[56,70)s 时,快慢速处理方式:快速为3x,慢速为 0.5x,效果是快&慢
|
|
|
+ - 当素材总时长∈[17.5,56)s 时,快慢速处理方式:快速为 2.4x,慢速为 0.4x,效果是快&慢
|
|
|
+ - 当素材总时长∈[10.5,17.5)s 时,快慢速处理方式:快速为 1.8x,慢速为 0.3x,效果是快&慢
|
|
|
+ - 当素材总时长∈(0,10.5)s 时,快慢速处理方式:快速为 1x,慢速为 0.2x,效果是正常&慢
|
|
|
|
|
|
- break
|
|
|
- case 3:
|
|
|
- editModelClick(sender: onlyMusicBtn, reportLog: false)
|
|
|
- break
|
|
|
- default: break
|
|
|
+ */
|
|
|
+ // 1.2)生成快慢速的默认值
|
|
|
+ if selectedTotalDuration >= 120 && selectedTotalDuration <= 144 || selectedTotalDuration > 144 {
|
|
|
+ lastSpeedSelectIndex = 5
|
|
|
+ } else if selectedTotalDuration >= 70 && selectedTotalDuration < 120 {
|
|
|
+ lastSpeedSelectIndex = 4
|
|
|
+ } else if selectedTotalDuration >= 56 && selectedTotalDuration < 70 {
|
|
|
+ lastSpeedSelectIndex = 3
|
|
|
+ } else if selectedTotalDuration >= 17.5 && selectedTotalDuration < 56 {
|
|
|
+ lastSpeedSelectIndex = 2
|
|
|
+ } else if selectedTotalDuration >= 10.5 && selectedTotalDuration < 17.5 {
|
|
|
+ lastSpeedSelectIndex = 1
|
|
|
+ } else if selectedTotalDuration > 0 && selectedTotalDuration < 10.5 {
|
|
|
+ lastSpeedSelectIndex = 0
|
|
|
}
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
+ // 如果是再创作进来的安原视频的模式
|
|
|
+ if reCreateVideoData != nil {
|
|
|
+ BFLog(message: "是再创作进来的 \(reCreateVideoData!.rhythmMode)")
|
|
|
+ switch reCreateVideoData!.rhythmMode {
|
|
|
+ case 1:
|
|
|
+ editModelClick(sender: jumpPointBtn, reportLog: false)
|
|
|
+ break
|
|
|
+ case 2:
|
|
|
+ editModelClick(sender: speedStuckBtn, reportLog: false)
|
|
|
+
|
|
|
+ break
|
|
|
+ case 3:
|
|
|
+ editModelClick(sender: onlyMusicBtn, reportLog: false)
|
|
|
+ break
|
|
|
+ default: break
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 跳跃卡点不可用
|
|
|
+ if selectedTotalDuration < 6 && selectedDataCount != selectedImageDataCount {
|
|
|
+ jumpPointBtn.setImage(UIImage().BF_Image(named: "jumpPoint_disable"), for: .normal)
|
|
|
+ jumpPointBtn.setImage(UIImage().BF_Image(named: "jumpPoint_disable"), for: .selected)
|
|
|
+ jumpPointBtnGif.isHidden = true
|
|
|
+ }
|
|
|
|
|
|
- // 跳跃卡点不可用
|
|
|
- if selectedTotalDuration < 6 && selectedDataCount != selectedImageDataCount {
|
|
|
- jumpPointBtn.setImage(UIImage().BF_Image(named: "jumpPoint_disable"), for: .normal)
|
|
|
- jumpPointBtn.setImage(UIImage().BF_Image(named: "jumpPoint_disable"), for: .selected)
|
|
|
- jumpPointBtnGif.isHidden = true
|
|
|
- }
|
|
|
+ /*
|
|
|
+ 文档规则 https://w42nne6hzg.feishu.cn/docs/doccnQZm1uCfkU4QtJb5fLxYk4d#
|
|
|
+ */
|
|
|
+ // 2,根据所选择所有素材时长进入默认模式
|
|
|
+ // 全是图片
|
|
|
+ if selectedDataCount == selectedImageDataCount {
|
|
|
+ BFLog(message: "全是图片 \(selectedDataCount) \(selectedImageDataCount)")
|
|
|
|
|
|
- /*
|
|
|
- 文档规则 https://w42nne6hzg.feishu.cn/docs/doccnQZm1uCfkU4QtJb5fLxYk4d#
|
|
|
- */
|
|
|
- // 2,根据所选择所有素材时长进入默认模式
|
|
|
- // 全是图片
|
|
|
- if selectedDataCount == selectedImageDataCount {
|
|
|
- BFLog(message: "全是图片 \(selectedDataCount) \(selectedImageDataCount)")
|
|
|
+ // 默认进入跳跃卡点模式
|
|
|
+ editModelClick(sender: jumpPointBtn, reportLog: false)
|
|
|
|
|
|
- // 默认进入跳跃卡点模式
|
|
|
- editModelClick(sender: jumpPointBtn, reportLog: false)
|
|
|
+ } else {
|
|
|
+ // 默认进入快慢速模式
|
|
|
+ if selectedTotalDuration > 0 && selectedTotalDuration <= 144 {
|
|
|
+ editModelClick(sender: speedStuckBtn, reportLog: false)
|
|
|
|
|
|
- } else {
|
|
|
- // 默认进入快慢速模式
|
|
|
- if selectedTotalDuration > 0 && selectedTotalDuration <= 144 {
|
|
|
- editModelClick(sender: speedStuckBtn, reportLog: false)
|
|
|
+ } else {
|
|
|
+ // 默认进入卡点模式
|
|
|
+ editModelClick(sender: jumpPointBtn, reportLog: false)
|
|
|
|
|
|
- } else {
|
|
|
-// // 默认进入卡点模式
|
|
|
-// editModelClick(sender: jumpPointBtn, reportLog: false)
|
|
|
- editModelClick(sender: lastEditModelBtn ?? jumpPointBtn, reportLog: false)
|
|
|
+ }
|
|
|
}
|
|
|
+ }else{
|
|
|
+ editModelClick(sender: lastEditModelBtn ?? jumpPointBtn, reportLog: false)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|