浏览代码

Merge branch 'master' of https://git.yishihui.com/iOS/BFRecordScreenKit

* 'master' of https://git.yishihui.com/iOS/BFRecordScreenKit:
  1.字幕点击
  1.字幕点击
harry 3 年之前
父节点
当前提交
0a860a6d8c

+ 14 - 6
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -288,13 +288,13 @@ public class BFRecordScreenController: BFBaseViewController {
     // 显示字幕
     lazy var subtitleLabel: PQSubTitleLabel = {
         let subtitleLabel = PQSubTitleLabel()
+        subtitleLabel.tag = 100100
         subtitleLabel.textAlignment = .center
         subtitleLabel.numberOfLines = 0
         subtitleLabel.lineBreakMode = .byWordWrapping
         subtitleLabel.isUserInteractionEnabled = true
         subtitleLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(editSubtitle)))
         return subtitleLabel
-
     }()
 
     // 音量设置
@@ -315,7 +315,7 @@ public class BFRecordScreenController: BFBaseViewController {
     }()
 
     lazy var progressThumV: BFVideoThumbProgressView = {
-        let vv = BFVideoThumbProgressView(frame: CGRect(x: 0, y: 54, width: cScreenWidth, height: 50))
+        let vv = BFVideoThumbProgressView(frame: CGRect(x: 0, y: 18, width: cScreenWidth, height: 50))
         vv.dragStartHandle = { [weak self] in
             self?.isDragingProgressSlder = true
             self?.pause()
@@ -633,7 +633,7 @@ public class BFRecordScreenController: BFBaseViewController {
         //        view.addSubview(playView!)
         fetchVideo()
         view.addSubview(bottomeView)
-        view.addSubview(subtitleLabel)
+//        view.addSubview(subtitleLabel)
         view.addSubview(playBtn)
         view.addSubview(avatarView)
         //        view.addSubview(openCameraBtn)
@@ -761,20 +761,20 @@ public class BFRecordScreenController: BFBaseViewController {
     func layoutsubview() {
         bottomeView.snp.makeConstraints { make in
             make.left.bottom.right.equalToSuperview()
-            make.height.equalTo(adapterWidth(width: 220))
+            make.height.equalTo(adapterWidth(width: 180))
         }
 
         progreddL.snp.makeConstraints { make in
             make.width.equalTo(100)
             make.centerX.equalToSuperview()
-            make.bottom.equalTo(progressThumV.snp.top)
+            make.top.equalToSuperview()
             make.height.equalTo(18)
         }
 
         withDrawBtn.snp.makeConstraints { make in
             make.left.equalToSuperview()
             make.width.height.equalTo(65)
-            make.top.equalTo(128)
+            make.top.equalTo(88)
         }
         //        changeVoiceBtn.snp.makeConstraints { make in
         //            make.right.equalToSuperview()
@@ -1012,6 +1012,11 @@ public class BFRecordScreenController: BFBaseViewController {
         }
         // 录制中不显示播放按钮
         playBtn.isSelected = true
+        
+        let cell = collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell
+        if cell?.contentView.viewWithTag(100100)?.superview == nil {
+            cell?.contentView.addSubview(subtitleLabel)
+        }
     }
 
     @objc func endRecord() {
@@ -1913,6 +1918,9 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
             }
 
             // add by ak 切换后刷新字幕
+            subtitleLabel.removeFromSuperview()
+            let cell = collectionView.cellForItem(at: IndexPath(item: page, section: 0)) as? BFImageCoverViewCell
+            cell?.contentView.addSubview(subtitleLabel)
             updateSubtitle(time: currentAssetProgress)
         }
     }

+ 1 - 1
BFRecordScreenKit/Classes/RecordScreen/View/BFIndirectionProgressView.swift

@@ -62,7 +62,7 @@ class BFIndirectionProgressView: UIView {
         }
 
         items?.forEach { [weak self] model in
-            _ = createItemView(minX: model.startTime * CGFloat(self?.percenWidth ?? 0), width: (model.endCMTime.seconds - model.startCMTime.seconds) * CGFloat(self?.percenWidth ?? 0))
+            _ = createItemView(minX: model.startCMTime.seconds * CGFloat(self?.percenWidth ?? 0), width: (model.endCMTime.seconds - model.startCMTime.seconds) * CGFloat(self?.percenWidth ?? 0))
         }
     }