فهرست منبع

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

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

+ 6 - 3
BFRecordScreenKit/Classes/BFRecordExport.swift

@@ -22,6 +22,8 @@ public enum ExportError : Int {
     case DiskNoSpace    = -31006
 }
 
+let testFor = true
+
 public class BFRecordExport {
     public var progress: ((Float) -> Void)?
     public var exportCompletion: ((Error?, URL?) -> Void)?
@@ -403,9 +405,10 @@ public class BFRecordExport {
                     let exportEndTime = Date().timeIntervalSince1970
 //                    BFLog(1, message: "视频导出完成: \(String(describing: url)) 生成视频时长为:\(outSeconds) 总用时:\(exportEndTime - tempBeginExport)")
                     print("生成视频时长为:\(outSeconds) 总用时:\(exportEndTime - tempBeginExport)")
-#if ForTest
-                    cShowHUB(superView: nil, msg: (outSeconds == 0) ? "合成失败请重试。" : "合成成功,总用时:\(exportEndTime - tempBeginExport)")
-#endif
+                    if testFor {
+                        cShowHUB(superView: nil, msg: (outSeconds == 0) ? "合成失败请重试。" : "合成成功,总用时:\(exportEndTime - tempBeginExport)")
+                    }
+
                     self?.exportCompletion?(nil, url)
 
                 } else {

+ 16 - 1
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -461,13 +461,24 @@ public class BFRecordScreenController: BFBaseViewController {
                 if URL(fileURLWithPath: audioFilePath ?? "b").deletingPathExtension().lastPathComponent.contains(URL(fileURLWithPath: self?.recorderManager?.voiceModel?.wavFilePath ?? "aa").deletingPathExtension().lastPathComponent) {
                     newSubtitle.timelineIn = (self?.recorderManager?.voiceModel?.startCMTime.seconds ?? 0.0) + Float64((((payload?["begin_time"]) as? Int) ?? 0) + 300) / 1000.0
                     newSubtitle.timelineOut = (self?.recorderManager?.voiceModel?.startCMTime.seconds ?? 0.0) + Float64(((payload?["time"]) as? Int) ?? 0) / 1000.0
+                    
+                    if newSubtitle.timelineIn - 0.1 > (self?.recorderManager?.voiceModel?.endCMTime.seconds ?? 0) {
+                        BFLog(1, message: "卡在录音尾巴上了1")
+                        newSubtitle.timelineIn -= 0.1
+                    }
                 } else {
                     if let voice = self?.itemModels[self?.currItemModelIndex ?? 0].voiceStickers.first(where: { m in
                         m.wavFilePath == audioFilePath
                     }) {
                         newSubtitle.timelineIn = voice.startCMTime.seconds + Float64((((payload?["begin_time"]) as? Int) ?? 0) + 300) / 1000.0
                         newSubtitle.timelineOut = voice.startCMTime.seconds + Float64(((payload?["time"]) as? Int) ?? 0) / 1000.0
+                        
+                        if newSubtitle.timelineIn - 0.1 > (voice.endCMTime.seconds ) {
+                            BFLog(1, message: "卡在录音尾巴上了1")
+                            newSubtitle.timelineIn -= 0.1
+                        }
                     }
+                    
                 }
                 var showText = ((payload?["result"]) as? String) ?? ""
                 if showText.count > subtitleMaxlength {
@@ -682,6 +693,9 @@ public class BFRecordScreenController: BFBaseViewController {
     /// - Parameter time: 当前播放的进度
     func updateSubtitle(time: CMTime) {
         BFLog(message: "currTime is \(CMTimeGetSeconds(time))")
+        if isRecording {
+            return
+        }
         var findShowSubtitle: PQEditSubTitleModel?
         for (index, subtitle) in itemModels[currItemModelIndex].titleStickers.enumerated() {
             if subtitle.timelineIn <= CMTimeGetSeconds(time), subtitle.timelineOut >= CMTimeGetSeconds(time) {
@@ -949,7 +963,8 @@ public class BFRecordScreenController: BFBaseViewController {
         collectionView.isScrollEnabled = false
         // 开始录制时清除屏幕上的字幕
         subtitleLabel.text = ""
-
+        subtitleLabel.backgroundColor = UIColor.clear
+        
         pause()
         if recorderManager == nil {
             BFLog(message: "录音机初始化错误!!!")

+ 2 - 2
BFRecordScreenKit/Classes/RecordScreen/View/BFAudioSettingView.swift

@@ -23,7 +23,7 @@ class BFAudioSettingView: UIView {
         let haveSpeakLab = UILabel()
         haveSpeakLab.font = UIFont.boldSystemFont(ofSize: 16)
         haveSpeakLab.textAlignment = .left
-        haveSpeakLab.text = "说话时 视频音量"
+        haveSpeakLab.text = "录音时 视频原声"
         haveSpeakLab.textColor = .white
         haveSpeakLab.backgroundColor = .clear
         return haveSpeakLab
@@ -56,7 +56,7 @@ class BFAudioSettingView: UIView {
         let noSpeakLab = UILabel()
         noSpeakLab.font = UIFont.boldSystemFont(ofSize: 16)
         noSpeakLab.textAlignment = .left
-        noSpeakLab.text = "没说话时 视频音量"
+        noSpeakLab.text = "未录音时 视频原声"
         noSpeakLab.textColor = .white
         return noSpeakLab
     }()