Browse Source

Merge branch 'feature/dev_Chris' into develop

Chris 5 years ago
parent
commit
cbfe1e74c9

+ 7 - 4
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift

@@ -232,19 +232,22 @@ extension CommunityVideoListController: UICollectionViewDelegateFlowLayout,UICol
         return CGSize(width: kScreenWidth, height: 0)
     }
     
-    func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
-        prePlayCell = cell as? CommunityVideoCoverCollectionCell
-        self.pauseCurrentVideo()
-        prePlayCell?.playStatusImageView.isHidden = true
+    func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {        
+        // 上一个collectionItem滑出,停止播放上面的视频
+        let preCell = cell as? CommunityVideoCoverCollectionCell
+        preCell?.pause()
+        preCell?.playStatusImageView.isHidden = true
     }
     
     func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
+        // 滑动完毕,播放当前cell的video
         let index = Int(collectionView.contentOffset.y / CGFloat(kScreenHeight))
         let indexPath = IndexPath(item: index, section: 0)
         let cell = collectionView.cellForItem(at: indexPath) as? CommunityVideoCoverCollectionCell
         
         if(cell != nil) {
             self.startPlay(cell)
+            self.prePlayCell = cell
         }
     }