Commit 465f5a8c4850ff6a1e5642761d86980123af0b6f

Authored by 张旭
1 parent 723299d8

修复首次进入专辑时播放视频和选中的集数偶尔不一致的问题

修复每次播放专辑视频会播放上次播放的下一集的问题
优化切换看点或剧集时展示对应视频的标题和简介
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
... ... @@ -413,22 +413,22 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
413 413 }
414 414 }
415 415 //专辑-简介
416   - if let vodAlbumListBaseModel = self.vodAlbumListBaseModel{//专辑有值-专辑列表
417   - if let mdl = vodAlbumListBaseModel.list.first{
418   - if let msgModel = mdl.vodAlbumMsgModel{
419   - let tempArr = NSMutableArray(array: tempDataArray as! [Any])
420   - if let vodMdl = tempArr.firstObject as? CNLiveVodPlayBlockListModel{
421   - for firMdl in vodMdl.list{
422   - firMdl.title = msgModel.albumName
423   - firMdl.desc = msgModel.desc
424   - }
425   - tempDataArray.removeAllObjects()
426   - tempDataArray.add(vodMdl)
427   - }
428   -
429   - }
430   - }
431   - }
  416 +// if let vodAlbumListBaseModel = self.vodAlbumListBaseModel{//专辑有值-专辑列表
  417 +// if let mdl = vodAlbumListBaseModel.list.first{
  418 +// if let msgModel = mdl.vodAlbumMsgModel{
  419 +// let tempArr = NSMutableArray(array: tempDataArray as! [Any])
  420 +// if let vodMdl = tempArr.firstObject as? CNLiveVodPlayBlockListModel{
  421 +// for firMdl in vodMdl.list{
  422 +// firMdl.title = msgModel.albumName
  423 +// firMdl.desc = msgModel.desc
  424 +// }
  425 +// tempDataArray.removeAllObjects()
  426 +// tempDataArray.add(vodMdl)
  427 +// }
  428 +//
  429 +// }
  430 +// }
  431 +// }
432 432 //专辑有值-专辑列表
433 433 if let vodAlbumListBaseModel = self.vodAlbumListBaseModel{//专辑有值-专辑列表
434 434 tempDataArray.add(vodAlbumListBaseModel)
... ... @@ -1252,6 +1252,8 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1252 1252 }
1253 1253 }
1254 1254  
  1255 + var vodTitle = ""
  1256 +
1255 1257 for(index,vodModel) in tempVodPlayModel.blockList.enumerated(){
1256 1258 if self.isPlayAblumOrKandian{
1257 1259 //切换剧集时, 调用play接口, 更新片花列表和商品列表
... ... @@ -1273,6 +1275,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1273 1275 if temp5Mdl != nil{
1274 1276 if vodModel.type == "5"{
1275 1277 tempVodPlayModel.blockList[index] = temp5Mdl!
  1278 + vodTitle = temp5Mdl!.list.first?.title ?? title
1276 1279 }
1277 1280 }
1278 1281 }
... ... @@ -1293,11 +1296,12 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1293 1296 if self.contentId == contentId{
1294 1297 self.player.contentId = contentId
1295 1298 self.player.activityId = activityId
1296   - self.player.title = title
  1299 + self.player.title = vodTitle
1297 1300 self.player.url = url
1298 1301  
1299   - self.playWithUrlAndTitle(url: url, title: title)
  1302 + self.playWithUrlAndTitle(url: url, title: vodTitle)
1300 1303 self.url = URL(string: url)
  1304 +
1301 1305 }else{
1302 1306 print("2222222:vodPlayMdlCId:\(self.vodPlayModel?.cid),vodPlayMdlContentId:\(self.vodPlayModel?.contentId),currentPlayIsNeedPay:\(self.currentPlayIsNeedPay)")
1303 1307 if self.currentPlayIsNeedPay{
... ... @@ -1315,7 +1319,19 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1315 1319 }
1316 1320 }
1317 1321 }
1318   -
  1322 +
  1323 + if self.isPlayAblumOrKandian{
  1324 + //如果是专辑,更新albumIndex
  1325 + for (idx,mdl) in self.albumListArr.enumerated(){
  1326 + if let model = mdl as? CNLiveVodAlbumListModel{
  1327 + if vodPlayModel.contentId == model.contentId || vodPlayModel.contentId == model.activityId{
  1328 + self.albumIndex = idx
  1329 + break
  1330 + }
  1331 + }
  1332 + }
  1333 + }
  1334 +
1319 1335 self.configDataArray()
1320 1336 self.tableView.reloadData()
1321 1337 }else{
... ...
metaCode/Classes/Main/HuBiLieHomePage/Util/CNLiveDownSlideTool.swift
... ... @@ -302,7 +302,8 @@ class CNLiveDownSlideTool:NSObject{
302 302 var currVodModel:CNLiveVodAlbumListModel?
303 303 for (idx,albumListModel) in albumListBaseModel.list.enumerated(){
304 304 albumListModel.vodAlbumMsgModel = vodModel
305   - if idx == vodModel.episodeLast{
  305 + let toIndex = vodModel.episodeLast-1 <= 0 ? 0 : vodModel.episodeLast-1
  306 + if idx == toIndex{
306 307 currVodModel =
307 308 albumListModel}
308 309 }
... ... @@ -388,7 +389,8 @@ CNLiveDownSlideTool.getVodAlbumMsgApi(contentId: albumId){ result, status in
388 389 var currVodModel:CNLiveVodAlbumListModel?
389 390 for (idx,albumListModel) in albumListBaseModel.list.enumerated(){
390 391 albumListModel.vodAlbumMsgModel = vodModel
391   - if idx == vodModel.episodeLast{
  392 + let toIndex = vodModel.episodeLast-1 <= 0 ? 0 : vodModel.episodeLast-1
  393 + if idx == toIndex{
392 394 currVodModel =
393 395 albumListModel
394 396 }
... ... @@ -463,7 +465,8 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in
463 465 var currVodModel:CNLiveVodAlbumListModel?
464 466 for (idx,albumListModel) in albumListBaseModel.list.enumerated(){
465 467 albumListModel.vodAlbumMsgModel = vodModel
466   - if idx == vodModel.episodeLast{
  468 + let toIndex = vodModel.episodeLast-1 <= 0 ? 0 : vodModel.episodeLast-1
  469 + if idx == toIndex{
467 470 currVodModel =
468 471 albumListModel }
469 472 }
... ...