ソースを参照

选转做个保护

harry 3 年 前
コミット
a06af73073

+ 8 - 2
BFRecordScreenKit/Classes/BFRecordItemModel.swift

@@ -89,12 +89,18 @@ public class BFRecordItemModel: NSObject {
 
     func fetchPlayItem(_ phasset: PHAsset) {
         PQPHAssetVideoParaseUtil.parasToAVPlayerItem(phAsset: phasset) { [weak self] playerItem, _, _ in
+            
+            guard let wself = self else { return }
+            
             guard let item = playerItem else {
                 self?.fetchPlayItemCallBack?(self)
                 return
             }
-            self?.playItem = item
-            self?.fetchPlayItemCallBack?(self)
+            wself.playItem = item
+            wself.videoAsset = item.asset as? AVURLAsset
+            wself.localPath = (wself.videoAsset?.url.absoluteString.removingPercentEncoding)?.replacingOccurrences(of: "file://", with: "")
+
+            wself.fetchPlayItemCallBack?(self)
         }
     }
 

+ 9 - 0
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -2067,6 +2067,9 @@ public class BFRecordScreenController: BFBaseViewController {
                         }
                         if let cell = wself.collectionView.cellForItem(at: IndexPath(item: wself.currItemModelIndex, section: 0)) as? BFImageCoverViewCell, cell.recordItem?.localPath == item.localPath {
                                 wself.rscurrentManager.resetEnv()
+                                if wself.currMediaType == .Video {
+                                    (cell as? BFVideoCoverViewCell)?.rotationView()
+                                }
                         }
                     }
                 }
@@ -2345,6 +2348,12 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
         }
  
     }
+    
+    public func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
+        if let currCell = cell as? BFVideoCoverViewCell {
+            currCell.rotationView()
+        }
+    }
     public func scrollViewWillBeginDragging(_: UIScrollView) {
         BFLog(1, message: "开始滚动")
         if currMediaType == .Camera && rscurrentManager.recordItem?.voiceStickers.count == 0{