소스 검색

合并代码

jsonwang 3 년 전
부모
커밋
80387f4f49

BIN
BFFramework/Assets/Stuckpoint/allPreview.png


BIN
BFFramework/Assets/Stuckpoint/loading@2x.png


BIN
BFFramework/Assets/Stuckpoint/loading@3x.png


BIN
BFFramework/Assets/Stuckpoint/musicEditerBtn_h.png


BIN
BFFramework/Assets/Stuckpoint/musicEditerBtn_n.png


BIN
BFFramework/Assets/Stuckpoint/stuckPoint_music_pause.png


BIN
BFFramework/Assets/Stuckpoint/stuckPoint_music_selected.png


+ 65 - 34
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -44,6 +44,14 @@ class PQStuckPointEditerController: PQBaseViewController {
     var mStickers: [PQEditVisionTrackMaterialsModel]?
     // 播放器的开始和结束时间,1,刚进界面使用推荐的开始结束时间,2,用户修改起结点时修改
     var playeTimeRange: CMTimeRange = CMTimeRange()
+    // 首帧图片
+    var firstFrameImage: UIImage?{
+        didSet{
+            if firstFrameImage != nil {
+                self.playerView.layer.contents = firstFrameImage?.cgImage
+            }
+        }
+    }
 
     // add by ak 是否是再创作模式
     var isReCreate: Bool = false
@@ -92,11 +100,11 @@ class PQStuckPointEditerController: PQBaseViewController {
 
     // 播放器显示 view
     lazy var playerView: PQGPUImagePlayerView = {
-        let playerHeight = cScreenWidth
-        let playerView = PQGPUImagePlayerView(frame: CGRect(x: 0, y: navHeadImageView?.frame.maxY ?? 0, width: playerHeight, height: playerHeight))
+        let playerView = PQGPUImagePlayerView(frame: .zero)
         playerView.backgroundColor = PQBFConfig.shared.styleBackGroundColor
         playerView.isShowLine = false
         playerView.showGaussianBlur = true
+        playerView.pause()
         playerView.renderViewOnClickHandle = { [weak self] in
             self?.musicEditBGView.pausePlayer()
         }
@@ -183,14 +191,13 @@ class PQStuckPointEditerController: PQBaseViewController {
                 }
 
                 DispatchQueue.global().async { // 并行、异步
-                    let beginTime: TimeInterval = Date().timeIntervalSince1970
+                    let beginTime = Date()
 
                     self?.mStickers = self?.createStickers(sections: self?.projectModel.sData?.sections ?? List(), inputSize: CGSize(width: CGFloat(self?.projectModel.sData?.videoMetaData?.videoWidth ?? 0), height: CGFloat(self?.projectModel.sData?.videoMetaData?.videoHeight ?? 0)), model: self?.currentCreateStickersModel ?? .createStickersModelSpeed)
 
                     DispatchQueue.main.async { // 串行、异步
                         self?.playerView.mStickers = self?.mStickers
-                        var endTime: TimeInterval = Date().timeIntervalSince1970
-                        BFLog(message: "endTime is endTimeendTime \(endTime = beginTime)")
+                        BFLog(message: "endTime is endTimeendTime \(Date().timeIntervalSince(beginTime))")
                         self?.playerView.play(pauseFirstFrame: false, playeTimeRange: self!.playeTimeRange)
 
                         // 更新一下时间条的UI总时间 及数据
@@ -370,15 +377,6 @@ class PQStuckPointEditerController: PQBaseViewController {
         return speedSetView
 
     }()
-    
-    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
-        super.touchesBegan(touches, with: event)
-        if touches.first?.view != self.customSpeedSettingView {
-            if !customSpeedSettingView.isHidden {
-                customSpeedSettingView.isHidden = true
-            }
-        }
-    }
 
     // 自定义速度
     lazy var customSpeedSettingView: PQCustomSpeedSettingView = {
@@ -658,7 +656,7 @@ class PQStuckPointEditerController: PQBaseViewController {
     }
 
     override func viewWillAppear(_ animated: Bool) {
-        super.viewDidAppear(animated)
+        super.viewWillAppear(animated)
         lineView?.isHidden = true
         UIApplication.shared.isIdleTimerDisabled = true
         musicNameLab.move()
@@ -692,6 +690,11 @@ class PQStuckPointEditerController: PQBaseViewController {
         PQEventTrackViewModel.baseReportUpload(businessType: .bt_windowView, objectType: .ot_view_previewSyncedUp, pageSource: .sp_stuck_previewSyncedUp, extParams: nil, remindmsg: "卡点视频数据上报-(曝光上报:预览页面曝光上报)")
     }
     
+    override func viewDidLayoutSubviews() {
+        super.viewDidLayoutSubviews()
+        playerView.resetCanvasFrame(frame: coculationPlayViewRect())
+    }
+    
     func prepareMeta(){
         // 导出相册视频
         exportPhotoData()
@@ -851,6 +854,15 @@ class PQStuckPointEditerController: PQBaseViewController {
         // 点击上报:去合成
         PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_click_commit, pageSource: .sp_stuck_previewSyncedUp, extParams: ["musicName": stuckPointMusicData?.musicName ?? "", "musicId": stuckPointMusicData?.musicId ?? "", "rhythmNumber": stuckPointMusicData?.speed ?? 2, "duration": ((stuckPointMusicData?.endTime ?? 0) - (stuckPointMusicData?.startTime ?? 0)) * 1000], remindmsg: "点击上报:去合成")
     }
+        
+    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
+        super.touchesBegan(touches, with: event)
+        if touches.first?.view != self.customSpeedSettingView {
+            if !customSpeedSettingView.isHidden {
+                customSpeedSettingView.isHidden = true
+            }
+        }
+    }
 
     // MARK: - 播放器相关操作
 
@@ -894,19 +906,23 @@ class PQStuckPointEditerController: PQBaseViewController {
     }
 
     // 设置播放器
-    func settingPlayerView() {
-        stuckPointCuttingView.resetDefaultsColor()
-        synchroMarskView.removeFromSuperview()
-        if synchroMarskView.superview == nil {
-            UIApplication.shared.keyWindow?.addSubview(synchroMarskView)
-            synchroMarskView.show()
-        }
-
-        // 1,设置播放器的显示区域 和画布大小
-        //  - 按第一个素材尺寸自适应
-        playerView.pause()
+    func coculationPlayViewRect() -> CGRect {
         let playerShowHeight = pointEditBGView.frame.minY - (navHeadImageView?.frame.maxY ?? 0)
-        var showRect: CGRect = PQPlayerViewModel.getShowCanvasRect(editProjectModel: projectModel, showType: 1, playerViewHeight: playerShowHeight)
+        var showRect: CGRect = CGRect(x: (cScreenWidth - playerShowHeight) / 2, y: 0, width: playerShowHeight, height: playerShowHeight)
+        if self.firstFrameImage != nil {
+            let w = self.firstFrameImage!.size.width
+            let h = self.firstFrameImage!.size.height
+            let ratioMaterial: Float = Float(w / max(h, 1))
+            if ratioMaterial > 1 {
+                // 横屏
+                let tempPlayerHeight = min(cScreenWidth * CGFloat(h / w), playerShowHeight)
+                showRect = CGRect(x: (cScreenWidth - tempPlayerHeight * CGFloat(ratioMaterial)) / 2, y: (playerShowHeight - tempPlayerHeight) / 2, width: tempPlayerHeight * CGFloat(ratioMaterial), height: tempPlayerHeight)
+            } else {
+                // 竖屏
+                let playerViewWidth = (CGFloat(w) / CGFloat(h)) * playerShowHeight
+                showRect = CGRect(x: (cScreenWidth - playerViewWidth) / 2, y: 0, width: playerViewWidth, height: playerShowHeight)
+            }
+        }
         if showRect.size.width == showRect.size.height {
             if cScreenWidth > playerShowHeight {
                 showRect.origin.x = (cScreenWidth - playerShowHeight) / 2
@@ -929,7 +945,21 @@ class PQStuckPointEditerController: PQBaseViewController {
  
         }
         showRect.origin.y = (playerShowHeight - showRect.size.height) / 2.0 + (navHeadImageView?.frame.maxY ?? 0)
-        playerView.resetCanvasFrame(frame: showRect)
+        
+        return showRect
+    }
+    
+    func settingPlayerView() {
+        stuckPointCuttingView.resetDefaultsColor()
+        synchroMarskView.removeFromSuperview()
+        if synchroMarskView.superview == nil {
+            UIApplication.shared.keyWindow?.addSubview(synchroMarskView)
+            synchroMarskView.show()
+        }
+
+        // 1,设置播放器的显示区域 和画布大小
+        //  - 按第一个素材尺寸自适应
+        playerView.pause()
         
         var firstModel: PQEditVisionTrackMaterialsModel?
         for part in projectModel.sData!.sections {
@@ -951,6 +981,10 @@ class PQStuckPointEditerController: PQBaseViewController {
         } else {
             videoSize = CGSize(width: minSlider, height: maxSlider)
         }
+        if videoSize.width.isNaN || videoSize.height.isNaN {
+            BFLog(1, message: "宽高无效NaN")
+            return
+        }
 
         let maxValue = max(videoSize.width, videoSize.height)
         if maxValue > 1920 {
@@ -971,7 +1005,7 @@ class PQStuckPointEditerController: PQBaseViewController {
         projectModel.sData?.videoMetaData?.videoWidth = Int(videoSize.width)
         projectModel.sData?.videoMetaData?.videoHeight = Int(videoSize.height)
 
-        let beginTime: TimeInterval = Date().timeIntervalSince1970
+        let beginTime = Date()
         dealParameter(model: currentCreateStickersModel)
 
         // 更新裁剪时间条的的ui数据
@@ -991,8 +1025,7 @@ class PQStuckPointEditerController: PQBaseViewController {
             DispatchQueue.main.async { // 串行、异步
                 self.playerView.mStickers = self.mStickers
 
-                let end: TimeInterval = Date().timeIntervalSince1970
-                BFLog(message: "createStickers tiskskskskme  \(end - beginTime)")
+                BFLog(message: "createStickers tiskskskskme  \(Date().timeIntervalSince(beginTime))")
 
                 // 3,设置音频
                 let audioPath = self.stuckPointMusicData?.localPath ?? ""
@@ -1004,8 +1037,6 @@ class PQStuckPointEditerController: PQBaseViewController {
 
                 self.playerView.updateAsset(URL(fileURLWithPath: documensDirectory + audioPath), videoComposition: nil, audioMixModel: nil, originMusicDuration: self.finallyUserAudioTime, clipAudioRange: self.getClipAudioRange())
 
-                let end2: TimeInterval = Date().timeIntervalSince1970
-                BFLog(message: "updateAsset tiskskskskme  \(end2 - end)")
                 // 4, 设置播放器的输出画布大小
                 self.playerView.movie?.mShowVidoSize = CGSize(width: CGFloat(self.projectModel.sData?.videoMetaData?.videoWidth ?? 0), height: CGFloat(self.projectModel.sData?.videoMetaData?.videoHeight ?? 0))
                 
@@ -1799,7 +1830,7 @@ extension PQStuckPointEditerController {
         }
 
         createPorjectData()
-        BFLog(message: "界面编辑界面时参数 选择素材时长:\(selectedTotalDuration) 选择素材总数:\(selectedDataCount) 选择图片总数\(selectedImageDataCount) 再创建类型:\(String(describing: reCreateVideoData?.rhythmMode))")
+        BFLog(1, message: "界面编辑界面时参数 选择素材时长:\(selectedTotalDuration) 选择素材总数:\(selectedDataCount) 选择图片总数\(selectedImageDataCount) 再创建类型:\(String(describing: reCreateVideoData?.rhythmMode))")
 
         if(resetSelectIndex){
             // 1 生成默认参数值

+ 9 - 4
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointMusicContentController.swift

@@ -158,15 +158,15 @@ class PQStuckPointMusicContentController: PQBaseViewController {
     func updateCurrentPlayMusic(isPlaying: Bool, isClearCurrentMusic: Bool) {
         if lastIndexPath != nil, itemList.count > (lastIndexPath?.item ?? 0) {
             (itemList[lastIndexPath?.item ?? 0] as? PQVoiceModel)?.isPlaying = isPlaying
-            collectionView.reloadData()
+            collectionView.reloadItems(at: [lastIndexPath!])
         }
         if isClearCurrentMusic {
             if lastIndexPath != nil, itemList.count > (lastIndexPath?.item ?? 0) {
                 (itemList[lastIndexPath?.item ?? 0] as? PQVoiceModel)?.isSelected = false
                 (itemList[lastIndexPath?.item ?? 0] as? PQVoiceModel)?.isPlaying = false
+                collectionView.reloadItems(at: [lastIndexPath!])
             }
             lastIndexPath = nil
-            collectionView.reloadData()
         }
     }
 }
@@ -248,12 +248,17 @@ extension PQStuckPointMusicContentController: UICollectionViewDelegate, UICollec
                     (itemList[indexPath.item] as? PQVoiceModel)?.isSelected = true
                     (itemList[indexPath.item] as? PQVoiceModel)?.isPlaying = true
                 }
+                var indexpaths = [indexPath]
+                if lastIndexPath != nil {
+                    indexpaths.append(lastIndexPath!)
+                }
+                collectionView.reloadItems(at: indexpaths)
                 lastIndexPath = indexPath
-                collectionView.reloadData()
+//                collectionView.reloadData()
             } else if contentType != .catagery {
                 (itemList[indexPath.item] as? PQVoiceModel)?.isPlaying = !((itemList[indexPath.item] as? PQVoiceModel)?.isPlaying ?? false)
                 (itemList[indexPath.item] as? PQVoiceModel)?.isSelected = true
-                collectionView.reloadData()
+                collectionView.reloadItems(at: [indexPath])
             }
         }
         if contentType == .catagery {

+ 56 - 1
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointMusicController.swift

@@ -8,6 +8,9 @@
 
 import AVFoundation
 import UIKit
+import Photos
+
+
 class PQStuckPointMusicController: PQBaseViewController {
     // 选中的总时长
     var selectedTotalDuration: Float64 = 0
@@ -15,8 +18,36 @@ class PQStuckPointMusicController: PQBaseViewController {
     var selectedDataCount: Int = 0
     // 选择的图片总数
     var selectedImageDataCount: Int = 0
+    weak var stuckPointEditVC : PQStuckPointEditerController?
+    var firstFrameImage:UIImage?
     // 选中的素材数据
-    var selectedPhotoData: [PQEditVisionTrackMaterialsModel]?
+    var selectedPhotoData: [PQEditVisionTrackMaterialsModel]?{
+        didSet {
+            if selectedPhotoData != nil && selectedPhotoData!.count > 0 {
+                let photo = selectedPhotoData!.first!
+                let option = PHImageRequestOptions()
+                option.isNetworkAccessAllowed = true //允许下载iCloud的图片
+                option.resizeMode = .none
+                option.deliveryMode = .highQualityFormat
+                let startTime = Date()
+                PHImageManager.default().requestImage(for: photo.asset!,
+                                                      targetSize: CGSize(width: 1920, height: 1920),
+                                                      contentMode: .aspectFit,
+                                                      options: option)
+                { (image, nil) in
+                     //image就是图片
+                    if image != nil {
+                        self.firstFrameImage = image
+                        if self.stuckPointEditVC != nil {
+                            self.stuckPointEditVC?.firstFrameImage = image
+                        }
+                        
+//                        BFLog(1, message: "aaa: \(Date().timeIntervalSince(startTime)), \(String(describing: image?.size))")
+                    }
+                }
+            }
+        }
+    }
     // 选中的音乐数据
     var selectedMusicData: PQVoiceModel?
     /// 缓存数据
@@ -243,6 +274,10 @@ class PQStuckPointMusicController: PQBaseViewController {
             editerVC.reCreateVideoData = reCreateVideoData
             editerVC.isReCreate = true
             navigationController?.pushViewController(editerVC, animated: true)
+            stuckPointEditVC = editerVC
+            if firstFrameImage != nil {
+                editerVC.firstFrameImage = firstFrameImage
+            }
         }
         // 卡点视频音乐选择曝光上报
         PQEventTrackViewModel.baseReportUpload(businessType: .bt_windowView, objectType: .ot_view_selectSyncedUpMusic, pageSource: .sp_stuck_selectSynceedUpMusic, extParams: nil, remindmsg: "卡点视频数据上报-(曝光上报:卡点视频音乐选择页)")
@@ -373,6 +408,7 @@ class PQStuckPointMusicController: PQBaseViewController {
         pageNum = 1
     }
 
+    var avPlayerTimeObserver:Any?
     /// 播放音乐
     /// - Parameter itemData: <#itemData description#>
     func playStuckPointMusic(itemData: PQVoiceModel?, isClearCurrentMusic: Bool = false) {
@@ -384,6 +420,10 @@ class PQStuckPointMusicController: PQBaseViewController {
             avPlayer.pause()
             playerItem?.removeObserver(self, forKeyPath: "status")
             playerItem?.removeObserver(self, forKeyPath: "error")
+            if avPlayerTimeObserver != nil {
+                avPlayer.removeTimeObserver(avPlayerTimeObserver as Any)
+            }
+            
             playerItem = AVPlayerItem(url: URL(string: itemData?.musicPath ?? "")!)
             if (itemData?.endTime ?? 0) > 0, (itemData?.endTime ?? 0) > (itemData?.startTime ?? 0) {
                 playerItem?.forwardPlaybackEndTime = CMTime(value: CMTimeValue((itemData?.endTime ?? 0) * playerTimescale), timescale: CMTimeScale(playerTimescale))
@@ -393,6 +433,17 @@ class PQStuckPointMusicController: PQBaseViewController {
             playerItem?.addObserver(self, forKeyPath: "error", options: .new, context: nil)
             avPlayer.seek(to: CMTime(value: CMTimeValue((itemData?.startTime ?? 0) * playerTimescale), timescale: CMTimeScale(playerTimescale)))
             avPlayer.play()
+            
+            avPlayerTimeObserver = avPlayer.addPeriodicTimeObserver(forInterval: CMTime(value: 1, timescale: 10), queue: DispatchQueue.global()) {[weak self] time in
+                if fabs(CMTimeGetSeconds(time) - (itemData?.startTime ?? 0)) > 0.1 {
+                    self?.avPlayer.removeTimeObserver(self?.avPlayerTimeObserver as Any)
+                    self?.avPlayerTimeObserver = nil
+                    // 停止cell loading动画
+                    PQNotification.post(name: NSNotification.Name(rawValue: "MusicContentCellIconLoadingAnimationStop"), object: nil)
+                }
+             //    进度监控
+//                BFLog(1, message: "\(Int(CMTimeGetSeconds((self?.playerItem?.asset.duration)!))),curr:\(CMTimeGetSeconds(time))")
+            }
 //            let player = TXVodPlayer()
 //            let config = TXVodPlayConfig()
 //            config.cacheFolderPath = videoCacheDirectory
@@ -427,6 +478,10 @@ class PQStuckPointMusicController: PQBaseViewController {
             editerVC.stuckPointMusicData = musicData
             editerVC.selectedPhotoData = selectedPhotoData
             navigationController?.pushViewController(editerVC, animated: true)
+            stuckPointEditVC = editerVC
+            if firstFrameImage != nil {
+                editerVC.firstFrameImage = firstFrameImage
+            }
         }
     }
 

+ 5 - 0
BFFramework/Classes/Stuckpoint/View/PQCustomSpeedSettingView.swift

@@ -161,6 +161,7 @@ class PQCustomSpeedSettingView: UIView {
 
         autolayout()
         showHiddenView()
+        self.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(panGes(_:))))
     }
 
     required init?(coder _: NSCoder) {
@@ -171,6 +172,10 @@ class PQCustomSpeedSettingView: UIView {
         BFLog(1, message: "custom speed setting view release")
     }
 
+    @objc func panGes(_ ges:UIPanGestureRecognizer){
+        
+    }
+    
     func showHiddenView() {
         customSpeedFastView.isHidden = !(viewType == 1)
         customSpeedSlowView.isHidden =  !(viewType == 1)

+ 2 - 1
BFFramework/Classes/Stuckpoint/View/PQSelecteMusicView.swift

@@ -100,6 +100,7 @@ class PQSelecteMusicView: UIView {
         selectMusicCollection.backgroundColor = .clear
         selectMusicCollection.register(PQSelectMusicCell.self, forCellWithReuseIdentifier: String(describing: PQSelectMusicCell.self))
         selectMusicCollection.delaysContentTouches = false
+        selectMusicCollection.contentInset = UIEdgeInsets(top: 0, left: 17, bottom: 0, right: 0)
         return selectMusicCollection
     }()
 
@@ -191,7 +192,7 @@ class PQSelecteMusicView: UIView {
         }
         selectMusicCollection.snp.makeConstraints { make in
             make.height.equalTo(131)
-            make.left.equalToSuperview().offset(17)
+            make.left.equalToSuperview()
             make.right.equalToSuperview()
             make.top.equalToSuperview().offset(54)
         }

+ 1 - 1
BFFramework/Classes/Stuckpoint/View/PQStuckPointCuttingView.swift

@@ -302,7 +302,7 @@ class PQStuckPointCuttingView: UIView {
         while(selectIndex < lineLayerArray.count && selectIndex > lastDrawedLineIndex){
             let drawLayer:CAShapeLayer = lineLayerArray[lastDrawedLineIndex]
             if drawLayer.strokeColor != UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue).cgColor{
-                BFLog(1, message: "progress is \(progress) i \(lastDrawedLineIndex) 命中的位置:\(CGFloat(lastDrawedLineIndex) * oneMarginTime)")
+//                BFLog(1, message: "progress is \(progress) i \(lastDrawedLineIndex) 命中的位置:\(CGFloat(lastDrawedLineIndex) * oneMarginTime)")
                 drawLayer.strokeColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue).cgColor
                 drawLayer.setNeedsDisplay()
                 drawLayer.layoutIfNeeded()

+ 2 - 1
BFFramework/Classes/Stuckpoint/View/PQStuckPointLoadingView.swift

@@ -67,8 +67,9 @@ class PQStuckPointLoadingView: UIView {
 
     func addLayout() {
         loadingView.snp.makeConstraints { make in
-            make.top.equalToSuperview().offset(cScreenWidth / 2.0 + cDevice_iPhoneStatusBarHei)
+//            make.top.equalToSuperview().offset(cScreenWidth / 2.0 + cDevice_iPhoneStatusBarHei)
             make.centerX.equalTo(cScreenWidth / 2.0)
+            make.centerY.equalTo(cScreenHeigth / 2.0)
             make.width.height.equalTo(cDefaultMargin * 10)
         }
         

+ 27 - 3
BFFramework/Classes/Stuckpoint/View/PQStuckPointMusicContentCell.swift

@@ -22,7 +22,7 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
 
     lazy var imageMaskView: UIView = {
         let imageMaskView = UIView()
-        imageMaskView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5)
+        imageMaskView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.6)
         imageMaskView.addCorner(corner: 4)
         return imageMaskView
     }()
@@ -96,6 +96,11 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
         contentView.addSubview(remindView)
         contentView.addSubview(confirmContentView)
         confirmContentView.addSubview(confirmBtn)
+        PQNotification.addObserver(forName: Notification.Name(rawValue: "MusicContentCellIconLoadingAnimationStop"), object: nil, queue: .main) { [weak self] notice in
+            if !(self?.imageMaskView.isHidden ?? true){
+                self?.stopLoadingAnimation()
+            }
+        }
     }
 
     required init?(coder _: NSCoder) {
@@ -117,10 +122,16 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
             audioImageView.setNetImage(url: "\((bgmData as? PQVoiceModel)?.avatarUrl ?? "")", placeholder: UIImage().BF_Image(named: "videomk_music_default"))
             confirmContentView.isHidden = !((bgmData as? PQVoiceModel)?.isSelected ?? false)
             if (bgmData as? PQVoiceModel)?.isSelected ?? false {
+                imageMaskView.isHidden = false
                 playImageView.isHidden = false
                 if (bgmData as? PQVoiceModel)?.isPlaying ?? false {
-                    playImageView.image = nil
-                    playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
+                    if playImageView.image == nil ||  playImageView.image == UIImage().BF_Image(named: "stuckPoint_music_pause"){
+                        playImageView.image = UIImage().BF_Image(named: "loading")
+                        startLoadingAnimation()
+                    }else {
+                        playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
+                    }
+
                     musicNameLab.move()
                 } else {
                     playImageView.image = UIImage().BF_Image(named: "stuckPoint_music_pause")
@@ -226,4 +237,17 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
             btnClickHandle!(confirmBtn, bgmData)
         }
     }
+    
+    func startLoadingAnimation(){
+        let rotateAnimation = CABasicAnimation(keyPath: "transform.rotation")
+        rotateAnimation.toValue = Double.pi * 2
+        rotateAnimation.duration = 1
+        rotateAnimation.repeatCount = .infinity
+        playImageView.layer.add(rotateAnimation, forKey: nil)
+    }
+    
+    func stopLoadingAnimation(){
+        playImageView.layer.removeAllAnimations()
+        playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
+    }
 }

+ 1 - 1
BFFramework/Classes/Stuckpoint/ViewModel/PQPlayerViewModel.swift

@@ -441,7 +441,7 @@ open class PQPlayerViewModel: NSObject {
                     if firstModel?.width == 0 || firstModel?.height == 0 {
                         BFLog(message: "!!!!!!!!!!!素材宽高有问题!!!!!!!!!!!")
                     }
-                    BFLog(message: "第一个有效素材的大小 \(String(describing: firstModel?.width)) \(String(describing: firstModel?.height))")
+                    BFLog(1, message: "第一个有效素材的大小 \(String(describing: firstModel?.width)) \(String(describing: firstModel?.height))")
                     let ratioMaterial: Float = (firstModel?.width ?? 0) / (firstModel?.height ?? 0)
                     if ratioMaterial > 1 {
                         // 横屏