Commit 9b4258e25852907d48a5792508c5e57085ff1b4d

Authored by “张旭”
1 parent 8ed365b8

点播页评论数

开屏图片支持
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
@@ -35,6 +35,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -35,6 +35,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
35 var contentId = "" 35 var contentId = ""
36 var playTitle = "" 36 var playTitle = ""
37 var isSeek = false 37 var isSeek = false
  38 +
  39 +
38 //当前播放列表 专辑true / 看点false 40 //当前播放列表 专辑true / 看点false
39 var isPlayAblumOrKandian = false 41 var isPlayAblumOrKandian = false
40 var isAblumVideo = false 42 var isAblumVideo = false
@@ -62,6 +64,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -62,6 +64,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
62 _vodPlayModel = newValue! 64 _vodPlayModel = newValue!
63 } 65 }
64 } 66 }
  67 +
  68 + var vodPlayBlockListList5Model:CNLiveVodPlayBlockListListModel?//点播详情数据
65 69
66 // 专辑列表model 70 // 专辑列表model
67 var _vodAlbumListBaseModel : CNLiveVodAlbumListBaseModel? 71 var _vodAlbumListBaseModel : CNLiveVodAlbumListBaseModel?
@@ -143,6 +147,17 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -143,6 +147,17 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
143 iconImgView.image = UIImage(named: "home_player_comment") 147 iconImgView.image = UIImage(named: "home_player_comment")
144 return iconImgView 148 return iconImgView
145 }() 149 }()
  150 + lazy var bottomCommentNumLabel: UILabel = {
  151 + let titleLabel = UILabel()
  152 + titleLabel.text = ""
  153 + titleLabel.textColor = HexColor("#FFFFFF")
  154 + titleLabel.backgroundColor = HexColor("#FF0000")
  155 + titleLabel.textAlignment = .center
  156 + titleLabel.font = UIFont.systemFont(ofSize: 9)
  157 + titleLabel.layer.cornerRadius = 5
  158 + titleLabel.clipsToBounds = true
  159 + return titleLabel
  160 + }()
146 161
147 162
148 lazy var whitBgView :UIView = { 163 lazy var whitBgView :UIView = {
@@ -213,6 +228,14 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -213,6 +228,14 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
213 make.width.equalTo(25) 228 make.width.equalTo(25)
214 make.height.equalTo(24) 229 make.height.equalTo(24)
215 } 230 }
  231 + self.bottomCommentImgView.addSubview(self.bottomCommentNumLabel)
  232 + bottomCommentNumLabel.snp.makeConstraints { make in
  233 + make.right.equalToSuperview().offset(7.5)
  234 + make.top.equalTo(-5)
  235 + make.width.equalTo(15)
  236 + make.height.equalTo(10)
  237 + }
  238 +
216 self.view.addSubview(self.bottomCommentShowContainView) 239 self.view.addSubview(self.bottomCommentShowContainView)
217 bottomCommentShowContainView.snp.makeConstraints { make in 240 bottomCommentShowContainView.snp.makeConstraints { make in
218 make.left.equalToSuperview() 241 make.left.equalToSuperview()
@@ -221,7 +244,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -221,7 +244,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
221 make.height.equalToSuperview().offset(-self.containerView.bottom) 244 make.height.equalToSuperview().offset(-self.containerView.bottom)
222 } 245 }
223 bottomCommentShowContainView.isHidden = true 246 bottomCommentShowContainView.isHidden = true
224 -// self.addRefreshView() 247 + self.addRefreshView()
225 self.isAblumVideo = false 248 self.isAblumVideo = false
226 self.isPlayAblumOrKandian = false 249 self.isPlayAblumOrKandian = false
227 250
@@ -238,6 +261,21 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -238,6 +261,21 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
238 self.configDataArray() 261 self.configDataArray()
239 self.setupPlayer() 262 self.setupPlayer()
240 263
  264 + let pid = (self.vodPlayBlockListList5Model?.pid.count ?? 0 > 0) ? (self.vodPlayBlockListList5Model?.pid ?? "") : (self.vodPlayBlockListList5Model?.contentId ?? "")
  265 + CNLiveShortVideoViewModel.requestCommentList(pid: pid, page: 1) {[weak self] result, respStatue in
  266 + guard let self = self else { return }
  267 + if respStatue == .success {
  268 + let total_hd = (result as! ShortVideoHomeCommentModel).total_hd ?? 0
  269 + if total_hd == 0{
  270 + self.bottomCommentNumLabel.isHidden = true
  271 + }else{
  272 + self.bottomCommentNumLabel.isHidden = false
  273 + self.bottomCommentNumLabel.text = "\(total_hd)"
  274 + }
  275 +
  276 + }
  277 + }
  278 +
