wenweiwei 3 anni fa
parent
commit
dd2a74249f

+ 3 - 0
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -1972,6 +1972,9 @@ public class BFRecordScreenController: BFBaseViewController {
             }
         } else {
             currentAssetProgress = isBack ? CMTime(value: CMTimeValue(newProgress * 1000), timescale: 1000) : (progress != -1 ? CMTime(value: CMTimeValue(newProgress * Float(itemModels[currItemModelIndex].materialDuraion.seconds) * 1000), timescale: 1000) : changCMTime)
+            if currentAssetProgress.seconds > itemModels[currItemModelIndex].materialDuraion.seconds {
+                currentAssetProgress = itemModels[currItemModelIndex].materialDuraion
+            }
             DispatchQueue.main.async { [weak self] in
                 BFLog(message: "更新录音进度\(#function)- \(self?.currentAssetProgress.seconds ?? 0)")
                 self?.progreddL.text = String(format: "%@", CMTimeGetSeconds(self!.currentAssetProgress).formatDurationToHMS())

+ 4 - 4
BFRecordScreenKit/Classes/RecordScreen/View/BFVideoThumbProgressView.swift

@@ -261,14 +261,14 @@ extension BFVideoThumbProgressView: UIScrollViewDelegate {
         let totalW = recordItem?.mediaType == .VIDEO ? (scrollView.contentSize.width - width) : (CGFloat(recordItem?.materialDuraion.seconds ?? 0) * thumbImageWidth / 2.0)
         if recordItem?.mediaType == .VIDEO {
             if isDrag {
-                dragScrollProgressHandle?(false, totalW > 0 ? Float(scrollView.contentOffset.x / totalW) : 0)
+                dragScrollProgressHandle?(false, totalW > 0 ? min(Float(scrollView.contentOffset.x / totalW), 1) : 0)
             }
         } else if recordItem?.mediaType == .IMAGE {
             if isDrag {
                 if scrollView.contentOffset.x > ((CGFloat(recordItem?.materialDuraion.seconds ?? 0) * thumbImageWidth / 2.0) + 0.5) {
                     scrollView.contentOffset = CGPoint(x: (CGFloat(recordItem?.materialDuraion.seconds ?? 0) * thumbImageWidth / 2.0) + 0.5, y: 0)
                 }
-                dragScrollProgressHandle?(false, totalW > 0 ? Float(scrollView.contentOffset.x / totalW) : 0)
+                dragScrollProgressHandle?(false, totalW > 0 ? min(Float(scrollView.contentOffset.x / totalW), 1) : 0)
             }
         }
     }
@@ -277,14 +277,14 @@ extension BFVideoThumbProgressView: UIScrollViewDelegate {
         isDrag = true
         let totalW = recordItem?.mediaType == .VIDEO ? (scrollView.contentSize.width - width) : (CGFloat(recordItem?.materialDuraion.seconds ?? 0) * thumbImageWidth / 2.0)
         dragStartHandle?()
-        dragScrollProgressHandle?(true, totalW > 0 ? Float(scrollView.contentOffset.x / totalW) : 0)
+        dragScrollProgressHandle?(true, totalW > 0 ? min(Float(scrollView.contentOffset.x / totalW), 1) : 0)
     }
 
     func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
         if !decelerate {
             let totalW = recordItem?.mediaType == .VIDEO ? (scrollView.contentSize.width - width) : (CGFloat(recordItem?.materialDuraion.seconds ?? 0) * thumbImageWidth / 2.0)
             isDrag = false
-            dragEndHandle?(totalW > 0 ? Float(scrollView.contentOffset.x / totalW) : 0)
+            dragEndHandle?(totalW > 0 ? min(Float(scrollView.contentOffset.x / totalW), 1) : 0)
         }
     }