Commit 04514332244e7294c218f1eaa18ab76f1f480be7

Authored by 张旭
1 parent 3970efc2

短剧主页跳转播放器时 销毁播放器通知

metaCode/Classes/Config/CNLiveConfigManager.swift
... ... @@ -83,4 +83,8 @@ extension Notification.Name {
83 83 //搜索确认处理
84 84 public static let kDSSelectGoodsNotification = Notification.Name("kDSSelectGoodsNotification")
85 85 }
  86 + struct PlayerManage {
  87 + //销毁播放器通知
  88 + public static let kPlayerDestroyNotification = Notification.Name("kPlayerDestroyNotification")
  89 + }
86 90 }
... ...
metaCode/Classes/Main/HomePages/Controller/PlayletHomePage/CNLivePlayletHomePageController.swift
... ... @@ -140,8 +140,20 @@ class CNLivePlayletHomePageController:CNLiveBaseViewController, UITableViewDataS
140 140 }else{
141 141 let albumListModel = self.albumModelArr[indexPath.row]
142 142 let aid = albumListModel.albumMsgModel?.albumId ?? ""
  143 + //发播放器销毁通知
  144 + NotificationCenter.default.post(name: Notification.Name.PlayerManage.kPlayerDestroyNotification, object: nil)
  145 + //在当前堆栈里遍历删除 播放控制器CNLiveShortVideoViewController
  146 + let tempArray = NSMutableArray.init()
  147 + self.navigationController?.viewControllers.forEach({ item in
  148 + if (item.isKind(of: CNLiveShortVideoViewController.self)) {
  149 + tempArray.remove(item)
  150 + }else{
  151 + tempArray.add(item)
  152 + }
  153 + })
  154 + self.navigationController?.viewControllers = tempArray as! [CNLiveBaseViewController]
143 155 //跳转播放页
144   - navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: aid), animated: pushAnimated)
  156 + navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: aid, page: 1, currentIndex: indexPath.row, dataArray: self.albumModelArr), animated: pushAnimated)
145 157 }
146 158 }
147 159 }
... ...