|
@@ -77,9 +77,9 @@ class MVHomeController: MVBaseController {
|
|
var mVideos: Array = Array<MVHotVideoModel>.init()
|
|
var mVideos: Array = Array<MVHotVideoModel>.init()
|
|
|
|
|
|
var mAllVideos: Array = Array<PQVideoListModel>.init()
|
|
var mAllVideos: Array = Array<PQVideoListModel>.init()
|
|
- var lastBnnerSelectIndex: IndexPath = IndexPath.init(row: 0, section: 0)
|
|
|
|
- //是否点击的再创作
|
|
|
|
- var isCreateVideo:Bool = false
|
|
|
|
|
|
+ var lastBnnerSelectIndex: IndexPath = IndexPath(row: 0, section: 0)
|
|
|
|
+ // 是否点击的再创作
|
|
|
|
+ var isCreateVideo: Bool = false
|
|
deinit {
|
|
deinit {
|
|
PQNotification.removeObserver(self)
|
|
PQNotification.removeObserver(self)
|
|
}
|
|
}
|
|
@@ -124,7 +124,7 @@ class MVHomeController: MVBaseController {
|
|
BFLog(message: " self?.mAllVideos count is \(String(describing: self?.mAllVideos.count))")
|
|
BFLog(message: " self?.mAllVideos count is \(String(describing: self?.mAllVideos.count))")
|
|
}
|
|
}
|
|
self?.viewListView.reloadData()
|
|
self?.viewListView.reloadData()
|
|
- //自动播放第一个视频 确保 reloaddata 完成
|
|
|
|
|
|
+ // 自动播放第一个视频 确保 reloaddata 完成
|
|
self?.playVideo(page: 0)
|
|
self?.playVideo(page: 0)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -303,7 +303,7 @@ class MVHomeController: MVBaseController {
|
|
|
|
|
|
// 再创作视频
|
|
// 再创作视频
|
|
func createVideo(indexPath: IndexPath) {
|
|
func createVideo(indexPath: IndexPath) {
|
|
- if(enableLogin() && mAllVideos.count > indexPath.row){
|
|
|
|
|
|
+ if enableLogin() && mAllVideos.count > indexPath.row {
|
|
PQStuckPointViewModel.stuckPointProjectMusicInfo(projectId: mAllVideos[indexPath.row].reCreateVideoData?.projectId ?? "") { musicData, _ in
|
|
PQStuckPointViewModel.stuckPointProjectMusicInfo(projectId: mAllVideos[indexPath.row].reCreateVideoData?.projectId ?? "") { musicData, _ in
|
|
if musicData != nil {
|
|
if musicData != nil {
|
|
let vc = PQStuckPointMaterialController()
|
|
let vc = PQStuckPointMaterialController()
|
|
@@ -324,7 +324,6 @@ extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
|
|
|
|
|
|
func banner(_ banner: MVBanner, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
|
func banner(_ banner: MVBanner, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
|
let cell: MVBannerCell = banner.dequeueReusableCell(for: indexPath)
|
|
let cell: MVBannerCell = banner.dequeueReusableCell(for: indexPath)
|
|
-
|
|
|
|
cell.videoData = mAllVideos[indexPath.row]
|
|
cell.videoData = mAllVideos[indexPath.row]
|
|
cell.reCreateBtnClicHandle = { [weak self] _, _ in
|
|
cell.reCreateBtnClicHandle = { [weak self] _, _ in
|
|
BFLog(message: "点击了创同款")
|
|
BFLog(message: "点击了创同款")
|
|
@@ -357,7 +356,7 @@ extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
|
|
changePlayerStatus(indexPath: indexPath)
|
|
changePlayerStatus(indexPath: indexPath)
|
|
}
|
|
}
|
|
|
|
|
|
- func playVideo(page: Int){
|
|
|
|
|
|
+ func playVideo(page: Int) {
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
let cell: MVBannerCell? = self.viewListView.collectionView.cellForItem(at: IndexPath(row: page, section: 0)) as? MVBannerCell
|
|
let cell: MVBannerCell? = self.viewListView.collectionView.cellForItem(at: IndexPath(row: page, section: 0)) as? MVBannerCell
|
|
let showProtocal: String? = getUserDefaults(key: cShowProtocal) as? String
|
|
let showProtocal: String? = getUserDefaults(key: cShowProtocal) as? String
|
|
@@ -365,7 +364,7 @@ extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
|
|
cell?.pauseView.isHidden = true
|
|
cell?.pauseView.isHidden = true
|
|
let videoInfo = self.mAllVideos[page]
|
|
let videoInfo = self.mAllVideos[page]
|
|
videoInfo.playProgress = 0
|
|
videoInfo.playProgress = 0
|
|
- PQSingletoVideoPlayer.shared.configPlyer(videoData:videoInfo, controllerView: cell!.converView)
|
|
|
|
|
|
+ PQSingletoVideoPlayer.shared.configPlyer(videoData: videoInfo, controllerView: cell!.converView)
|
|
|
|
|
|
let hotVideoIndex = self.mVideos.firstIndex(where: { (items) -> Bool in
|
|
let hotVideoIndex = self.mVideos.firstIndex(where: { (items) -> Bool in
|
|
items.categoryName == videoInfo.categoryName
|
|
items.categoryName == videoInfo.categoryName
|
|
@@ -387,7 +386,6 @@ extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
|
|
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))")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func pageControl(currentPage page: Int) {
|
|
func pageControl(currentPage page: Int) {
|
|
@@ -440,6 +438,5 @@ extension MVHomeController: UICollectionViewDelegate, UICollectionViewDataSource
|
|
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
|
|
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
|
|
self.playVideo(page: videosCount)
|
|
self.playVideo(page: videosCount)
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|