Commit d797f5297f03c848a02d55cf0d843948a70681a7

Authored by “张旭”
1 parent 664d0a90

取消跳转到指定集数的动画

metaCode/Classes/Main/VideoPage/Controller/CNLiveShortVideoViewController.swift
@@ -227,11 +227,6 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele @@ -227,11 +227,6 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
227 } 227 }
228 228
229 super.init(nibName:nil, bundle:nil) 229 super.init(nibName:nil, bundle:nil)
230 - var page = (self.roundUpToNearestTen(currentIndex))/10  
231 - if page == 0 {  
232 - page = 1  
233 - }  
234 - self.pageNum = page  
235 self.slideModel = slideModel 230 self.slideModel = slideModel
236 } 231 }
237 232
@@ -249,7 +244,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele @@ -249,7 +244,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
249 244
250 }else{ 245 }else{
251 DispatchQueue.main.asyncAfter(deadline: .now() + 1) { 246 DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
252 - self.player.scrollView?.setContentOffset(CGPoint(x: 0, y:CGFloat(self.currentIndex!)*KSreenHeight), animated: true)//校正偏移量 247 + self.player.scrollView?.setContentOffset(CGPoint(x: 0, y:CGFloat(self.currentIndex!)*KSreenHeight), animated: false)//校正偏移量
253 } 248 }
254 } 249 }
255 } 250 }
@@ -309,18 +304,21 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele @@ -309,18 +304,21 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
309 player.playerReadyToPlay = {[weak self] asset, assetURL in 304 player.playerReadyToPlay = {[weak self] asset, assetURL in
310 guard let self = self else { return } 305 guard let self = self else { return }
311 self.controlView.videoPlayer((self.player)!, currentTime: self.player.currentTime, totalTime: self.player.totalTime) 306 self.controlView.videoPlayer((self.player)!, currentTime: self.player.currentTime, totalTime: self.player.totalTime)
  307 +
312 let index = self.dataURLArray.index(of: assetURL.absoluteString) 308 let index = self.dataURLArray.index(of: assetURL.absoluteString)
313 - if let homeModel = self.dataArray[index] as? CNLiveAlbumListModel{  
314 - self.currentIndex = index  
315 - if homeModel.product?.check == false {  
316 - if homeModel.product?.productType == "4" {  
317 - //这里表示可以进行试听  
318 - } else {  
319 - (self.player)!.stopCurrentPlayingCell() 309 + if index < 10000{//防止出现取不到值,为int最大值情况
  310 + if let homeModel = self.dataArray[index] as? CNLiveAlbumListModel{
  311 + self.currentIndex = index
  312 + if homeModel.product?.check == false {
  313 + if homeModel.product?.productType == "4" {
  314 + //这里表示可以进行试听
  315 + } else {
  316 + (self.player)!.stopCurrentPlayingCell()
  317 + }
320 } 318 }
  319 + }else{
  320 +
321 } 321 }
322 - }else{  
323 -  
324 } 322 }
325 } 323 }
326 // 更新另一个控制层的时间 324 // 更新另一个控制层的时间
@@ -353,7 +351,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele @@ -353,7 +351,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
353 } 351 }
354 352
355 let indexPath = IndexPath(row: self.currentIndex, section: 0) 353 let indexPath = IndexPath(row: self.currentIndex, section: 0)
356 - self.player.scrollView?.setContentOffset(CGPoint(x: 0, y:CGFloat(self.currentIndex)*KSreenHeight), animated: true)//校正偏移量 354 + self.player.scrollView?.setContentOffset(CGPoint(x: 0, y:CGFloat(self.currentIndex)*KSreenHeight), animated: false)//校正偏移量
357 self.playVideo(at: indexPath as IndexPath) 355 self.playVideo(at: indexPath as IndexPath)
358 //开始播放调用recordApi/end 356 //开始播放调用recordApi/end
359 let data: CNLiveAlbumListModel = dataArray[indexPath.row] as! CNLiveAlbumListModel 357 let data: CNLiveAlbumListModel = dataArray[indexPath.row] as! CNLiveAlbumListModel
@@ -461,7 +459,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele @@ -461,7 +459,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
461 self.tableView.refreshControl?.endRefreshing() 459 self.tableView.refreshControl?.endRefreshing()
462 self.tableView.reloadData() 460 self.tableView.reloadData()
463 DispatchQueue.main.asyncAfter(deadline: .now() + 1) { 461 DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
464 - self.player.scrollView?.setContentOffset(CGPoint(x: 0, y:CGFloat(self.currentIndex!)*KSreenHeight), animated: true)//校正偏移量 462 + self.player.scrollView?.setContentOffset(CGPoint(x: 0, y:CGFloat(self.currentIndex!)*KSreenHeight), animated: false)//校正偏移量
465 } 463 }
466 } 464 }
467 } 465 }
@@ -693,7 +691,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele @@ -693,7 +691,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
693 let indexPath = IndexPath(row: index, section: 0) 691 let indexPath = IndexPath(row: index, section: 0)
694 tableView.scrollToRow(at: indexPath, at: .none, animated: false) 692 tableView.scrollToRow(at: indexPath, at: .none, animated: false)
695 DispatchQueue.main.asyncAfter(deadline: .now() + 1) { 693 DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
696 - self.player.scrollView?.setContentOffset(CGPoint(x: 0, y:CGFloat(index)*KSreenHeight), animated: true)//校正偏移量 694 + self.player.scrollView?.setContentOffset(CGPoint(x: 0, y:CGFloat(index)*KSreenHeight), animated: false)//校正偏移量
697 self.playVideo(at: IndexPath(row: index, section: 0)) 695 self.playVideo(at: IndexPath(row: index, section: 0))
698 } 696 }
699 697