瀏覽代碼

1.修改删除视频

wenweiwei 3 年之前
父節點
當前提交
74adbb3533

+ 1 - 1
MusicVideoPlus.xcodeproj/project.pbxproj

@@ -235,7 +235,6 @@
 			isa = PBXGroup;
 			children = (
 				2D076757266E08E700E64472 /* MVHomeController.swift */,
-				2D9630D2268186A500AE6FFE /* MVPlayViewController.swift */,
 			);
 			path = Controllers;
 			sourceTree = "<group>";
@@ -273,6 +272,7 @@
 			isa = PBXGroup;
 			children = (
 				2D9630E02682096900AE6FFE /* PQCollectionViewFlowlayout.swift */,
+				2D9630D2268186A500AE6FFE /* MVPlayViewController.swift */,
 				2D9630DD268206F300AE6FFE /* MVMineProductController.swift */,
 			);
 			path = Controllers;

+ 23 - 25
MusicVideoPlus/Classes/Modules/Home/Controllers/MVHomeController.swift

@@ -491,30 +491,28 @@ extension MVHomeController: UICollectionViewDelegate, UICollectionViewDataSource
         return CGSize(width: width, height: collectionView.frame.height - 14)
     }
 
-    func collectionView(_: UICollectionView, didSelectItemAt _: IndexPath) {
-//        for hot in mVideos {
-//            hot.isSelected = false
-//        }
-//
-//        let itemDataNew: MVHotVideoModel = mVideos[indexPath.item]
-//        itemDataNew.isSelected = true
-//        categoryCollectionView.reloadData()
-//
-//        // 找出当前选择分类之前的视频数量和
-//        var videosCount: Int = 0
-//        if indexPath.row != 0 {
-//            for i in 0 ... indexPath.row - 1 {
-//                videosCount = videosCount + mVideos[i].videos.count
-//            }
-//            BFLog(message: "indexPath 选择\(indexPath.item) 之前的视频合\(videosCount)")
-//        }
-//        viewListView.currentIndex = videosCount
-//        viewListView.scrollToItem(at: videosCount, animated: false)
-//
-//        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.05) {
-//            self.playVideo(page: videosCount)
-//        }
-        let vc = MVPlayViewController()
-        navigationController?.pushViewController(vc, animated: true)
+    func collectionView(_: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        for hot in mVideos {
+            hot.isSelected = false
+        }
+
+        let itemDataNew: MVHotVideoModel = mVideos[indexPath.item]
+        itemDataNew.isSelected = true
+        categoryCollectionView.reloadData()
+
+        // 找出当前选择分类之前的视频数量和
+        var videosCount: Int = 0
+        if indexPath.row != 0 {
+            for i in 0 ... indexPath.row - 1 {
+                videosCount = videosCount + mVideos[i].videos.count
+            }
+            BFLog(message: "indexPath 选择\(indexPath.item) 之前的视频合\(videosCount)")
+        }
+        viewListView.currentIndex = videosCount
+        viewListView.scrollToItem(at: videosCount, animated: false)
+
+        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.05) {
+            self.playVideo(page: videosCount)
+        }
     }
 }

+ 3 - 1
MusicVideoPlus/Classes/Modules/Home/Views/MVPlayControlViewCell.swift

@@ -181,6 +181,7 @@ class MVPlayControlViewCell: UICollectionViewCell {
     override func prepareForReuse() {
         super.prepareForReuse()
         pauseBtn.isSelected = false
+        progressView.progress = 0
     }
 
     var videoData: PQVideoListModel? {
@@ -192,6 +193,7 @@ class MVPlayControlViewCell: UICollectionViewCell {
 
     func addData() {
         pauseBtn.isSelected = false
+        progressView.progress = 0
         let coverImg = (videoData?.videoCoverSnapshotPath != nil && (videoData?.videoCoverSnapshotPath?.count ?? 0) > 0) ? videoData?.videoCoverSnapshotPath ?? "" : videoData?.coverImg?["coverImgPath"] as! String
         coverImageView.setNetImage(url: coverImg)
         if videoData?.shareCountFriend != nil, videoData?.shareCountFriend ?? 0 > 0 {
@@ -219,7 +221,7 @@ class MVPlayControlViewCell: UICollectionViewCell {
     }
 
     func updateProgress(progress: Float) {
-        progressView.setProgress(progress, animated: true)
+        progressView.setProgress(progress, animated: false)
     }
 
     func addLayout() {

+ 4 - 2
MusicVideoPlus/Classes/Modules/Home/Controllers/MVPlayViewController.swift → MusicVideoPlus/Classes/Modules/Mine/Controllers/MVPlayViewController.swift

@@ -148,8 +148,10 @@ extension MVPlayViewController: UICollectionViewDelegate, UICollectionViewDataSo
             return
         }
         currentIndex = indexPath
-        PQSingletoVideoPlayer.shared.configPlyer(videoData: itemsList[indexPath?.item ?? 0], controllerView: cell!.coverImageView)
-        PQSingletoVideoPlayer.shared.startPlayr()
+        var itemData = itemsList[indexPath?.item ?? 0]
+        itemData.playProgress = 0
+        PQSingletoVideoPlayer.shared.configPlyer(videoData: itemData, controllerView: cell!.coverImageView)
+        PQSingletoVideoPlayer.shared.resetPlayer()
     }
 
     /// 按钮点击处理