|
@@ -75,10 +75,12 @@ class MVPlayViewController: PQBaseViewController {
|
|
|
}
|
|
|
|
|
|
PQSingletoVideoPlayer.shared.playStatusBloc = { [weak self] status in
|
|
|
- if status == .PQVIDEO_PLAY_STATUS_END {
|
|
|
+ switch status {
|
|
|
+ case .PQVIDEO_PLAY_STATUS_BEGIN:
|
|
|
+ self?.isPlayEnd = false
|
|
|
+ case .PQVIDEO_PLAY_STATUS_END:
|
|
|
self?.isPlayEnd = true
|
|
|
if ((self?.currentIndex?.item ?? 0) + 1) < (self?.itemsList.count ?? 0) {
|
|
|
- // self?.collectionView.scrollToItem(at: IndexPath(item: (self?.currentIndex?.item ?? 0) + 1, section: 0), at: .top, animated: false)
|
|
|
self?.collectionView.contentOffset = CGPoint(x: 0, y: CGFloat((self?.currentIndex?.item ?? 0) + 1) * (self!.collectionView.frame.height))
|
|
|
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2) { [weak self] in
|
|
|
self?.scrollViewDidEndDecelerating(self!.collectionView)
|
|
@@ -90,8 +92,13 @@ class MVPlayViewController: PQBaseViewController {
|
|
|
if (self?.currentIndex?.item ?? 0) >= ((self?.itemsList.count ?? 0) - 2) {
|
|
|
self?.loadRequestData(isRefresh: false)
|
|
|
}
|
|
|
- } else if status == .PQVIDEO_PLAY_STATUS_BEGIN {
|
|
|
- self?.isPlayEnd = false
|
|
|
+ case .PQVIDEO_PLAY_STATUS_RECONNECT:
|
|
|
+ cShowHUB(superView: self?.view, msg: "当前网络不佳,尝试重新连接")
|
|
|
+ case .PQVIDEO_PLAY_STATUS_DISCONNECT:
|
|
|
+ cShowHUB(superView: self?.view, msg: "重新连接失败,请点击重试")
|
|
|
+ (self?.collectionView.visibleCell() as? MVPlayControlViewCell)?.pauseClick(isHidden: false, isSelected: true)
|
|
|
+ default:
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -118,9 +125,9 @@ class MVPlayViewController: PQBaseViewController {
|
|
|
/// - Returns: <#description#>
|
|
|
func loadRequestData(isRefresh: Bool = true, isAutoPlay _: Bool = false) {
|
|
|
if !isNetConnected() {
|
|
|
- cShowHUB(superView: nil, msg: "没有网络连接")
|
|
|
- collectionView.mj_footer?.endRefreshing(completionBlock: {[weak self] in
|
|
|
- self?.collectionView.setContentOffset(CGPoint.init(x: 0, y: (self?.collectionView.contentSize.height ?? 0) - (self?.collectionView.frame.height ?? 0)), animated: false)
|
|
|
+ cShowHUB(superView: view, msg: "没有网络连接")
|
|
|
+ collectionView.mj_footer?.endRefreshing(completionBlock: { [weak self] in
|
|
|
+ self?.collectionView.setContentOffset(CGPoint(x: 0, y: (self?.collectionView.contentSize.height ?? 0) - (self?.collectionView.frame.height ?? 0)), animated: false)
|
|
|
})
|
|
|
return
|
|
|
}
|
|
@@ -206,7 +213,7 @@ extension MVPlayViewController: UICollectionViewDelegate, UICollectionViewDataSo
|
|
|
}
|
|
|
currentIndex = indexPath
|
|
|
itemData.playProgress = 0
|
|
|
- cell?.pauseBtn.isSelected = false
|
|
|
+ cell?.pauseClick()
|
|
|
PQSingletoVideoPlayer.shared.configPlyer(videoData: itemData, controllerView: cell!.coverImageView, renderMode: .RENDER_MODE_FILL_EDGE)
|
|
|
PQSingletoVideoPlayer.shared.resetPlayer()
|
|
|
if (indexPath?.item ?? 0) >= itemsList.count - 2 {
|
|
@@ -222,10 +229,10 @@ extension MVPlayViewController: UICollectionViewDelegate, UICollectionViewDataSo
|
|
|
func btnClickHandle(sender: UIButton, videoData: PQVideoListModel?) {
|
|
|
switch sender.tag {
|
|
|
case 1: // 暂停/播放
|
|
|
- if sender.isSelected {
|
|
|
- PQSingletoVideoPlayer.shared.pausePlayer()
|
|
|
+ if sender.isHidden {
|
|
|
+ PQSingletoVideoPlayer.shared.startPlayr()
|
|
|
} else {
|
|
|
- PQSingletoVideoPlayer.shared.resumePlayer()
|
|
|
+ PQSingletoVideoPlayer.shared.pausePlayer()
|
|
|
}
|
|
|
case 2: // 昵称
|
|
|
|
|
@@ -235,18 +242,18 @@ extension MVPlayViewController: UICollectionViewDelegate, UICollectionViewDataSo
|
|
|
(navVc?.viewControllers.first as? MVHomeController)?.jumpToDetailVc(type: 2, videoData: videoData)
|
|
|
case 4: // 分享好友
|
|
|
if !isNetConnected() {
|
|
|
- cShowHUB(superView: nil, msg: "没有网络连接")
|
|
|
+ cShowHUB(superView: view, msg: "没有网络连接")
|
|
|
return
|
|
|
}
|
|
|
if !PQSingletoWXApiUtil.shared.isInstallWX() {
|
|
|
- cShowHUB(superView: nil, msg: "您还未安装微信客户端!")
|
|
|
+ cShowHUB(superView: view, msg: "您还未安装微信客户端!")
|
|
|
return
|
|
|
}
|
|
|
cShowHUB(superView: nil, msg: nil)
|
|
|
let shareId = getUniqueId(desc: "\(videoData?.uniqueId ?? "")shareId")
|
|
|
PQBaseViewModel.wxFriendShareInfo(videoId: (videoData?.uniqueId)!) { [weak self] imagePath, title, shareWeappRawId, msg in
|
|
|
if msg != nil {
|
|
|
- cShowHUB(superView: nil, msg: "网络不佳哦")
|
|
|
+ cShowHUB(superView: self?.view, msg: "网络不佳哦")
|
|
|
return
|
|
|
}
|
|
|
PQSingletoWXApiUtil.shared.share(type: 3, scene: Int32(WXSceneSession.rawValue), shareWeappRawId: shareWeappRawId, title: title, description: title, imageUrl: imagePath, path: videoData?.videoPath, videoId: (videoData?.uniqueId)!, pageSource: videoData?.pageSource ?? .sp_category, shareId: shareId).wxApiUtilHander = { _, _ in
|
|
@@ -259,11 +266,11 @@ extension MVPlayViewController: UICollectionViewDelegate, UICollectionViewDataSo
|
|
|
reportUpload(isFriend: true, openId: "", shareId: shareId, videoData: videoData)
|
|
|
case 5: // 分享朋友圈
|
|
|
if !isNetConnected() {
|
|
|
- cShowHUB(superView: nil, msg: "没有网络连接")
|
|
|
+ cShowHUB(superView: view, msg: "没有网络连接")
|
|
|
return
|
|
|
}
|
|
|
if !PQSingletoWXApiUtil.shared.isInstallWX() {
|
|
|
- cShowHUB(superView: nil, msg: "您还未安装微信客户端!")
|
|
|
+ cShowHUB(superView: view, msg: "您还未安装微信客户端!")
|
|
|
return
|
|
|
}
|
|
|
let shareId = getUniqueId(desc: "\(videoData?.uniqueId ?? "")shareId")
|
|
@@ -275,7 +282,7 @@ extension MVPlayViewController: UICollectionViewDelegate, UICollectionViewDataSo
|
|
|
self?.currentVideoData = videoData
|
|
|
}
|
|
|
} else {
|
|
|
- cShowHUB(superView: nil, msg: "网络不佳哦")
|
|
|
+ cShowHUB(superView: self?.view, msg: "没有网络连接")
|
|
|
}
|
|
|
}
|
|
|
// 分享朋友圈上报
|
|
@@ -324,7 +331,7 @@ extension MVPlayViewController: UICollectionViewDelegate, UICollectionViewDataSo
|
|
|
BFLog(message: "进入到后台")
|
|
|
let navVc: UINavigationController? = (UIApplication.shared.keyWindow?.rootViewController) as? UINavigationController
|
|
|
if navVc?.visibleViewController is MVPlayViewController {
|
|
|
- (collectionView.visibleCell() as? MVPlayControlViewCell)?.pauseBtn.isSelected = true
|
|
|
+ (collectionView.visibleCell() as? MVPlayControlViewCell)?.pauseClick(isHidden: false)
|
|
|
PQSingletoVideoPlayer.shared.stopPlayer(isRemove: false)
|
|
|
}
|
|
|
}
|
|
@@ -333,7 +340,7 @@ extension MVPlayViewController: UICollectionViewDelegate, UICollectionViewDataSo
|
|
|
BFLog(message: "进入到前台")
|
|
|
let navVc: UINavigationController? = (UIApplication.shared.keyWindow?.rootViewController) as? UINavigationController
|
|
|
if navVc?.visibleViewController is MVPlayViewController {
|
|
|
- self.scrollViewDidEndDecelerating(collectionView)
|
|
|
+ scrollViewDidEndDecelerating(collectionView)
|
|
|
}
|
|
|
}
|
|
|
|