浏览代码

1.修改bugs

wenweiwei 3 年之前
父节点
当前提交
289c2ec2aa

+ 16 - 2
MusicVideoPlus/Classes/Modules/Home/Controllers/MVHomeController.swift

@@ -112,12 +112,26 @@ class MVHomeController: MVBaseController {
 
     @objc func enterBackground() {
         BFLog(message: "进入到后台")
-        controlPlayrPasueOrResume(isPause: true)
+        var rootViewController = UIApplication.shared.keyWindow?.rootViewController
+        if rootViewController is UINavigationController {
+            rootViewController = (rootViewController as? UINavigationController)?.visibleViewController
+        }
+        BFLog(message: "rootViewController is \(rootViewController)")
+        if rootViewController is MVHomeController {
+            controlPlayrPasueOrResume(isPause: true)
+        }
     }
 
     @objc func willEnterForeground() {
         BFLog(message: "进入到前台")
-        controlPlayrPasueOrResume(isPause: false)
+        var rootViewController = UIApplication.shared.keyWindow?.rootViewController
+        if rootViewController is UINavigationController {
+            rootViewController = (rootViewController as? UINavigationController)?.visibleViewController
+        }
+        BFLog(message: "rootViewController is \(rootViewController)")
+        if rootViewController is MVHomeController {
+            controlPlayrPasueOrResume(isPause: false)
+        }
     }
 
     override func viewWillAppear(_: Bool) {

+ 1 - 1
MusicVideoPlus/Classes/Modules/Mine/Controllers/MVPlayViewController.swift

@@ -209,7 +209,7 @@ extension MVPlayViewController: UICollectionViewDelegate, UICollectionViewDataSo
         let itemData = itemsList[indexPath?.item ?? 0]
         if currentIndex != nil, currentIndex?.item == indexPath?.item, PQSingletoVideoPlayer.shared.playControllerView != nil {
             PQSingletoVideoPlayer.shared.configPlyer(videoData: itemData, controllerView: cell!.coverImageView, renderMode: .RENDER_MODE_FILL_EDGE)
-            PQSingletoVideoPlayer.shared.startPlayr()
+            PQSingletoVideoPlayer.shared.resetPlayer()
             return
         }
         currentIndex = indexPath