Commit 3a78176bb7cb21db5548373729703594cd68eafb
1 parent
c772e303
优化点播详情页点击专辑或者看点刷新看点和相关推荐
Showing
1 changed file
with
99 additions
and
99 deletions
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
| ... | ... | @@ -352,7 +352,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 352 | 352 | } |
| 353 | 353 | self.isPlayAblumOrKandian = false |
| 354 | 354 | self.kanDianIndex = seleIndex |
| 355 | - self.kanDianOrAlbumChangeContentApi(contentId: vodPlayBlockListListModel.contentId, title: vodPlayBlockListListModel.title, isAlbum: isAblumVideo, activeId: vodPlayBlockListListModel.pid) | |
| 355 | + self.kanDianOrAlbumChangeContentApi(contentId: vodPlayBlockListListModel.contentId, title: vodPlayBlockListListModel.title, isAlbum: isAblumVideo, activeId: vodPlayBlockListListModel.pid, isRefreshPlayer:true ) | |
| 356 | 356 | |
| 357 | 357 | } |
| 358 | 358 | |
| ... | ... | @@ -409,7 +409,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 409 | 409 | self.albumIndex = 0 |
| 410 | 410 | self.kanDianIndex = -1 |
| 411 | 411 | self.isPlayAblumOrKandian = true |
| 412 | - self.kanDianOrAlbumChangeContentApi(contentId: self.vodPlayModel?.contentId ?? "", title: title, isAlbum: true, activeId: self.vodPlayModel?.contentId ?? "") | |
| 412 | + self.kanDianOrAlbumChangeContentApi(contentId: self.vodPlayModel?.contentId ?? "", title: title, isAlbum: true, activeId: self.vodPlayModel?.contentId ?? "", isRefreshPlayer: true) | |
| 413 | 413 | self.player.allowOrentitaionRotation = true |
| 414 | 414 | }else{ |
| 415 | 415 | //没付费 |
| ... | ... | @@ -556,7 +556,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 556 | 556 | if let albumModel = self.albumListArr[nextIdx] as? CNLiveVodAlbumListModel{ |
| 557 | 557 | //播专辑列表下一条 |
| 558 | 558 | self.contentId = albumModel.contentId |
| 559 | - self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: self.isAblumVideo, activeId: albumModel.activityId) | |
| 559 | + self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: self.isAblumVideo, activeId: albumModel.activityId, isRefreshPlayer: true) | |
| 560 | 560 | // self.changeContentApi(vodModel: albumModel) |
| 561 | 561 | } |
| 562 | 562 | |
| ... | ... | @@ -574,7 +574,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 574 | 574 | //播列表下一条 |
| 575 | 575 | let isAblumVideo = (albumModel.album?.albumId.count ?? 0 > 0) ? true : false |
| 576 | 576 | // if isAblumVideo{ |
| 577 | - self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: isAblumVideo, activeId: albumModel.pid) | |
| 577 | + self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: isAblumVideo, activeId: albumModel.pid, isRefreshPlayer: true) | |
| 578 | 578 | // }else{ |
| 579 | 579 | // self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: isAblumVideo, activeId: albumModel.pid) |
| 580 | 580 | // } |
| ... | ... | @@ -659,74 +659,74 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 659 | 659 | self.player.stop() |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | - // MARK: - 专辑/看点 列表切换某集,只刷新播放器和点赞收藏 | |
| 663 | - func kanDianOrAlbumChangeContentApi(contentId:String,title:String,isAlbum:Bool,activeId:String){ | |
| 662 | + // MARK: - 专辑/看点 列表切换某集 | |
| 663 | + func kanDianOrAlbumChangeContentApi(contentId:String,title:String,isAlbum:Bool,activeId:String, isRefreshPlayer: Bool){ | |
| 664 | 664 | // if isAlbum{ |
| 665 | - self.changeContentApi(activityId: activeId, title: title, contentId: contentId) | |
| 665 | + self.changeContentApi(activityId: activeId, title: title, contentId: contentId, isRefreshPlayer: isRefreshPlayer) | |
| 666 | 666 | // }else{ |
| 667 | 667 | // self.kanDianChangeContentApi(contentId: contentId, title: title) |
| 668 | 668 | // } |
| 669 | 669 | } |
| 670 | 670 | // MARK: - 看点列表切换某集 只刷新播放器和点赞收藏 |
| 671 | - func kanDianChangeContentApi(contentId:String,title:String){ | |
| 672 | - self.isPlayAblumOrKandian = false | |
| 673 | - //刷新url | |
| 674 | - CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: contentId) {[weak self] result, status in | |
| 675 | - guard let self = self else { return } | |
| 676 | - if status == .success | |
| 677 | - { | |
| 678 | - if let url = result as? String{ | |
| 679 | - self.playWithUrlAndTitle(url: url, title: title) | |
| 680 | - self.url = URL(string: url) | |
| 681 | - } | |
| 682 | - }else{ | |
| 683 | - | |
| 684 | - } | |
| 685 | - } | |
| 686 | - | |
| 687 | - //play接口刷新 看点和电商 | |
| 688 | - CNLiveDownSlideTool.getVodPlayApi(contentId: contentId) {[weak self] result, status in | |
| 689 | - guard let self = self else { return } | |
| 690 | - if status == .success{ | |
| 691 | - if let vodPlayModel = result as? CNLiveVodPlayModel{ | |
| 692 | -// self.vodPlayModel = vodPlayModel | |
| 693 | - //单集有值-简介 | |
| 694 | - var index = 0 | |
| 695 | - var isReplace = false | |
| 696 | - var tempMdl:CNLiveVodPlayBlockListModel? | |
| 697 | - for (idx,mdl) in self.dataArray.enumerated(){ | |
| 698 | - if var tempVodMdl = mdl as? CNLiveVodPlayBlockListModel{ | |
| 699 | - if tempVodMdl.type == "5"{//点播详情数据 | |
| 700 | - | |
| 701 | - for (_,vodMdl) in vodPlayModel.blockList.enumerated(){ | |
| 702 | - if vodMdl.type == "5"{ | |
| 703 | - tempMdl = vodMdl | |
| 704 | - index = idx | |
| 705 | - isReplace = true | |
| 706 | - } | |
| 707 | - } | |
| 708 | - } | |
| 709 | - } | |
| 710 | - } | |
| 711 | - if isReplace{ | |
| 712 | - self.dataArray.replaceObject(at: index, with: tempMdl as Any) | |
| 713 | - }else{} | |
| 714 | - self.controlView.vodPlayModel = vodPlayModel | |
| 715 | - self.configDataArray() | |
| 716 | - self.tableView.reloadData() | |
| 717 | - }else{ | |
| 718 | - | |
| 719 | - } | |
| 720 | - }else{ | |
| 721 | - | |
| 722 | - } | |
| 723 | - } | |
| 724 | - | |
| 725 | - } | |
| 671 | +// func kanDianChangeContentApi(contentId:String,title:String){ | |
| 672 | +// self.isPlayAblumOrKandian = false | |
| 673 | +// //刷新url | |
| 674 | +// CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: contentId) {[weak self] result, status in | |
| 675 | +// guard let self = self else { return } | |
| 676 | +// if status == .success | |
| 677 | +// { | |
| 678 | +// if let url = result as? String{ | |
| 679 | +// self.playWithUrlAndTitle(url: url, title: title) | |
| 680 | +// self.url = URL(string: url) | |
| 681 | +// } | |
| 682 | +// }else{ | |
| 683 | +// | |
| 684 | +// } | |
| 685 | +// } | |
| 686 | +// | |
| 687 | +// //play接口刷新 看点和电商 | |
| 688 | +// CNLiveDownSlideTool.getVodPlayApi(contentId: contentId) {[weak self] result, status in | |
| 689 | +// guard let self = self else { return } | |
| 690 | +// if status == .success{ | |
| 691 | +// if let vodPlayModel = result as? CNLiveVodPlayModel{ | |
| 692 | +//// self.vodPlayModel = vodPlayModel | |
| 693 | +// //单集有值-简介 | |
| 694 | +// var index = 0 | |
| 695 | +// var isReplace = false | |
| 696 | +// var tempMdl:CNLiveVodPlayBlockListModel? | |
| 697 | +// for (idx,mdl) in self.dataArray.enumerated(){ | |
| 698 | +// if var tempVodMdl = mdl as? CNLiveVodPlayBlockListModel{ | |
| 699 | +// if tempVodMdl.type == "5"{//点播详情数据 | |
| 700 | +// | |
| 701 | +// for (_,vodMdl) in vodPlayModel.blockList.enumerated(){ | |
| 702 | +// if vodMdl.type == "5"{ | |
| 703 | +// tempMdl = vodMdl | |
| 704 | +// index = idx | |
| 705 | +// isReplace = true | |
| 706 | +// } | |
| 707 | +// } | |
| 708 | +// } | |
| 709 | +// } | |
| 710 | +// } | |
| 711 | +// if isReplace{ | |
| 712 | +// self.dataArray.replaceObject(at: index, with: tempMdl as Any) | |
| 713 | +// }else{} | |
| 714 | +// self.controlView.vodPlayModel = vodPlayModel | |
| 715 | +// self.configDataArray() | |
| 716 | +// self.tableView.reloadData() | |
| 717 | +// }else{ | |
| 718 | +// | |
| 719 | +// } | |
| 720 | +// }else{ | |
| 721 | +// | |
| 722 | +// } | |
| 723 | +// } | |
| 724 | +// | |
| 725 | +// } | |
| 726 | 726 | |
| 727 | 727 | |
| 728 | - // MARK: -专辑列表切换某集 ,刷新看点和电商 | |
| 729 | - func changeContentApi(activityId:String,title:String,contentId:String){ | |
| 728 | + // MARK: -专辑/看点 列表切换某集 ,刷新看点和电商 | |
| 729 | + func changeContentApi(activityId:String,title:String,contentId:String,isRefreshPlayer:Bool){ | |
| 730 | 730 | // self.isPlayAblumOrKandian = true |
| 731 | 731 | |
| 732 | 732 | //play接口刷新 看点和电商 1350755 |
| ... | ... | @@ -773,16 +773,18 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 773 | 773 | self.controlView.vodPlayModel = tempVodPlayModel |
| 774 | 774 | |
| 775 | 775 | //刷新url 1955_71512cfbcd5b497580732b48e26d16d6 |
| 776 | - CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: activityId) {[weak self] result, status in | |
| 777 | - guard let self = self else { return } | |
| 778 | - if status == .success | |
| 779 | - { | |
| 780 | - if let url = result as? String{ | |
| 781 | - self.playWithUrlAndTitle(url: url, title: title) | |
| 782 | - self.url = URL(string: url) | |
| 776 | + if isRefreshPlayer{ | |
| 777 | + CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: activityId) {[weak self] result, status in | |
| 778 | + guard let self = self else { return } | |
| 779 | + if status == .success | |
| 780 | + { | |
| 781 | + if let url = result as? String{ | |
| 782 | + self.playWithUrlAndTitle(url: url, title: title) | |
| 783 | + self.url = URL(string: url) | |
| 784 | + } | |
| 785 | + }else{ | |
| 786 | + | |
| 783 | 787 | } |
| 784 | - }else{ | |
| 785 | - | |
| 786 | 788 | } |
| 787 | 789 | } |
| 788 | 790 | |
| ... | ... | @@ -876,10 +878,12 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 876 | 878 | } |
| 877 | 879 | cell.currSeleIdx = self.kanDianIndex//-1 |
| 878 | 880 | cell.vodPlayBlockListModel = vodPlayBlockListModel |
| 881 | + ////看点展开 | |
| 879 | 882 | cell.expandBlock = { [weak self] model in |
| 880 | 883 | guard let self = self else { return } |
| 881 | 884 | self.trailersCellDetailBtnAction(vodPlayBlockListModel: model) |
| 882 | 885 | } |
| 886 | + ////看点点击 | |
| 883 | 887 | cell.selectBlock = { [weak self] model,index,kanDianListArr in |
| 884 | 888 | guard let self = self else { return } |
| 885 | 889 | //点击看点 |
| ... | ... | @@ -927,7 +931,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 927 | 931 | //kanDianListArr cnLivevodPlayBlocjListlistModel |
| 928 | 932 | self.controlView.xuanjiBgView.currSeleIdx = index |
| 929 | 933 | self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr |
| 930 | - self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid) | |
| 934 | + self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:true ) | |
| 931 | 935 | self.player.allowOrentitaionRotation = true |
| 932 | 936 | }else{ |
| 933 | 937 | //没付费 |
| ... | ... | @@ -939,16 +943,23 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 939 | 943 | self.controlView.vodPlayModel = vodMdl |
| 940 | 944 | self.controlView.payBgView.isHidden = false |
| 941 | 945 | self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本集内容", for: .normal) |
| 946 | + | |
| 947 | + self.contentId = model.contentId | |
| 948 | + let isAblumVideo = (model.album?.albumId.count ?? 0 > 0) ? true : false | |
| 949 | + self.albumIndex = -1 | |
| 950 | + self.kanDianIndex = index | |
| 951 | + self.kanDianListArr = kanDianListArr | |
| 952 | + self.isPlayAblumOrKandian = false | |
| 953 | + | |
| 942 | 954 | //成功用pay参数 刷新页面 |
| 943 | 955 | self.payVodProductModel = model.product |
| 944 | 956 | self.payContentId = model.contentId |
| 945 | 957 | self.payIndex = -1 |
| 946 | - self.kanDianIndex = index | |
| 947 | - self.isPlayAblumOrKandian = false | |
| 948 | 958 | self.payTitle = model.title |
| 949 | 959 | self.payIsAlbum = false |
| 950 | 960 | self.payActivityId = model.pid |
| 951 | 961 | self.player.allowOrentitaionRotation = false |
| 962 | + self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:false ) | |
| 952 | 963 | } |
| 953 | 964 | } |
| 954 | 965 | return cell |
| ... | ... | @@ -974,6 +985,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 974 | 985 | // self.controlView.xuanjiBgView.kanDianListArr = self.kanDianListArr |
| 975 | 986 | //CNLiveVodPlayblockListListModel |
| 976 | 987 | } |
| 988 | + //点击专辑 | |
| 977 | 989 | cell.selectBlock = {[weak self] vodModel, index ,albumListArr in |
| 978 | 990 | guard let self = self else { return } |
| 979 | 991 | self.player.currentPlayerManager.pause() |
| ... | ... | @@ -1006,24 +1018,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 1006 | 1018 | self.controlView.payBgView.isHidden = true |
| 1007 | 1019 | isPayZhuanJi = true |
| 1008 | 1020 | } |
| 1009 | - | |
| 1010 | - | |
| 1011 | -// if vodModel.product?.productType == "2" || vodModel.product?.productType == "5"{//付费 | |
| 1012 | -// | |
| 1013 | -// }else{ | |
| 1014 | -// if vodModel.product?.check == true { | |
| 1015 | -// | |
| 1016 | -// } else { | |
| 1017 | -// if vodModel.product?.productType == "4" { | |
| 1018 | -// //这里表示可以进行试听 | |
| 1019 | -// self.controlView.payBgView.isHidden = true | |
| 1020 | -// isPayZhuanJi = true | |
| 1021 | -// } else { | |
| 1022 | -// self.controlView.payBgView.isHidden = true | |
| 1023 | -// isPayZhuanJi = true | |
| 1024 | -// } | |
| 1025 | -// } | |
| 1026 | -// } | |
| 1027 | 1021 | |
| 1028 | 1022 | if isPayZhuanJi{ |
| 1029 | 1023 | //已经付费 |
| ... | ... | @@ -1033,7 +1027,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 1033 | 1027 | self.albumIndex = index |
| 1034 | 1028 | self.kanDianIndex = -1 |
| 1035 | 1029 | self.isPlayAblumOrKandian = true |
| 1036 | - self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId) | |
| 1030 | + self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId, isRefreshPlayer: true) | |
| 1037 | 1031 | self.player.allowOrentitaionRotation = true |
| 1038 | 1032 | }else{ |
| 1039 | 1033 | //没付费 |
| ... | ... | @@ -1045,18 +1039,24 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 1045 | 1039 | self.controlView.vodPlayModel = vodMdl |
| 1046 | 1040 | self.controlView.payBgView.isHidden = false |
| 1047 | 1041 | self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本专辑", for: .normal) |
| 1042 | + | |
| 1043 | + self.contentId = vodModel.contentId | |
| 1044 | + self.albumListArr = albumListArr | |
| 1045 | + self.albumIndex = index | |
| 1046 | + self.kanDianIndex = -1 | |
| 1047 | + self.isPlayAblumOrKandian = true | |
| 1048 | + | |
| 1048 | 1049 | //成功用pay参数 刷新页面 |
| 1049 | 1050 | self.payVodAlbumListModel = vodModel |
| 1050 | 1051 | self.payAid = vodModel.albumId//.contentId |
| 1051 | 1052 | self.payContentId = vodModel.contentId |
| 1052 | 1053 | self.payAlbumListArr = albumListArr |
| 1053 | 1054 | self.payIndex = index |
| 1054 | - self.kanDianIndex = -1 | |
| 1055 | - self.isPlayAblumOrKandian = true | |
| 1056 | 1055 | self.payTitle = vodModel.title |
| 1057 | 1056 | self.payIsAlbum = true |
| 1058 | 1057 | self.payActivityId = vodModel.activityId |
| 1059 | 1058 | self.player.allowOrentitaionRotation = false |
| 1059 | + self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId, isRefreshPlayer: false) | |
| 1060 | 1060 | } |
| 1061 | 1061 | } |
| 1062 | 1062 | return cell |
| ... | ... | @@ -1225,7 +1225,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 1225 | 1225 | //kanDianListArr cnLivevodPlayBlocjListlistModel |
| 1226 | 1226 | self.controlView.xuanjiBgView.currSeleIdx = seleIdx |
| 1227 | 1227 | self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr |
| 1228 | - self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid) | |
| 1228 | + self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:true ) | |
| 1229 | 1229 | self.player.allowOrentitaionRotation = true |
| 1230 | 1230 | }else{ |
| 1231 | 1231 | //没付费 |
| ... | ... | @@ -1268,7 +1268,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 1268 | 1268 | // self.controlView.xuanjiBgView.currSeleIdx = seleIdx |
| 1269 | 1269 | // self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr |
| 1270 | 1270 | // |
| 1271 | -// self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid) | |
| 1271 | +// self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer: ) | |
| 1272 | 1272 | } |
| 1273 | 1273 | } |
| 1274 | 1274 | // MARK: - 简介cell点击事件 | ... | ... |