Bläddra i källkod

Merge branch 'dev' of https://git.yishihui.com/iOS/MusicVideoPlus into dev

wenweiwei 3 år sedan
förälder
incheckning
c3cdc86ec4

BIN
MusicVideoPlus/MusicVideoPlus/Assets.xcassets/Home/home_marks.imageset/home_marks.png


BIN
MusicVideoPlus/MusicVideoPlus/Assets.xcassets/Home/home_marks.imageset/home_marks@2x.png


BIN
MusicVideoPlus/MusicVideoPlus/Assets.xcassets/Home/home_marks.imageset/home_marks@3x.png


+ 11 - 9
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Controllers/MVHomeController.swift

@@ -14,7 +14,7 @@ class MVHomeController: MVBaseController {
         let maxWidth: CGFloat = 9.0 / 16.0 * maxHeight
         let margin = (cScreenWidth - maxWidth) / 2
         let lineSpacing = margin - cDefaultMargin * 3
-        let videoListView = MVBanner(frame: .zero, margin: margin, lineSpacing: lineSpacing, minScale: MVBanner.Scale(scale: 1))
+        let videoListView = MVBanner(frame: .zero, margin: margin, lineSpacing: 15, minScale: MVBanner.Scale(scale: 1))
         videoListView.backgroundColor = UIColor.white
         videoListView.register(classCellType: MVBannerCell.self)
         return videoListView
@@ -57,7 +57,7 @@ class MVHomeController: MVBaseController {
         let flowLayout = UICollectionViewFlowLayout()
         flowLayout.sectionInset = UIEdgeInsets(top: 0, left: 11, bottom: 0, right: 11)
         flowLayout.minimumLineSpacing = 0
-        flowLayout.minimumInteritemSpacing = 10
+        flowLayout.minimumInteritemSpacing = 0
         flowLayout.scrollDirection = .horizontal
         let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 45), collectionViewLayout: flowLayout)
         collectionView.showsVerticalScrollIndicator = false
@@ -183,10 +183,9 @@ class MVHomeController: MVBaseController {
         // 播放器进度和状态回调
         PQSingletoVideoPlayer.shared.progressBloc = { [weak self] loadProgress, playProgress, duration in
 
-            BFLog(message: "loadProgress \(loadProgress) playProgress\(playProgress) \(duration)")
+            BFLog(message: "duration \(duration) playProgress\(playProgress) \(duration) 进度\(playProgress / duration)")
             let cell: MVBannerCell? = self?.viewListView.collectionView.cellForItem(at: self?.lastBnnerSelectIndex ?? IndexPath()) as? MVBannerCell
-
-            cell?.progressView.progress = playProgress / loadProgress
+            cell?.progressView.progress = playProgress / duration
         }
         PQSingletoVideoPlayer.shared.playStatusBloc = { [weak self] status in
 
@@ -366,13 +365,13 @@ class MVHomeController: MVBaseController {
 
     // 卡点模块消失
     @objc func stuckPointDismiss() {
-        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) { [weak self] in
+        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) { [weak self] in
             self?.controlPlayrPasueOrResume(isPause: false)
         }
     }
 
     /// 获取用户状态信息
-    /// - Returns: <#description#>
+    /// - Returns: description
     func getUserInfo() {
         PQMineViewModel.userStatus { _, _ in
         }
@@ -390,6 +389,7 @@ extension MVHomeController {
             let showProtocal: String? = getUserDefaults(key: cShowProtocal) as? String
             if self.mVideos.count > 0, cell != nil, showProtocal != nil, showProtocal == "1" {
                 cell?.pauseView.isHidden = true
+                cell?.progressView.progress = 0
                 let videoInfo = self.mAllVideos[page]
                 videoInfo.playProgress = 0
                 PQSingletoVideoPlayer.shared.configPlyer(videoData: videoInfo, controllerView: cell!.converView)
@@ -419,6 +419,7 @@ extension MVHomeController {
     // 控制播放器的暂停或恢复
     func controlPlayrPasueOrResume(isPause: Bool) {
         let cell: MVBannerCell? = viewListView.collectionView.cellForItem(at: lastBnnerSelectIndex) as? MVBannerCell
+        BFLog(message: " player isPause is \(isPause)")
         if isPause {
             cell?.pauseView.isHidden = false
             PQSingletoVideoPlayer.shared.pausePlayer()
@@ -427,6 +428,7 @@ extension MVHomeController {
             if rootViewController is UINavigationController {
                 rootViewController = (rootViewController as? UINavigationController)?.visibleViewController
             }
+            BFLog(message: "rootViewController is \(rootViewController)")
             if rootViewController is MVHomeController {
                 cell?.pauseView.isHidden = true
                 PQSingletoVideoPlayer.shared.resumePlayer()
@@ -485,9 +487,9 @@ extension MVHomeController: UICollectionViewDelegate, UICollectionViewDataSource
 
     func collectionView(_ collectionView: UICollectionView, layout _: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
         let itemData: MVHotVideoModel = mVideos[indexPath.item]
-        let width: CGFloat = CGFloat(CGFloat(itemData.categoryName.ga_widthForComment(font: UIFont.boldSystemFont(ofSize: 17), height: 17.0)) + 36.0 + 20.0)
+        let width: CGFloat = CGFloat(CGFloat(itemData.categoryName.ga_widthForComment(font: UIFont.boldSystemFont(ofSize: 17), height: 17.0)) + 43)
 
-        return CGSize(width: width, height: collectionView.frame.height - cDefaultMargin)
+        return CGSize(width: width, height: collectionView.frame.height - 14)
     }
 
     func collectionView(_: UICollectionView, didSelectItemAt indexPath: IndexPath) {

+ 6 - 3
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Views/Banner/MVBanner.swift

@@ -194,9 +194,12 @@ public extension MVBanner {
     }
     final func scrollToItem(at index: Int, animated: Bool) {
         let indexPath = IndexPath(item: index, section: 0)
-        self.collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: animated)
-        let page = self.realIndex(index: index)
-        self.setCurrentPage(page)
+        UIView.animate(withDuration: 0.05, animations: { [weak self] in
+            self?.collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: animated)
+            let page = self?.realIndex(index: index) ?? 0
+            self?.setCurrentPage(page)
+        })
+      
     }
 }
 

+ 1 - 1
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Views/MVBannerCell.swift

@@ -76,7 +76,7 @@ class MVBannerCell: UICollectionViewCell {
 
     /// 音乐歌曲名称
     lazy var musicNameLab: LMJHorizontalScrollText = {
-        let musicNameLab = LMJHorizontalScrollText(frame: CGRect(x: 16 + cDefaultMargin, y: 0, width: musicWidth, height: 32))
+        let musicNameLab = LMJHorizontalScrollText(frame: CGRect(x: 12 + cDefaultMargin, y: 0, width: musicWidth, height: 32))
         musicNameLab.textColor = UIColor.white
         musicNameLab.textFont = UIFont.systemFont(ofSize: 15, weight: .semibold)
         musicNameLab.speed = 0.03

+ 1 - 1
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Views/MVTagsCell.swift

@@ -75,7 +75,7 @@ class MVTagsCell: UICollectionViewCell {
         let margin: CGFloat = 10
  
         audioImageView.snp.remakeConstraints { make in
-            make.left.equalToSuperview().offset(13)
+            make.left.equalToSuperview().offset(8)
             make.centerY.equalToSuperview()
             make.width.height.equalTo(22)
         }