|
@@ -92,7 +92,6 @@ class MVHomeController: MVBaseController {
|
|
|
jumpToDetailVc(type: 2, videoData: videoListModel)
|
|
|
} else {
|
|
|
jumpToDetailVc(type: 3)
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -103,7 +102,13 @@ class MVHomeController: MVBaseController {
|
|
|
|
|
|
@objc func willEnterForeground() {
|
|
|
BFLog(message: "进入到前台")
|
|
|
- controlPlayrPasueOrResume(isPause: false)
|
|
|
+ var rootViewController = UIApplication.shared.keyWindow?.rootViewController
|
|
|
+ if rootViewController is UINavigationController {
|
|
|
+ rootViewController = (rootViewController as? UINavigationController)?.visibleViewController
|
|
|
+ }
|
|
|
+ if rootViewController is MVHomeController {
|
|
|
+ controlPlayrPasueOrResume(isPause: false)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override func viewWillAppear(_: Bool) {
|
|
@@ -165,17 +170,18 @@ class MVHomeController: MVBaseController {
|
|
|
|
|
|
addLayout()
|
|
|
|
|
|
- //网络监听有网后取一次数据
|
|
|
+ // 网络监听有网后取一次数据
|
|
|
manager?.startListening()
|
|
|
manager?.listener = { [weak self] status in
|
|
|
-
|
|
|
if status == .reachable(.wwan) || status == .reachable(.ethernetOrWiFi) {
|
|
|
BFLog(message: "来网了")
|
|
|
self?.getData()
|
|
|
+ } else {
|
|
|
+ cShowHUB(superView: nil, msg: "没有网络连接")
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //播放器进度和状态回调
|
|
|
+
|
|
|
+ // 播放器进度和状态回调
|
|
|
PQSingletoVideoPlayer.shared.progressBloc = { [weak self] loadProgress, playProgress, duration in
|
|
|
|
|
|
BFLog(message: "loadProgress \(loadProgress) playProgress\(playProgress) \(duration)")
|
|
@@ -185,15 +191,13 @@ class MVHomeController: MVBaseController {
|
|
|
}
|
|
|
PQSingletoVideoPlayer.shared.playStatusBloc = { [weak self] status in
|
|
|
|
|
|
- //播放完成 自动播放下一个
|
|
|
+ // 播放完成 自动播放下一个
|
|
|
if status == .PQVIDEO_PLAY_STATUS_END {
|
|
|
-
|
|
|
// PQSingletoVideoPlayer.shared.playVideoData!.playProgress = 0
|
|
|
// if((self?.lastBnnerSelectIndex.row ?? 0) < (self?.mAllVideos.count ?? 0)){
|
|
|
// self?.lastBnnerSelectIndex = IndexPath.init(row: (self?.lastBnnerSelectIndex.row ?? 0) + 1, section: 0)
|
|
|
// self?.playVideo(page: (self?.lastBnnerSelectIndex ?? IndexPath(row: 0, section: 0)).row)
|
|
|
// }else{BFLog(message: "已经是最后一个视频。")}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
// 添加协议
|
|
@@ -254,18 +258,17 @@ class MVHomeController: MVBaseController {
|
|
|
|
|
|
@objc func btnClick(sender: UIButton) {
|
|
|
switch sender.tag {
|
|
|
- case 1000: //个人中心
|
|
|
+ case 1000: // 个人中心
|
|
|
jumpToDetailVc(type: 1)
|
|
|
- case 2000://系统相册
|
|
|
+ case 2000: // 系统相册
|
|
|
jumpToDetailVc(type: 3)
|
|
|
- case 3000://设置
|
|
|
+ case 3000: // 设置
|
|
|
navigationController?.pushViewController(MVSettingController(), animated: true)
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// 判断是否可进入对就界面
|
|
|
/// - Parameters:
|
|
|
/// - type: 进入界面 1, 个人中心 2,再创作进入相册 PQVideoListModel 不能为空要使用音乐数据 3,直接创作进入相机
|
|
@@ -306,15 +309,14 @@ class MVHomeController: MVBaseController {
|
|
|
if BFLoginUserInfo.shared.phoneNumber.count <= 0 || BFLoginUserInfo.shared.phoneNumber == "<null>" {
|
|
|
let remindView = PQBandingPhoneRemindView(frame: CGRect(x: 0, y: 0, width: cScreenWidth, height: cScreenHeigth))
|
|
|
remindView.tag = cBandinPhoneTag
|
|
|
- remindView.bandingPhoneRemindHandle = { [weak self] sender in
|
|
|
- if sender.tag == 2 {
|
|
|
- addNotification(self!, selector: #selector(self?.loginSuccesss), name: cBandingPhoneSuccessKey, object: nil)
|
|
|
- self?.navigationController?.pushViewController(PQBandingPhoneController(), animated: true)
|
|
|
- }
|
|
|
+ remindView.bandingPhoneRemindHandle = { [weak self] _ in
|
|
|
+// if sender.tag == 2 {
|
|
|
+// addNotification(self!, selector: #selector(self?.loginSuccesss), name: cBandingPhoneSuccessKey, object: nil)
|
|
|
+// self?.navigationController?.pushViewController(PQBandingPhoneController(), animated: true)
|
|
|
+// }
|
|
|
}
|
|
|
remindView.remindBlock = { [weak self] _, webUrl in
|
|
|
let detail = PQBaseWebViewController()
|
|
|
-
|
|
|
detail.baseUrl = webUrl
|
|
|
self?.navigationController?.pushViewController(detail, animated: true)
|
|
|
}
|
|
@@ -322,63 +324,58 @@ class MVHomeController: MVBaseController {
|
|
|
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- //条件都满足转换到对就界面
|
|
|
+
|
|
|
+ // 条件都满足转换到对就界面
|
|
|
switch type {
|
|
|
case 1:
|
|
|
navigationController?.pushViewController(MVMineController(), animated: true)
|
|
|
- break
|
|
|
case 2:
|
|
|
|
|
|
- PQStuckPointViewModel.stuckPointProjectMusicInfo(projectId: videoData?.reCreateVideoData?.projectId ?? "") { musicData, _ in
|
|
|
+ PQStuckPointViewModel.stuckPointProjectMusicInfo(projectId: videoData?.reCreateVideoData?.projectId ?? "") { [weak self] musicData, _ in
|
|
|
if musicData != nil {
|
|
|
+ // 关闭视频播放
|
|
|
+ self?.controlPlayrPasueOrResume(isPause: true)
|
|
|
let vc = PQStuckPointMaterialController()
|
|
|
vc.reCreateMusicData = musicData
|
|
|
- self.navigationController?.pushViewController(vc, animated: true)
|
|
|
- }else{BFLog(message: "musicData is ni")}
|
|
|
+ self?.navigationController?.pushViewController(vc, animated: true)
|
|
|
+ } else { BFLog(message: "musicData is ni") }
|
|
|
}
|
|
|
-
|
|
|
- break
|
|
|
+
|
|
|
case 3:
|
|
|
// 关闭视频播放
|
|
|
controlPlayrPasueOrResume(isPause: true)
|
|
|
let nav = UINavigationController(rootViewController: PQStuckPointMaterialController())
|
|
|
nav.modalPresentationStyle = .overFullScreen
|
|
|
present(nav, animated: true, completion: nil)
|
|
|
-
|
|
|
- break
|
|
|
-
|
|
|
- default:
|
|
|
+
|
|
|
+ default:
|
|
|
break
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// 再创作视频
|
|
|
func createVideo(indexPath: IndexPath) {
|
|
|
-
|
|
|
- if(mAllVideos.count > indexPath.row){
|
|
|
+ if mAllVideos.count > indexPath.row {
|
|
|
isCreateVideo = true
|
|
|
let videoListModel = mAllVideos[indexPath.row]
|
|
|
jumpToDetailVc(type: 2, videoData: videoListModel)
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
BFLog(message: "数据出错越界!!! mAllVideos.count: \(mAllVideos.count) indexPath.row: \(indexPath.row)")
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- //这里是不是 不用了?
|
|
|
+ // 卡点模块消失
|
|
|
@objc func stuckPointDismiss() {
|
|
|
controlPlayrPasueOrResume(isPause: false)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// MARK: - 播放器操作相关方法
|
|
|
-extension MVHomeController{
|
|
|
+
|
|
|
+extension MVHomeController {
|
|
|
/// 播放指定位置的视频
|
|
|
/// - Parameter page: 视频数据位置
|
|
|
- func playVideo(page: Int){
|
|
|
-
|
|
|
+ func playVideo(page: Int) {
|
|
|
DispatchQueue.main.async {
|
|
|
let cell: MVBannerCell? = self.viewListView.collectionView.cellForItem(at: IndexPath(row: page, section: 0)) as? MVBannerCell
|
|
|
let showProtocal: String? = getUserDefaults(key: cShowProtocal) as? String
|
|
@@ -422,6 +419,7 @@ extension MVHomeController{
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// MARK: - 视频列表相关代理
|
|
|
|
|
|
extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
|
|
@@ -449,7 +447,6 @@ extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
|
|
|
controlPlayrPasueOrResume(isPause: PQSingletoVideoPlayer.shared.isPlaying)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
func pageControl(currentPage page: Int) {
|
|
|
BFLog(message: "page is \(page)")
|
|
|
playVideo(page: page)
|