Commit 5b496349834c87265169f9f4aeacdda0438b6c14

Authored by “张旭”
1 parent f2adb8b7

1.1.5.25.04.21.16 , 点播页增加前后台监听暂停播放

metaCode.xcodeproj/project.pbxproj
... ... @@ -2936,7 +2936,7 @@
2936 2936 CODE_SIGN_ENTITLEMENTS = metaCode/metaCode.entitlements;
2937 2937 CODE_SIGN_IDENTITY = "Apple Development";
2938 2938 CODE_SIGN_STYLE = Automatic;
2939   - CURRENT_PROJECT_VERSION = 1.1.5.25.04.21.12;
  2939 + CURRENT_PROJECT_VERSION = 1.1.5.25.04.21.16;
2940 2940 DEBUG_INFORMATION_FORMAT = dwarf;
2941 2941 DEVELOPMENT_TEAM = 94X49GG3ZW;
2942 2942 ENABLE_BITCODE = NO;
... ... @@ -3192,7 +3192,7 @@
3192 3192 CODE_SIGN_ENTITLEMENTS = metaCode/metaCode.entitlements;
3193 3193 CODE_SIGN_IDENTITY = "Apple Development";
3194 3194 CODE_SIGN_STYLE = Automatic;
3195   - CURRENT_PROJECT_VERSION = 1.1.5.25.04.21.12;
  3195 + CURRENT_PROJECT_VERSION = 1.1.5.25.04.21.16;
3196 3196 DEVELOPMENT_TEAM = 94X49GG3ZW;
3197 3197 ENABLE_BITCODE = NO;
3198 3198 ENABLE_MODULE_VERIFIER = NO;
... ...
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
... ... @@ -162,6 +162,18 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
162 162 controlView.showCustomStatusBar = true
163 163 return controlView
164 164 }()
  165 +
  166 + override func viewDidAppear(_ animated: Bool) {
  167 + super.viewDidAppear(animated)
  168 + navigationController?.interactivePopGestureRecognizer?.isEnabled = false
  169 + }
  170 + override func viewDidDisappear(_ animated: Bool) {
  171 + super.viewDidDisappear(animated)
  172 + self.player.currentPlayerManager.pause()
  173 + // 恢复手势识别
  174 +// self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true
  175 + navigationController?.interactivePopGestureRecognizer?.isEnabled = true
  176 + }
165 177 override func viewDidLoad() {
166 178 super.viewDidLoad()
167 179 view.backgroundColor = .black
... ... @@ -220,8 +232,32 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
220 232 }
221 233 self.configDataArray()
222 234 self.setupPlayer()
  235 +
  236 +
  237 + NotificationCenter.default.addObserver(
  238 + self,
  239 + selector: #selector(appDidEnterBackground),
  240 + name: UIApplication.didEnterBackgroundNotification,
  241 + object: nil
  242 + )
  243 + NotificationCenter.default.addObserver(
  244 + self,
  245 + selector: #selector(appDidEnterPlayGround),
  246 + name: UIApplication.didBecomeActiveNotification,
  247 + object: nil
  248 + )
  249 + // 直接关闭手势识别
  250 +// self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false
223 251 }
224 252  
  253 + @objc func appDidEnterBackground() {
  254 + self.player.currentPlayerManager.pause()
  255 + }
  256 + @objc func appDidEnterPlayGround() {
  257 + self.player.currentPlayerManager.play()
  258 + }
  259 +
  260 +
