Commit 5b496349834c87265169f9f4aeacdda0438b6c14

Authored by “张旭”
1 parent f2adb8b7

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

metaCode.xcodeproj/project.pbxproj
@@ -2936,7 +2936,7 @@ @@ -2936,7 +2936,7 @@
2936 CODE_SIGN_ENTITLEMENTS = metaCode/metaCode.entitlements; 2936 CODE_SIGN_ENTITLEMENTS = metaCode/metaCode.entitlements;
2937 CODE_SIGN_IDENTITY = "Apple Development"; 2937 CODE_SIGN_IDENTITY = "Apple Development";
2938 CODE_SIGN_STYLE = Automatic; 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 DEBUG_INFORMATION_FORMAT = dwarf; 2940 DEBUG_INFORMATION_FORMAT = dwarf;
2941 DEVELOPMENT_TEAM = 94X49GG3ZW; 2941 DEVELOPMENT_TEAM = 94X49GG3ZW;
2942 ENABLE_BITCODE = NO; 2942 ENABLE_BITCODE = NO;
@@ -3192,7 +3192,7 @@ @@ -3192,7 +3192,7 @@
3192 CODE_SIGN_ENTITLEMENTS = metaCode/metaCode.entitlements; 3192 CODE_SIGN_ENTITLEMENTS = metaCode/metaCode.entitlements;
3193 CODE_SIGN_IDENTITY = "Apple Development"; 3193 CODE_SIGN_IDENTITY = "Apple Development";
3194 CODE_SIGN_STYLE = Automatic; 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 DEVELOPMENT_TEAM = 94X49GG3ZW; 3196 DEVELOPMENT_TEAM = 94X49GG3ZW;
3197 ENABLE_BITCODE = NO; 3197 ENABLE_BITCODE = NO;
3198 ENABLE_MODULE_VERIFIER = NO; 3198 ENABLE_MODULE_VERIFIER = NO;
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
@@ -162,6 +162,18 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -162,6 +162,18 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
162 controlView.showCustomStatusBar = true 162 controlView.showCustomStatusBar = true
163 return controlView 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 override func viewDidLoad() { 177 override func viewDidLoad() {
166 super.viewDidLoad() 178 super.viewDidLoad()
167 view.backgroundColor = .black 179 view.backgroundColor = .black
@@ -220,8 +232,32 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -220,8 +232,32 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
220 } 232 }
221 self.configDataArray() 233 self.configDataArray()
222 self.setupPlayer() 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 func configDataArray(){ 261 func configDataArray(){
226 //配置数据 262 //配置数据
227 let tempDataArray = NSMutableArray() 263 let tempDataArray = NSMutableArray()
@@ -604,7 +640,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -604,7 +640,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
604 guard let self = self else { return } 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 if status == .success{ 645 if status == .success{
609 if let url = result as? String{ 646 if let url = result as? String{
610 self.seekPlayerWithUrlAndTitle(url: url, title: self.playTitle, seekTime: self.player.currentTime) 647 self.seekPlayerWithUrlAndTitle(url: url, title: self.playTitle, seekTime: self.player.currentTime)
@@ -1210,7 +1247,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -1210,7 +1247,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1210 1247
1211 func addRefreshView() { 1248 func addRefreshView() {
1212 tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in 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,7 +1608,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1570 1608
1571 } completerBlock: { resultType, platformType, typeString in 1609 } completerBlock: { resultType, platformType, typeString in
1572 if resultType == .succ{ 1610 if resultType == .succ{
1573 - 1611 + print("succ")
1574 } 1612 }
1575 } 1613 }
1576 } 1614 }
@@ -1587,7 +1625,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -1587,7 +1625,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1587 //评论 1625 //评论
1588 CNLiveShortVideoCommentListView.showVideoCommentListView(pid: self.vodPlayModel?.contentId ?? "", contentSid: UserInfoManager.shared.userInfo.uid,containView:self.bottomCommentShowContainView, result: { commentModel in 1626 CNLiveShortVideoCommentListView.showVideoCommentListView(pid: self.vodPlayModel?.contentId ?? "", contentSid: UserInfoManager.shared.userInfo.uid,containView:self.bottomCommentShowContainView, result: { commentModel in
1589 print("\(commentModel)") 1627 print("\(commentModel)")
1590 - }, close: { 1628 + }, close: {[weak self] in
  1629 + guard let self = self else { return }
1591 self.bottomCommentShowContainView.isHidden = true 1630 self.bottomCommentShowContainView.isHidden = true
1592 }) 1631 })
1593 1632
@@ -1601,6 +1640,9 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -1601,6 +1640,9 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1601 self.navigationController!.popViewController(animated: true) 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 // MARK: - 获取默认商品block 1648 // MARK: - 获取默认商品block
@@ -1684,5 +1726,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -1684,5 +1726,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1684 1726
1685 deinit { 1727 deinit {
1686 print("vod deinit") 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,6 +387,7 @@ CNLiveDownSlideTool.getVodAlbumMsgApi(contentId: albumId){ result, status in
387 vc.vodPlayModel = vodModel//vodModel 387 vc.vodPlayModel = vodModel//vodModel
388 vc.contentId = vodModel.contentId 388 vc.contentId = vodModel.contentId
389 vc.vodAlbumListBaseModel = albumListBaseModel 389 vc.vodAlbumListBaseModel = albumListBaseModel
  390 + let naviVC = CNLiveBaseNavigationController(rootViewController: vc)
390 navigationVC?.pushViewController(vc, animated: pushAnimated) 391 navigationVC?.pushViewController(vc, animated: pushAnimated)
391 }else{ 392 }else{
392 393
@@ -442,6 +443,7 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in @@ -442,6 +443,7 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in
442 vc.vodPlayModel = tempVodModel//vodModel 443 vc.vodPlayModel = tempVodModel//vodModel
443 vc.contentId = contentId 444 vc.contentId = contentId
444 vc.vodAlbumListBaseModel = albumListBaseModel 445 vc.vodAlbumListBaseModel = albumListBaseModel
  446 + let naviVC = CNLiveBaseNavigationController(rootViewController: vc)
445 navigationVC?.pushViewController(vc, animated: pushAnimated) 447 navigationVC?.pushViewController(vc, animated: pushAnimated)
446 }else{ 448 }else{
447 449
@@ -471,6 +473,7 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in @@ -471,6 +473,7 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in
471 vc.url = URL(string: url) 473 vc.url = URL(string: url)
472 vc.vodPlayModel = tempVodModel 474 vc.vodPlayModel = tempVodModel
473 vc.contentId = contentId 475 vc.contentId = contentId
  476 + let naviVC = CNLiveBaseNavigationController(rootViewController: vc)
474 navigationVC?.pushViewController(vc, animated: pushAnimated) 477 navigationVC?.pushViewController(vc, animated: pushAnimated)
475 }else{ 478 }else{
476 479
metaCode/Classes/Other/AppDelegate.swift
@@ -156,6 +156,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { @@ -156,6 +156,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
156 return .portrait 156 return .portrait
157 } 157 }
158 158
  159 + func applicationDidEnterBackground(_ application: UIApplication) {
  160 +
  161 + }
  162 +
159 163
160 // MARK: - 键盘处理 164 // MARK: - 键盘处理
161 func AppDelegate_configIQKeyboardManager() { 165 func AppDelegate_configIQKeyboardManager() {