241 279
242 NotificationCenter.default.addObserver( 280 NotificationCenter.default.addObserver(
243 self, 281 self,
@@ -281,37 +319,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -281,37 +319,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
281 } 319 }
282 } 320 }
283 321
284 - // 响应录屏状态变化  
285 -// func playHandleScreenCaptureChange(isFullScreen:Bool) {  
286 -// if isFullScreen{  
287 -// if metaAppDelegate.isCaptured {  
288 -// hidePrivacyProtection()  
289 -//  
290 -// let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .regular))  
291 -// blurView.frame = self.controlView.landScapeControlView.bounds  
292 -// blurView.tag = 10001  
293 -// self.controlView.landScapeControlView.addSubview(blurView)  
294 -//  
295 -// let vc = self.controlView.landScapeControlView.viewController  
296 -// if let preVC = vc?.presentedViewController as? UIAlertController {  
297 -// vc?.dismiss(animated: false)  
298 -// }  
299 -// // 显示警告提示  
300 -// let alert = UIAlertController(  
301 -// title: "录屏已开启",  
302 -// message: "当前功能禁止屏幕录制",  
303 -// preferredStyle: .alert  
304 -// )  
305 -// vc?.present(alert, animated: false)  
306 -// } else {  
307 -// hidePrivacyProtection()  
308 -// }  
309 -//  
310 -// }else{  
311 -// self.handleScreenCaptureChange()  
312 -// }  
313 -//  
314 -// }  
315 @objc private func handleScreenCaptureChange() { 322 @objc private func handleScreenCaptureChange() {
316 if metaAppDelegate.isCaptured { 323 if metaAppDelegate.isCaptured {
317 showPrivacyProtection() 324 showPrivacyProtection()
@@ -383,6 +390,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -383,6 +390,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
383 if mdl.type == "5"{//点播详情数据 390 if mdl.type == "5"{//点播详情数据
384 //CNLiveVodPlayBlockListModel 391 //CNLiveVodPlayBlockListModel
385 tempDataArray.add(mdl) 392 tempDataArray.add(mdl)
  393 + self.vodPlayBlockListList5Model = mdl.list.first
386 } 394 }
387 } 395 }
388 } 396 }
metaCode/Classes/Other/AD/CNLiveLaunchAdController.swift
@@ -55,7 +55,7 @@ class CNLiveLaunchAdController:UIViewController,URLSessionTaskDelegate{ @@ -55,7 +55,7 @@ class CNLiveLaunchAdController:UIViewController,URLSessionTaskDelegate{
55 // 2. 存在有效URL时执行清理 55 // 2. 存在有效URL时执行清理
56 if !oldUrl.isEmpty { 56 if !oldUrl.isEmpty {
57 // 3. 检查图片缓存是否存在 57 // 3. 检查图片缓存是否存在
58 - if let cachedImageData = CNOSAdImgDownloadManager.getOSImage(with: oldUrl),let image = UIImage(data: cachedImageData) { 58 + if let image = CNOSAdImgDownloadManager.getOSImage(with: oldUrl){//,let image = UIImage(data: cachedImageData) {
59 // 4. 异步执行资源清理(避免阻塞主线程) 59 // 4. 异步执行资源清理(避免阻塞主线程)
60 DispatchQueue.global(qos: .utility).async { 60 DispatchQueue.global(qos: .utility).async {
61 CNOSAdImgDownloadManager.clearOSImage(with: oldUrl) 61 CNOSAdImgDownloadManager.clearOSImage(with: oldUrl)
@@ -95,7 +95,7 @@ class CNLiveLaunchAdController:UIViewController,URLSessionTaskDelegate{ @@ -95,7 +95,7 @@ class CNLiveLaunchAdController:UIViewController,URLSessionTaskDelegate{
95 let imageUrl = UserDefaults.standard.string(forKey: "wjjAdv_imageUrl") 95 let imageUrl = UserDefaults.standard.string(forKey: "wjjAdv_imageUrl")
96 // let localImage = CNOSAdImgDownloadManager.getOSImage(with: imageUrl) 96 // let localImage = CNOSAdImgDownloadManager.getOSImage(with: imageUrl)
97 var localImage:UIImage? 97 var localImage:UIImage?
98 - if let cachedImageData = CNOSAdImgDownloadManager.getOSImage(with: imageUrl),let localImg = UIImage(data: cachedImageData){ 98 + if let localImg = CNOSAdImgDownloadManager.getOSImage(with: imageUrl){//,let localImg = UIImage(data: cachedImageData){
99 localImage = localImg 99 localImage = localImg
100 } 100 }
101 101
@@ -156,19 +156,19 @@ class CNLiveLaunchAdController:UIViewController,URLSessionTaskDelegate{ @@ -156,19 +156,19 @@ class CNLiveLaunchAdController:UIViewController,URLSessionTaskDelegate{
156 } 156 }
157 157
158 // 判断本地是否存在广告图片 158 // 判断本地是否存在广告图片
159 - if let data = CNOSAdImgDownloadManager.getOSImage(with: UserDefaults.standard.string(forKey: "wjjAdv_imageUrl")), let newImage = YYImage(data: data){  
160 - let g = YYAnimatedImageView(image: newImage)  
161 - print("YYImage:\(g.image)")  
162 - let f = YYImage.animatedImage(withAnimatedGIFData: data)  
163 - let b = YYImage.gif(data: data)  
164 - let c = UIImage.sd_image(withGIFData: data)  
165 - let a = UIImage(data: data)  
166 - let d = YYFrameImage(data: data)  
167 - let e = YYImage(smallGIFData: data, scale: 1) 159 + if let newImage = CNOSAdImgDownloadManager.getOSImage(with: UserDefaults.standard.string(forKey: "wjjAdv_imageUrl")){//}, let newImage = YYImage(data: data){
  160 +// let g = YYAnimatedImageView(image: newImage)
  161 +// print("YYImage:\(g.image)")
  162 +// let f = YYImage.animatedImage(withAnimatedGIFData: data)
  163 +// let b = YYImage.gif(data: data)
  164 +// let c = UIImage.sd_image(withGIFData: data)
  165 +// let a = UIImage(data: data)
  166 +// let d = YYFrameImage(data: data)
  167 +// let e = YYImage(smallGIFData: data, scale: 1)
168 // let newImage = CNOSAdImgDownloadManager.getOSImage(with: UserDefaults.standard.string(forKey: "wjjAdv_imageUrl")){ 168 // let newImage = CNOSAdImgDownloadManager.getOSImage(with: UserDefaults.standard.string(forKey: "wjjAdv_imageUrl")){
169 // 显示广告 169 // 显示广告
170 // let yyImage = newImage as? YYImage 170 // let yyImage = newImage as? YYImage
171 - print("YYImage:\(newImage),UIImage:\(c)") 171 +// print("YYImage:\(newImage),UIImage:\(c)")
172 bgView.isUserInteractionEnabled = true 172 bgView.isUserInteractionEnabled = true
173 bgView.addSubview(advImg) 173 bgView.addSubview(advImg)
174 bgView.addSubview(skipBtn) 174 bgView.addSubview(skipBtn)
metaCode/Classes/Other/AD/CNOSAdImgDownloadManager.swift
@@ -34,36 +34,36 @@ final class CNOSAdImgDownloadManager { @@ -34,36 +34,36 @@ final class CNOSAdImgDownloadManager {
34 34
35 let ocUrl: NSString = NSString(string: url ?? "") 35 let ocUrl: NSString = NSString(string: url ?? "")
36 if let md5Key = ocUrl.md5(){ 36 if let md5Key = ocUrl.md5(){
37 - guard let data = image.imageData else { return }//image.sd_imageData()  
38 - shared.cache.storeImageData(toDisk: data, forKey: md5Key)  
39 -// shared.cache.store(image, forKey: md5Key, completion: {  
40 -// success?()  
41 -// }) 37 +// guard let data = image.imageData else { return }//image.sd_imageData()
  38 +// shared.cache.storeImageData(toDisk: data, forKey: md5Key)
  39 + shared.cache.store(image, forKey: md5Key, completion: {
  40 + success?()
  41 + })
42 } 42 }
43 } 43 }
44 } 44 }
45 45
46 /// 获取缓存图片 46 /// 获取缓存图片
47 - static func getOSImage(with url: String?) -> Data? { 47 + static func getOSImage(with url: String?) -> UIImage? {
48 let ocUrl: NSString = NSString(string: url ?? "") 48 let ocUrl: NSString = NSString(string: url ?? "")
49 if let md5Key = ocUrl.md5(){ 49 if let md5Key = ocUrl.md5(){
50 - let isCached = shared.cache.diskImageDataExists(withKey: md5Key)  
51 -  
52 - if isCached{  
53 - return shared.cache.diskImageData(forKey: md5Key)  
54 - } 50 +// let isCached = shared.cache.diskImageDataExists(withKey: md5Key)
  51 +//
  52 +// if isCached{
  53 +// return shared.cache.diskImageData(forKey: md5Key)
  54 +// }
55 55
56 -// return shared.cache.imageFromCache(forKey: md5Key)// as? YYImage 56 + return shared.cache.imageFromCache(forKey: md5Key)// as? YYImage
57 } 57 }
58 - return nil//shared.cache.imageFromCache(forKey: "")// as? YYImage 58 + return shared.cache.imageFromCache(forKey: "")// as? YYImage
59 } 59 }
60 60
61 /// 清除指定图片缓存 61 /// 清除指定图片缓存
62 static func clearOSImage(with url: String?) { 62 static func clearOSImage(with url: String?) {
63 let ocUrl: NSString = NSString(string: url ?? "") 63 let ocUrl: NSString = NSString(string: url ?? "")
64 if let md5Key = ocUrl.md5(){ 64 if let md5Key = ocUrl.md5(){
65 - shared.cache.removeImageFromDisk(forKey: md5Key)  
66 -// shared.cache.removeImage(forKey: md5Key, withCompletion: nil) 65 +// shared.cache.removeImageFromDisk(forKey: md5Key)
  66 + shared.cache.removeImage(forKey: md5Key, withCompletion: nil)
67 } 67 }
68 } 68 }
69 } 69 }
metaCode/Classes/Other/AppDelegate.swift
@@ -177,7 +177,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { @@ -177,7 +177,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
177 } else { 177 } else {
178 self.isCaptured = false 178 self.isCaptured = false
179 } 179 }
180 - print("1111111appdelegateisCaptured:\(self.isCaptured) ")  
181 } 180 }
182 181
183 // MARK: - 键盘处理 182 // MARK: - 键盘处理