|
@@ -147,13 +147,18 @@ class MVHomeController: MVBaseController {
|
|
super.viewWillDisappear(animated)
|
|
super.viewWillDisappear(animated)
|
|
controlPlayrPasueOrResume(isPause: true)
|
|
controlPlayrPasueOrResume(isPause: true)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ override func viewDidDisappear(_ animated: Bool) {
|
|
|
|
+ super.viewDidDisappear(animated)
|
|
|
|
+ controlPlayrPasueOrResume(isPause: true)
|
|
|
|
+ }
|
|
|
|
|
|
func getData() {
|
|
func getData() {
|
|
|
|
|
|
PQLoadingHUB.shared.showHUB(superView:view)
|
|
PQLoadingHUB.shared.showHUB(superView:view)
|
|
MVHomeViewModel.getHomeHotVideos { [weak self] hotVideos, msg in
|
|
MVHomeViewModel.getHomeHotVideos { [weak self] hotVideos, msg in
|
|
if(msg == nil){
|
|
if(msg == nil){
|
|
- BFLog(message: "hotVideos count is :\(hotVideos.count)")
|
|
|
|
|
|
+ BFLog(1, message: "hotVideos count is :\(hotVideos.count)")
|
|
PQLoadingHUB.shared.dismissHUB(superView:(self?.view)!)
|
|
PQLoadingHUB.shared.dismissHUB(superView:(self?.view)!)
|
|
self?.showNetworkError(isHidden: true)
|
|
self?.showNetworkError(isHidden: true)
|
|
self?.refreshData(hotVideos: hotVideos)
|
|
self?.refreshData(hotVideos: hotVideos)
|
|
@@ -204,7 +209,7 @@ class MVHomeController: MVBaseController {
|
|
}
|
|
}
|
|
viewListView.reloadData()
|
|
viewListView.reloadData()
|
|
// 自动播放第一个视频 确保 reloaddata 完成
|
|
// 自动播放第一个视频 确保 reloaddata 完成
|
|
- playVideo(page: 0)
|
|
|
|
|
|
+// playVideo(page: 0)
|
|
}
|
|
}
|
|
|
|
|
|
override func viewDidLoad() {
|
|
override func viewDidLoad() {
|
|
@@ -451,7 +456,7 @@ extension MVHomeController {
|
|
/// 播放指定位置的视频
|
|
/// 播放指定位置的视频
|
|
/// - Parameter page: 视频数据位置
|
|
/// - Parameter page: 视频数据位置
|
|
func playVideo(page: Int) {
|
|
func playVideo(page: Int) {
|
|
-
|
|
|
|
|
|
+ BFLog(1, message: "aa : playVideo")
|
|
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.05) {
|
|
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.05) {
|
|
if !(UIViewController.getCurrentViewController()?.isMember(of: MVHomeController.self))! {
|
|
if !(UIViewController.getCurrentViewController()?.isMember(of: MVHomeController.self))! {
|
|
BFLog(message: "当前显示的界面不是在首界面,不进行播放")
|
|
BFLog(message: "当前显示的界面不是在首界面,不进行播放")
|
|
@@ -490,7 +495,7 @@ extension MVHomeController {
|
|
|
|
|
|
|
|
|
|
self.controlPlayrPasueOrResume(isPause: false)
|
|
self.controlPlayrPasueOrResume(isPause: false)
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
} else {
|
|
} else {
|
|
BFLog(message: "播放不成功: cell:\(String(describing: cell)) mVideos:\(self.mVideos.count) showProtocal: is \(String(describing: showProtocal))")
|
|
BFLog(message: "播放不成功: cell:\(String(describing: cell)) mVideos:\(self.mVideos.count) showProtocal: is \(String(describing: showProtocal))")
|
|
@@ -515,6 +520,10 @@ extension MVHomeController {
|
|
BFLog(message: "rootViewController is \(String(describing: rootViewController))")
|
|
BFLog(message: "rootViewController is \(String(describing: rootViewController))")
|
|
if cell != nil && cell?.videoData != nil{
|
|
if cell != nil && cell?.videoData != nil{
|
|
cell?.pauseView.isHidden = true
|
|
cell?.pauseView.isHidden = true
|
|
|
|
+ if cell?.videoData?.videoId == PQSingletoVideoPlayer.shared.playVideoData?.videoId && PQSingletoVideoPlayer.shared.isPlayBegin {
|
|
|
|
+ PQSingletoVideoPlayer.shared.resumePlayer()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
PQSingletoVideoPlayer.shared.configPlyer(videoData: (cell?.videoData)!, controllerView: cell!.converView)
|
|
PQSingletoVideoPlayer.shared.configPlyer(videoData: (cell?.videoData)!, controllerView: cell!.converView)
|
|
PQSingletoVideoPlayer.shared.startPlayr()
|
|
PQSingletoVideoPlayer.shared.startPlayr()
|
|
PQSingletoVideoPlayer.shared.progressBloc = { [weak self] _, playProgress, duration in
|
|
PQSingletoVideoPlayer.shared.progressBloc = { [weak self] _, playProgress, duration in
|
|
@@ -530,10 +539,10 @@ extension MVHomeController {
|
|
PQSingletoVideoPlayer.shared.playVideoData!.playProgress = 0
|
|
PQSingletoVideoPlayer.shared.playVideoData!.playProgress = 0
|
|
if (self?.lastBnnerSelectIndex.row ?? 0) < (self?.mAllVideos.count ?? 0) - 1 {
|
|
if (self?.lastBnnerSelectIndex.row ?? 0) < (self?.mAllVideos.count ?? 0) - 1 {
|
|
self?.lastBnnerSelectIndex = IndexPath(row: (self?.lastBnnerSelectIndex.row ?? 0) + 1, section: 0)
|
|
self?.lastBnnerSelectIndex = IndexPath(row: (self?.lastBnnerSelectIndex.row ?? 0) + 1, section: 0)
|
|
- self?.playVideo(page: (self?.lastBnnerSelectIndex ?? IndexPath(row: 0, section: 0)).row)
|
|
|
|
|
|
+// self?.playVideo(page: (self?.lastBnnerSelectIndex ?? IndexPath(row: 0, section: 0)).row)
|
|
|
|
|
|
// 视频列表跳转
|
|
// 视频列表跳转
|
|
- self?.viewListView.currentIndex = (self?.lastBnnerSelectIndex ?? IndexPath(row: 0, section: 0)).row
|
|
|
|
|
|
+// self?.viewListView.currentIndex = (self?.lastBnnerSelectIndex ?? IndexPath(row: 0, section: 0)).row
|
|
self?.viewListView.scrollToItem(at: (self?.lastBnnerSelectIndex ?? IndexPath(row: 0, section: 0)).row, animated: false)
|
|
self?.viewListView.scrollToItem(at: (self?.lastBnnerSelectIndex ?? IndexPath(row: 0, section: 0)).row, animated: false)
|
|
|
|
|
|
} else {
|
|
} else {
|