Quellcode durchsuchen

恢复音乐选择页处理第一帧逻辑,冗余处理

harry vor 3 Jahren
Ursprung
Commit
d5c9ec201a

+ 2 - 3
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -751,11 +751,10 @@ class PQStuckPointEditerController: PQBaseViewController {
                                                   targetSize: CGSize(width: 1920, height: 1920),
                                                   contentMode: .aspectFit,
                                                   options: option)
-            { (image, nil) in
+            { [weak self] (image, nil) in
                  //image就是图片
                 if image != nil {
-                    self.firstFrameImage = image
-  
+                    self?.firstFrameImage = image
                 }
             }
         }

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

@@ -23,7 +23,29 @@ class PQStuckPointMusicController: PQBaseViewController {
     // 选中的素材数据
     var selectedPhotoData: [PHAsset]?{
         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,
+                                                      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))")
+                    }
+                }
+            }
         }
     }
     // 选中的音乐数据