Commit 9b4258e25852907d48a5792508c5e57085ff1b4d
1 parent
8ed365b8
点播页评论数
开屏图片支持
Showing
4 changed files
with
67 additions
and
60 deletions
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
| ... | ... | @@ -35,6 +35,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 35 | 35 | var contentId = "" |
| 36 | 36 | var playTitle = "" |
| 37 | 37 | var isSeek = false |
| 38 | + | |
| 39 | + | |
| 38 | 40 | //当前播放列表 专辑true / 看点false |
| 39 | 41 | var isPlayAblumOrKandian = false |
| 40 | 42 | var isAblumVideo = false |
| ... | ... | @@ -62,6 +64,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 62 | 64 | _vodPlayModel = newValue! |
| 63 | 65 | } |
| 64 | 66 | } |
| 67 | + | |
| 68 | + var vodPlayBlockListList5Model:CNLiveVodPlayBlockListListModel?//点播详情数据 | |
| 65 | 69 | |
| 66 | 70 | // 专辑列表model |
| 67 | 71 | var _vodAlbumListBaseModel : CNLiveVodAlbumListBaseModel? |
| ... | ... | @@ -143,6 +147,17 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 143 | 147 | iconImgView.image = UIImage(named: "home_player_comment") |
| 144 | 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 | 163 | lazy var whitBgView :UIView = { |
| ... | ... | @@ -213,6 +228,14 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 213 | 228 | make.width.equalTo(25) |
| 214 | 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 | 239 | self.view.addSubview(self.bottomCommentShowContainView) |
| 217 | 240 | bottomCommentShowContainView.snp.makeConstraints { make in |
| 218 | 241 | make.left.equalToSuperview() |
| ... | ... | @@ -221,7 +244,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 221 | 244 | make.height.equalToSuperview().offset(-self.containerView.bottom) |
| 222 | 245 | } |
| 223 | 246 | bottomCommentShowContainView.isHidden = true |
| 224 | -// self.addRefreshView() | |
| 247 | + self.addRefreshView() | |
| 225 | 248 | self.isAblumVideo = false |
| 226 | 249 | self.isPlayAblumOrKandian = false |
| 227 | 250 | |
| ... | ... | @@ -238,6 +261,21 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 238 | 261 | self.configDataArray() |
| 239 | 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 | 280 | NotificationCenter.default.addObserver( |
| 243 | 281 | self, |
| ... | ... | @@ -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 | 322 | @objc private func handleScreenCaptureChange() { |
| 316 | 323 | if metaAppDelegate.isCaptured { |
| 317 | 324 | showPrivacyProtection() |
| ... | ... | @@ -383,6 +390,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 383 | 390 | if mdl.type == "5"{//点播详情数据 |
| 384 | 391 | //CNLiveVodPlayBlockListModel |
| 385 | 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 | 55 | // 2. 存在有效URL时执行清理 |
| 56 | 56 | if !oldUrl.isEmpty { |
| 57 | 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 | 59 | // 4. 异步执行资源清理(避免阻塞主线程) |
| 60 | 60 | DispatchQueue.global(qos: .utility).async { |
| 61 | 61 | CNOSAdImgDownloadManager.clearOSImage(with: oldUrl) |
| ... | ... | @@ -95,7 +95,7 @@ class CNLiveLaunchAdController:UIViewController,URLSessionTaskDelegate{ |
| 95 | 95 | let imageUrl = UserDefaults.standard.string(forKey: "wjjAdv_imageUrl") |
| 96 | 96 | // let localImage = CNOSAdImgDownloadManager.getOSImage(with: imageUrl) |
| 97 | 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 | 99 | localImage = localImg |
| 100 | 100 | } |
| 101 | 101 | |
| ... | ... | @@ -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 | 168 | // let newImage = CNOSAdImgDownloadManager.getOSImage(with: UserDefaults.standard.string(forKey: "wjjAdv_imageUrl")){ |
| 169 | 169 | // 显示广告 |
| 170 | 170 | // let yyImage = newImage as? YYImage |
| 171 | - print("YYImage:\(newImage),UIImage:\(c)") | |
| 171 | +// print("YYImage:\(newImage),UIImage:\(c)") | |
| 172 | 172 | bgView.isUserInteractionEnabled = true |
| 173 | 173 | bgView.addSubview(advImg) |
| 174 | 174 | bgView.addSubview(skipBtn) | ... | ... |
metaCode/Classes/Other/AD/CNOSAdImgDownloadManager.swift
| ... | ... | @@ -34,36 +34,36 @@ final class CNOSAdImgDownloadManager { |
| 34 | 34 | |
| 35 | 35 | let ocUrl: NSString = NSString(string: url ?? "") |
| 36 | 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 | 48 | let ocUrl: NSString = NSString(string: url ?? "") |
| 49 | 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 | 62 | static func clearOSImage(with url: String?) { |
| 63 | 63 | let ocUrl: NSString = NSString(string: url ?? "") |
| 64 | 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