CNLiveTVPlayerViewController.swift
28.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
//
// CNLivePlayerViewController.swift
// metaCode
//
// Created by zx on 2025/1/21.
//
import Foundation
import ZFPlayer
import MJRefresh
import HandyJSON
import CNLiveShareToolKit
class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITableViewDelegate{
//当前内容id
var contentId = ""
//CNLiveVodPlayModel 单集model
var _vodPlayModel : CNLiveVodPlayModel?
var vodPlayModel : CNLiveVodPlayModel? {
get{
_vodPlayModel
}
set{
_vodPlayModel = newValue!
}
}
//CNLiveVodPlayModel 专辑列表model
var _vodAlbumListBaseModel : CNLiveVodAlbumListBaseModel?
var vodAlbumListBaseModel : CNLiveVodAlbumListBaseModel? {
get{
_vodAlbumListBaseModel
}
set{
_vodAlbumListBaseModel = newValue!
}
}
//playerUrl
var _url:URL?
var url:URL? {
get{
return _url
}
set{
_url = newValue!
}
}
let kCNLiveVodIntroductionCellIdentifier = "kCNLiveVodIntroductionCellIdentifier"
let kCNLiveVodAlbumListCellIdentifier = "kCNLiveVodAlbumListCellIdentifier"
let kCNLiveVodTrailersCellIdentifier = "kCNLiveVodTrailersCellIdentifier"
let kCNLiveVodPlayShopCellIdentifier = "kCNLiveVodPlayShopCellIdentifier"
lazy var tableView : UITableView = {
let tableView = UITableView(frame: .zero, style: .plain)
tableView.dataSource = self
tableView.delegate = self
tableView.separatorStyle = .none
tableView.register(CNLiveVodIntroductionCell.self, forCellReuseIdentifier: kCNLiveVodIntroductionCellIdentifier)
tableView.register(CNLiveVodAlbumListCell.self, forCellReuseIdentifier: kCNLiveVodAlbumListCellIdentifier)
tableView.register(CNLiveVodTrailersCell.self, forCellReuseIdentifier: kCNLiveVodTrailersCellIdentifier)
tableView.register(CNLiveVodPlayShopCell.self, forCellReuseIdentifier: kCNLiveVodPlayShopCellIdentifier)
tableView.backgroundColor = .white
return tableView
}()
///数据源
lazy var dataArray: NSMutableArray = {
var dataArray = NSMutableArray()
return dataArray
}()
lazy var bottomCommentShowContainView :UIView = {
let iconImgView = UIView()
iconImgView.backgroundColor = .clear
return iconImgView
}()
lazy var bottomCommentView :UIView = {
let iconImgView = UIView(frame: CGRect(x: 0, y: KSreenHeight-60-KTabBarSafeHeight, width: KSreenWidth, height: 60))
iconImgView.backgroundColor = .white
iconImgView.isUserInteractionEnabled = true
iconImgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(bottomCommentViewTapAction)))
return iconImgView
}()
lazy var bottomCommentTalkView :UIView = {
let iconImgView = UIView()
iconImgView.layer.borderColor = HexColor("#979797")?.cgColor
iconImgView.layer.borderWidth = 0.5
iconImgView.layer.cornerRadius = 20
iconImgView.clipsToBounds = true
return iconImgView
}()
lazy var bottomCommentLabel: UILabel = {
let titleLabel = UILabel()
titleLabel.text = "我来说几句…"
titleLabel.textColor = HexColor("#999999")
titleLabel.textAlignment = .left
titleLabel.font = Font_14
return titleLabel
}()
lazy var bottomCommentImgView :UIImageView = {
let iconImgView = UIImageView()
iconImgView.image = UIImage(named: "home_player_comment")
return iconImgView
}()
lazy var whitBgView :UIView = {
let iconImgView = UIView(frame: CGRect(x: 0, y: KStatusBarHeight, width: KSreenWidth, height: KSreenHeight-KStatusBarHeight))
iconImgView.backgroundColor = .white
return iconImgView
}()
lazy var containerView :UIImageView = {
let iconImgView = UIImageView(frame: CGRect(x: 0, y: KStatusBarHeight, width: KSreenWidth, height: KSreenWidth*9/16))
iconImgView.image = UIImage.imageWithColor(color: UIColor.black, size: CGSize(width: 1, height: 1))
return iconImgView
}()
lazy var controlView :CNLiveZFPlayerControlView = {
let controlView = CNLiveZFPlayerControlView()
controlView.fastViewAnimated = true
controlView.autoHiddenTimeInterval = 5
controlView.autoFadeTimeInterval = 0.5
controlView.prepareShowLoading = true
controlView.prepareShowControlView = false
controlView.showCustomStatusBar = true
return controlView
}()
var player: ZFPlayerController!
var isAblumVideo = false
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .black
self.view.addSubview(self.whitBgView)
self.view.addSubview(self.containerView)
let backBtn = UIButton.backItem(imageName: ("mine_header_icon_white_back"), target: self, action: #selector(ClickBackBtn))
backBtn.frame = CGRect(x: 15, y: KStatusBarHeight, width: backBtn.width, height: backBtn.height)
self.view.addSubview(backBtn)
// backBtn.backgroundColor = .red
self.setupPlayer()
view.addSubview(tableView)
tableView.frame = CGRect(x: 0, y: self.containerView.bottom, width: KSreenWidth, height: KSreenHeight-self.containerView.bottom-KTabBarSafeHeight-60)
view.addSubview(self.bottomCommentView)
self.bottomCommentView.addSubview(self.bottomCommentTalkView)
bottomCommentTalkView.snp.makeConstraints { make in
make.top.left.equalToSuperview().offset(10)
make.width.equalToSuperview().offset(-75)
make.height.equalTo(40)
}
self.bottomCommentView.addSubview(self.bottomCommentLabel)
bottomCommentLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(25)
make.centerY.equalToSuperview()
make.width.equalTo(100)
make.height.equalTo(20)
}
self.bottomCommentView.addSubview(self.bottomCommentImgView)
bottomCommentImgView.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-20)
make.centerY.equalToSuperview()
make.width.equalTo(25)
make.height.equalTo(24)
}
self.view.addSubview(self.bottomCommentShowContainView)
bottomCommentShowContainView.snp.makeConstraints { make in
make.left.equalToSuperview()
make.top.equalToSuperview().offset(self.containerView.bottom)
make.width.equalToSuperview()
make.height.equalToSuperview().offset(-self.containerView.bottom)
}
bottomCommentShowContainView.isHidden = true
// self.addRefreshView()
self.configDataArray()
self.isAblumVideo = false
if let albumModel = self.vodAlbumListBaseModel{
//专辑
self.isAblumVideo = true
}else{
//单集
self.isAblumVideo = false
}
}
func configDataArray(){
//配置数据
var tempDataArray = NSMutableArray()
//单集 简介
if let vodPlayModel = self.vodPlayModel{//单集有值-简介
for (_,mdl) in vodPlayModel.blockList.enumerated(){
if mdl.type == "5"{//点播详情数据
//CNLiveVodPlayBlockListModel
tempDataArray.add(mdl)
}
}
}
//专辑-简介
if let vodAlbumListBaseModel = self.vodAlbumListBaseModel{//专辑有值-专辑列表
if let mdl = vodAlbumListBaseModel.list.first{
if let msgModel = mdl.vodAlbumMsgModel{
let tempArr = NSMutableArray(array: tempDataArray as! [Any])
if let vodMdl = tempArr.firstObject as? CNLiveVodPlayBlockListModel{
for firMdl in vodMdl.list{
firMdl.title = msgModel.albumName
firMdl.desc = msgModel.desc
}
tempDataArray.removeAllObjects()
tempDataArray.add(vodMdl)
}
}
}
}
//专辑有值-专辑列表
if let vodAlbumListBaseModel = self.vodAlbumListBaseModel{//专辑有值-专辑列表
tempDataArray.add(vodAlbumListBaseModel)
}
//看点
///**blockList.type 1/2/3/4/5 商品入口/片花资讯/活动推荐/相关推荐/点播详情 */
if let vodPlayModel = self.vodPlayModel{//单集有值-简介
for (_,mdl) in vodPlayModel.blockList.enumerated(){
if mdl.type == "2"{//看点list数据
//CNLiveVodPlayBlockListModel
tempDataArray.add(mdl)
}
}
}
//商品
if let vodPlayModel = self.vodPlayModel{//单集有值
if vodPlayModel.goodsJson.count > 0{
let goodMdls = jsonArrayToModel(vodPlayModel.goodsJson, CNLiveVodPlayShopModel.self)
if goodMdls.count > 0{//CNLiveVodPlayModel [CNLiveVodPlayShopModel]
//有商品
tempDataArray.add(goodMdls)
}else{
//没商品
}
}
}
self.dataArray = NSMutableArray(array: tempDataArray)
}
func setupNewUI(model:CNLiveDownSlideContentsModel){
}
func setupPlayer(){
let playerManager = ZFAVPlayerManager()
playerManager.shouldAutoPlay = true
// playerManager.rate = 2
player = ZFPlayerController(playerManager: playerManager, containerView: containerView)
player.pauseWhenAppResignActive = false
player.controlView = controlView
//不跟随设备旋转
player.allowOrentitaionRotation = false
// self.player.currentPlayerManager.rate = 0.5 //点击按钮加
self.player.orientationDidChanged = {[weak self] player,isFullScreen in
guard let self = self else { return }
}
/// 播放完成
self.player.playerDidToEnd = {
[weak self] asset in
guard let self = self else { return }
// if (!self.player.isLastAssetURL) {
// [self.player playTheNext];
// NSString *title = [NSString stringWithFormat:@"视频标题%zd",self.player.currentPlayIndex];
// [self.controlView showTitle:title coverURLString:kVideoCover fullScreenMode:ZFFullScreenModeLandscape];
// } else {
// [self.player stop];
// }
}
var urls = [URL]()
urls.append(self.url!)
self.player.assetURLs = urls
self.player.playTheIndex(0)
var title = ""
if self.vodPlayModel?.blockList.count ?? 0 > 0{
for mdl in self.vodPlayModel!.blockList{
if mdl.type == "5"{//详情
if mdl.list.count > 0{
let vodModel = mdl.list[0]
title = vodModel.title
}
}
}
}
self.controlView.showTitle(title, cover: UIImage.imageWithColor(color: .darkGray, size: CGSize(width: 50, height: 50)), fullScreenMode: .landscape)
}
// MARK: - UITableViewDelegate
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.dataArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let vodPlayBlockListModel = self.dataArray[indexPath.row] as? CNLiveVodPlayBlockListModel{
if vodPlayBlockListModel.type == "5"{
//点播详情
//简介-标题描述,点赞评论分享
guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveVodIntroductionCellIdentifier) as? CNLiveVodIntroductionCell
else {
let cell = CNLiveVodIntroductionCell()
return cell
}
cell.vodPlayBlockListModel = vodPlayBlockListModel
cell.updateCellBlock = {[weak self] isExpand,isFavorite,isCollection,type,vodPlayBlockListListModel in
guard let self = self else { return }
if type == "1"{
//点击了详情按钮
self.introducCellDetailBtnAction(vodPlayBlockListListModel: vodPlayBlockListListModel)
}else if type == "2"{
//点击了点赞按钮
self.vodSupport(vodPlayBlockListListModel: vodPlayBlockListListModel, isLiked: isFavorite)
}else if type == "3"{
//点击了收藏按钮
self.vodCollection(vodPlayBlockListListModel: vodPlayBlockListListModel, isCollectioned: isCollection)
}else if type == "4"{
//点击了分享按钮
self.vodShare(vodPlayBlockListListModel: vodPlayBlockListListModel)
}
}
return cell
}else if vodPlayBlockListModel.type == "2"{//看点
//看点
guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveVodTrailersCellIdentifier) as? CNLiveVodTrailersCell
else {
let cell = CNLiveVodTrailersCell()
return cell
}
cell.vodPlayBlockListModel = vodPlayBlockListModel
cell.expandBlock = { [weak self] model in
guard let self = self else { return }
self.trailersCellDetailBtnAction(vodPlayBlockListModel: model)
}
cell.selectBlock = { [weak self] model in
guard let self = self else { return }
self.contentId = model.contentId
let isAblumVideo = model.model == "1" ? false : true
self.refreshVodData(isAblumVideo: isAblumVideo)
}
return cell
}else{
}
}else if let vodAlbumListBaseModel = self.dataArray[indexPath.row] as? CNLiveVodAlbumListBaseModel{
//专辑列表
guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveVodAlbumListCellIdentifier) as? CNLiveVodAlbumListCell
else {
let cell = CNLiveVodAlbumListCell()
return cell
}
cell.vodAlbumListBaseModel = vodAlbumListBaseModel
cell.selectBlock = {[weak self] vodModel, index in
guard let self = self else { return }
self.contentId = vodModel.contentId
self.changeContentApi(vodModel: vodModel)
}
return cell
}else if let vodPlayShopModels = self.dataArray[indexPath.row] as? [CNLiveVodPlayShopModel]{
//电商
guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveVodPlayShopCellIdentifier) as? CNLiveVodPlayShopCell
else {
let cell = CNLiveVodPlayShopCell()
return cell
}
cell.vodPlayShopModels = vodPlayShopModels
cell.expandBlock = {[weak self] vodPlayShopModels in
guard let self = self else { return }
self.shopCellDetailBtnAction(vodPlayShopModels: vodPlayShopModels)
}
return cell
}else {
return UITableViewCell()
}
return UITableViewCell()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if let vodPlayBlockListModel = self.dataArray[indexPath.row] as? CNLiveVodPlayBlockListModel{
if vodPlayBlockListModel.type == "5"{
//点播详情
//简介-标题描述,点赞评论分享
return 112
}else if vodPlayBlockListModel.type == "2"{
//看点
return 25+106+76
}else{
}
}else if let vodAlbumListBaseModel = self.dataArray[indexPath.row] as? CNLiveVodAlbumListBaseModel{
//专辑列表
return 50+15
}else if let vodPlayShopModels = self.dataArray[indexPath.row] as? [CNLiveVodPlayShopModel]{
//电商
return 145.0
}else {
}
return 100
}
func addRefreshView() {
tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in
self!.refreshVodData(isAblumVideo: self!.isAblumVideo)
})
}
//更换contentId内容 play接口刷新看点和电商
func changeContentApi(vodModel:CNLiveVodAlbumListModel){
//刷新url
CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: vodModel.activityId) {[weak self] result, status in
guard let self = self else { return }
if status == .success
{
if let url = result as? String{
self.playWithUrlAndTitle(url: url, title: vodModel.title)
}
}else{
}
}
//play接口刷新 看点和电商
CNLiveDownSlideTool.getVodPlayApi(contentId: vodModel.contentId) {[weak self] result, status in
guard let self = self else { return }
if status == .success{
if let vodPlayModel = result as? CNLiveVodPlayModel{
self.vodPlayModel = vodPlayModel
self.configDataArray()
self.tableView.reloadData()
}else{
}
}else{
}
}
}
//播放url更换title
func playWithUrlAndTitle(url:String,title:String){
self.url = URL(string: url)
var urls = [URL]()
urls.append(self.url!)
self.player.assetURLs = urls
self.player.playTheIndex(0)
self.controlView.showTitle(title, cover: UIImage.imageWithColor(color: .darkGray, size: CGSize(width: 50, height: 50)), fullScreenMode: .landscape)
}
override var preferredStatusBarStyle: UIStatusBarStyle{
return .lightContent
}
override var prefersStatusBarHidden: Bool{
return false
}
override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation{
return .none
}
override var shouldAutorotate: Bool{
return false
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask{
return .allButUpsideDown
}
func shopCellDetailBtnAction(vodPlayShopModels:[CNLiveVodPlayShopModel]) {
bottomCommentShowContainView.isHidden = false
let detailBgView = CNLiveVodShopBottomView(frame: bottomCommentShowContainView.bounds)
detailBgView.backgroundColor = .white
bottomCommentShowContainView.addSubview(detailBgView)
detailBgView.vodPlayShopModels = vodPlayShopModels
detailBgView.expandHideBlock = {[weak self] in
guard let self = self else { return }
self.bottomCommentShowContainView.removeAllSubviews()
self.bottomCommentShowContainView.isHidden = true
}
}
// MARK: - 看点cell展开
func trailersCellDetailBtnAction(vodPlayBlockListModel:CNLiveVodPlayBlockListModel) {
bottomCommentShowContainView.isHidden = false
let detailBgView = CNLiveVodCellBottomView(frame: bottomCommentShowContainView.bounds)
detailBgView.backgroundColor = .white
bottomCommentShowContainView.addSubview(detailBgView)
detailBgView.vodPlayBlockListModel = vodPlayBlockListModel
detailBgView.expandHideBlock = {[weak self] in
guard let self = self else { return }
self.bottomCommentShowContainView.removeAllSubviews()
self.bottomCommentShowContainView.isHidden = true
}
detailBgView.updateBlock = {[weak self] seleIdx,model in
guard let self = self else { return }
self.contentId = model.contentId
var isAblumVideo = false
if model.model == "1"{
isAblumVideo = false
}else{
isAblumVideo = true
}
self.refreshVodData(isAblumVideo: isAblumVideo)
}
}
// MARK: - 简介cell点击事件
func introducCellDetailBtnAction(vodPlayBlockListListModel:CNLiveVodPlayBlockListListModel) {
bottomCommentShowContainView.isHidden = false
let detailBgView = UIView(frame: bottomCommentShowContainView.bounds)
detailBgView.backgroundColor = .white
bottomCommentShowContainView.addSubview(detailBgView)
let vodMdl = vodPlayBlockListListModel
let titleLbl = UILabel()
titleLbl.font = BoldFont_15
titleLbl.textColor = HexColor("#000102")
titleLbl.text = vodMdl.title
bottomCommentShowContainView.addSubview(titleLbl)
titleLbl.snp.makeConstraints { make in
make.left.equalTo(10)
make.top.equalTo(16)
make.width.lessThanOrEqualTo(KSreenWidth-50)
}
let detailLbl = UILabel()
detailLbl.font = Font_10
detailLbl.textColor = HexColor("#999999")
detailLbl.text = "详情"
bottomCommentShowContainView.addSubview(detailLbl)
detailLbl.snp.makeConstraints { make in
make.left.equalTo(titleLbl.snp.right).offset(15)
make.top.equalTo(20.5)
make.width.equalTo(20)
make.height.equalTo(14)
}
let descLbl = UITextView()
descLbl.font = Font_13
descLbl.textColor = HexColor("#999999")
descLbl.text = vodMdl.desc
descLbl.width = KSreenWidth-20
bottomCommentShowContainView.addSubview(descLbl)
descLbl.snp.makeConstraints { make in
make.left.equalTo(10)
make.top.equalTo(titleLbl.snp.bottom).offset(10)
make.right.equalToSuperview().offset(-20)
make.bottom.equalToSuperview().offset(-15-50-10)
}
let expandBtn = UIButton.init(type: .custom)
expandBtn.backgroundColor = .clear
expandBtn.setImage(UIImage(named: "home_player_unexpand"), for: .normal)
expandBtn.addTarget(self, action: #selector(expandBtnAction), for: .touchUpInside)
bottomCommentShowContainView.addSubview(expandBtn)
expandBtn.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.bottom.equalToSuperview().offset(-15)
make.width.equalTo(50)
make.height.equalTo(50)
}
}
func vodSupport(vodPlayBlockListListModel:CNLiveVodPlayBlockListListModel,isLiked:Bool){
CNLiveVodPlayViewModel.vodSupport(contentId: vodPlayBlockListListModel.pid, support: isLiked) {[weak self] result, status in
guard let self = self else { return }
if status == .success{
}
}
}
func vodCollection(vodPlayBlockListListModel:CNLiveVodPlayBlockListListModel,isCollectioned:Bool){
let type = isCollectioned ? "1" : "2"
CNLiveVodPlayViewModel.vodCollection(type: type, vodPlayBlockListListModel: vodPlayBlockListListModel) {[weak self] result, status in
guard let self = self else { return }
if status == .success{
//不改数据了
}
}
}
func vodShare(vodPlayBlockListListModel:CNLiveVodPlayBlockListListModel){
//vodPlayBlockListListModel.img
//vodPlayBlockListListModel.title
//vodPlayBlockListListModel.subTitle
//
//http://wjjh5.cnlive.com/cnYjzg.html?id=2&version=1.0.9&isShowTitle=true&plat=i&wjjFrom=apple&backgroundColor=%234B8AF5&wjjToken=ACGspwyhX6xbuJ27P0flZOejyKjcS70g7VegVKRgAWPUzacEKgXz2JcmlAVoc5oG&appId=769_li40lrkt53&channelName=yjzg&shareSid=352610&isApp=false&ver=1.0.9.24.03.27.14&sid=352610&wjjUUID=B849E3C36DF04D89B0C8DB9322B69B51_1711520943&voteId=AS5FFqIhAAAQAAAAAAAAAA==&isWjjReport=true
//https://wjjh5.cnlive.com/apkdownloadYuanma.php
CNLiveShareManager.showShareViewWithParam(forShareTitle: vodPlayBlockListListModel.title, shareUrl: "https://wjjh5.cnlive.com/apkdownloadYuanma.php", shareDesc: vodPlayBlockListListModel.desc, shareImage: vodPlayBlockListListModel.img, screenFull: false, hiddenWjj: true, hiddenQQ: false, hiddenWB: true, hiddenLifeCircle: true, hiddenWechatCircle: false, hiddenWechat: false, hiddenSafari: false, formVC: currentViewController(), topImage: [], topTitles: [], platformType: .all) { title in
} completerBlock: { resultType, platformType, typeString in
if resultType == .succ{
}
}
}
// MARK: - ButtonAction
@objc func expandBtnAction() {
//详情 收起
self.bottomCommentShowContainView.removeAllSubviews()
self.bottomCommentShowContainView.isHidden = true
}
@objc func bottomCommentViewTapAction() {
bottomCommentShowContainView.isHidden = false
//评论
CNLiveShortVideoCommentListView.showVideoCommentListView(pid: self.vodPlayModel?.contentId ?? "", contentSid: UserInfoManager.shared.userInfo.uid,containView:self.bottomCommentShowContainView, result: { commentModel in
print("\(commentModel)")
}, close: {
self.bottomCommentShowContainView.isHidden = true
})
}
@objc func ClickBackBtn() {
let viewControllers = self.navigationController?.viewControllers
if viewControllers?.count ?? 0 > 1 {
if viewControllers?.last == self {
self.navigationController!.popViewController(animated: true)
}
}
}
func destroyPlayer(){
self.player.stop()
}
func refreshVodData(isAblumVideo:Bool){
CNLiveDownSlideTool.getVodData(contentId: self.contentId, isAblumVideo: isAblumVideo) {[weak self] vodPlayModel, contentId,url, result, status in
if status == .success{
self!.vodPlayModel = vodPlayModel
self!.contentId = contentId
if let vodAlbumListBaseModel = result{
self!.vodAlbumListBaseModel = vodAlbumListBaseModel
}
self!.url = URL(string: url)
self!.configDataArray()
self!.tableView.mj_header?.endRefreshing()
self!.tableView.reloadData()
self!.playWithUrlAndTitle(url: url, title: "")
}else{
}
}
}
// MARK: - 点播play接口
/*
func requestGetVodPlayApi(contentId:String){
CNLiveHomePageViewModel.requestGetVodPlayApi(contentId: contentId, sid: UserInfoManager.shared.userInfo.uid, resultBlock: { result, status in
if status == .success{
if let vodPlayMpdel = result as? CNLiveVodPlayModel{
if let albumMdl = vodPlayMpdel.album{
//专辑
self.requestGetVodPlay1Api(contentId: vodPlayMpdel.contentId)
//记录当前播放集数的ContentId
self.contentId = vodPlayMpdel.contentId
self.requestGetAlbumMsgApi(contentId: vodPlayMpdel.contentId)
}else{
//单集
}
}
}
})
}
//专辑的单集内容
func requestGetVodPlay1Api(contentId:String){
CNLiveHomePageViewModel.requestGetVodPlayApi(contentId: contentId, sid: UserInfoManager.shared.userInfo.uid, resultBlock: { result, status in
if status == .success{
if let vodPlayMpdel = result as? CNLiveVodPlayModel{
if let albumMdl = vodPlayMpdel.album{
//专辑
}else{
//单集
}
}
}
})
}
*/
// MARK: - 专辑内容详情
// func requestGetAlbumMsgApi(contentId:String){
// CNLiveHomePageViewModel.requstWithVodAlbumMsgVideo(aid: contentId, resultBlock: { result, status in
// if status == .success{
// if let vodPlayMpdel = result as? CNLiveVodPlayModel{
// //专辑详情
// }
// }
// })
// }
deinit {
print("vod deinit")
}
}