225 261 func configDataArray(){
226 262 //配置数据
227 263 let tempDataArray = NSMutableArray()
... ... @@ -604,7 +640,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
604 640 guard let self = self else { return }
605 641 //
606 642  
607   - CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: self.vodPlayModel?.contentId ?? "", rate: gaoqing) { result, status in
  643 + CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: self.vodPlayModel?.contentId ?? "", rate: gaoqing) {[weak self] result, status in
  644 + guard let self = self else { return }
608 645 if status == .success{
609 646 if let url = result as? String{
610 647 self.seekPlayerWithUrlAndTitle(url: url, title: self.playTitle, seekTime: self.player.currentTime)
... ... @@ -1210,7 +1247,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1210 1247  
1211 1248 func addRefreshView() {
1212 1249 tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in
1213   - self!.refreshVodData(isAblumVideo: self!.isAblumVideo)
  1250 + guard let self = self else { return }
  1251 + self.refreshVodData(isAblumVideo: self.isAblumVideo)
1214 1252 })
1215 1253 }
1216 1254  
... ... @@ -1570,7 +1608,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1570 1608  
1571 1609 } completerBlock: { resultType, platformType, typeString in
1572 1610 if resultType == .succ{
1573   -
  1611 + print("succ")
1574 1612 }
1575 1613 }
1576 1614 }
... ... @@ -1587,7 +1625,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1587 1625 //评论
1588 1626 CNLiveShortVideoCommentListView.showVideoCommentListView(pid: self.vodPlayModel?.contentId ?? "", contentSid: UserInfoManager.shared.userInfo.uid,containView:self.bottomCommentShowContainView, result: { commentModel in
1589 1627 print("\(commentModel)")
1590   - }, close: {
  1628 + }, close: {[weak self] in
  1629 + guard let self = self else { return }
1591 1630 self.bottomCommentShowContainView.isHidden = true
1592 1631 })
1593 1632  
... ... @@ -1601,6 +1640,9 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1601 1640 self.navigationController!.popViewController(animated: true)
1602 1641 }
1603 1642 }
  1643 + self.destroyPlayer()
  1644 + print("vod deinit back")
  1645 + NotificationCenter.default.removeObserver(self)
1604 1646 }
1605 1647  
1606 1648 // MARK: - 获取默认商品block
... ... @@ -1684,5 +1726,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1684 1726  
1685 1727 deinit {
1686 1728 print("vod deinit")
  1729 + NotificationCenter.default.removeObserver(self)
1687 1730 }
1688 1731 }
... ...
metaCode/Classes/Main/HuBiLieHomePage/Util/CNLiveDownSlideTool.swift
... ... @@ -387,6 +387,7 @@ CNLiveDownSlideTool.getVodAlbumMsgApi(contentId: albumId){ result, status in
387 387 vc.vodPlayModel = vodModel//vodModel
388 388 vc.contentId = vodModel.contentId
389 389 vc.vodAlbumListBaseModel = albumListBaseModel
  390 + let naviVC = CNLiveBaseNavigationController(rootViewController: vc)
390 391 navigationVC?.pushViewController(vc, animated: pushAnimated)
391 392 }else{
392 393  
... ... @@ -442,6 +443,7 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in
442 443 vc.vodPlayModel = tempVodModel//vodModel
443 444 vc.contentId = contentId
444 445 vc.vodAlbumListBaseModel = albumListBaseModel
  446 + let naviVC = CNLiveBaseNavigationController(rootViewController: vc)
445 447 navigationVC?.pushViewController(vc, animated: pushAnimated)
446 448 }else{
447 449  
... ... @@ -471,6 +473,7 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in
471 473 vc.url = URL(string: url)
472 474 vc.vodPlayModel = tempVodModel
473 475 vc.contentId = contentId
  476 + let naviVC = CNLiveBaseNavigationController(rootViewController: vc)
474 477 navigationVC?.pushViewController(vc, animated: pushAnimated)
475 478 }else{
476 479  
... ...
metaCode/Classes/Other/AppDelegate.swift
... ... @@ -156,6 +156,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
156 156 return .portrait
157 157 }
158 158  
  159 + func applicationDidEnterBackground(_ application: UIApplication) {
  160 +
  161 + }
  162 +
159 163  
160 164 // MARK: - 键盘处理
161 165 func AppDelegate_configIQKeyboardManager() {
... ...