فهرست منبع

1.视频播放到最后隐藏录制按钮

wenweiwei 3 سال پیش
والد
کامیت
3f95b354a5

+ 1 - 2
BFRecordScreenKit/Classes/BFRecordItemModel.swift

@@ -46,8 +46,7 @@ public class BFRecordItemModel: NSObject {
     func initOriginData(phasset: PHAsset) {
         width = phasset.pixelWidth
         height = phasset.pixelHeight
-        materialDuraion = phasset.duration
-
+        materialDuraion = CMTime.init(seconds: phasset.duration, preferredTimescale: 1000).seconds
         fetchCoverImage(phasset)
         fetchAVUrlAsset(phasset)
 

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

@@ -1342,6 +1342,10 @@ public class BFRecordScreenController: BFBaseViewController {
         changeWithDrawBtnLayout(0)
         isEndPlay = (progress == 1)
         recorderManager?.voiceModel = nil
+        // 视频拖动到最后隐藏录制按钮
+        if itemModels[currItemModelIndex].mediaType == .VIDEO && currentAssetProgress.seconds >= itemModels[currItemModelIndex].materialDuraion {
+            recordBtn.isHidden = true
+        }
     }
 
     // 是否吸附在录音首尾处
@@ -1653,7 +1657,7 @@ public class BFRecordScreenController: BFBaseViewController {
         }
 
         isNormalPlaying = true
-        if isEndPlay {
+        if isEndPlay || (itemModels[currItemModelIndex].mediaType == .IMAGE && currentAssetProgress.seconds >= itemModels[currItemModelIndex].materialDuraion) {
             isEndPlay = false
             assetPlayer?.seek(to: CMTime.zero)
             progressThumV.progress = 0
@@ -2149,7 +2153,7 @@ public extension BFRecordScreenController {
     func startPlayRecord(time: CMTime) {
         // 播放对应的录音音频
         if itemModels[currItemModelIndex].mediaType == .IMAGE {
-            if itemModels[currItemModelIndex].materialDuraion <= 0 || currentAssetProgress.seconds >= itemModels[currItemModelIndex].materialDuraion {
+            if itemModels[currItemModelIndex].materialDuraion <= 0 {
                 playBtn.isSelected = true
                 return
             }