Parcourir la source

选中自定义速度后 ,默认选择自定义选项

jsonwang il y a 3 ans
Parent
commit
4274afd1a2

+ 22 - 6
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -352,6 +352,8 @@ class PQStuckPointEditerController: PQBaseViewController {
                 self?.minSpeed = minSpeed
                 BFLog(message: "自定义速度maxSpeed is\(maxSpeed) minSpeed \(minSpeed) \(isJumpSpeedModel)")
                 self?.settingPlayerView()
+                //确认后 选中自定义
+                self?.speedSettingView.selectCustom()
             }else{
                 
                 //取消后恢复上一次选择的位置
@@ -1092,14 +1094,18 @@ extension PQStuckPointEditerController {
                                 let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + sticker.locationPath), options: nil)
 
                                 var realUsedMusicDuration = 0.0
-
+                                
+//                                if(model == .createStickersModelOnlyMusic){
+//                                    sticker.clipCount = 1
+//                                }
                                 BFLog(message: "单个视频\(sticker.locationPath)时长::\(CMTimeGetSeconds(asset.duration)) ,clipNum is:\(sticker.clipCount)")
                                 var lastOutTime: Float64 = 0.0
                                 for clipindex in 0 ... sticker.clipCount - 1 {
                                     // deep copy sticker model 防止只有一个对象
-                                    let stickerjson = sticker.toJSONString(prettyPrint: false)
                                     let deepCopyStickerDecoderTime: TimeInterval = Date().timeIntervalSince1970
 
+                                    let stickerjson = sticker.toJSONString(prettyPrint: false)
+                              
                                     let deepCopySticker =  Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: stickerjson!)
                                     
                                     BFLog(message: "生成stickers 总时长为 aaa\(Date().timeIntervalSince1970 - deepCopyStickerDecoderTime)")
@@ -1116,11 +1122,21 @@ extension PQStuckPointEditerController {
 
                                         // 定义临时使用的变量
                                         // 素材分割的开始时间和结束时间
-                                        let tempModel_In = lastOutTime
-                                        let tempOut = lastOutTime + Float64(tempSpeed) * Float64(finallyStuckPoints[totalClipNum + 1 + clipindex] - finallyStuckPoints[totalClipNum + clipindex])
+                                        var tempModel_In = lastOutTime
+                                        var tempOut = lastOutTime + Float64(tempSpeed) * Float64(finallyStuckPoints[totalClipNum + 1 + clipindex] - finallyStuckPoints[totalClipNum + clipindex])
                                         // 素材显示的开始时间和结束时间
-                                        let tempTimelineIn = Float64(finallyStuckPoints[totalClipNum + clipindex])
-                                        let timelineOut = Float64(finallyStuckPoints[totalClipNum + 1 + clipindex])
+                                        
+                                        var tempTimelineIn = Float64(finallyStuckPoints[totalClipNum + clipindex])
+                                        var timelineOut = Float64(finallyStuckPoints[totalClipNum + 1 + clipindex])
+                                        
+//                                        if model == .createStickersModelOnlyMusic {
+//                                            tempModel_In = 0
+//                                            tempOut = CMTimeGetSeconds(asset.duration)
+//
+//                                            tempTimelineIn = lastOutTime
+//
+//                                            timelineOut = tempTimelineIn + tempOut
+//                                        }
 
                                         // 处理最后一点视频素材不够卡点时长 e.g. 0.3 卡点时长0.5
                                         if tempOut > CMTimeGetSeconds(asset.duration) {

+ 10 - 0
BFFramework/Classes/Stuckpoint/View/PQSpeedSettingView.swift

@@ -160,6 +160,16 @@ class PQSpeedSettingView: UIView {
  
         }
     }
+    
+    //选中自定义
+    func selectCustom() {
+        
+        lastSelectModel?.isSelected = false
+        lastSelectModel = datas.last
+        lastSelectModel?.isSelected = true
+        titleCollectionView.reloadData()
+         
+    }
 }
 
 extension PQSpeedSettingView: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UIScrollViewDelegate {