Parcourir la source

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

* 'master' of https://git.yishihui.com/iOS/BFRecordScreenKit:
  添加 LOG
  1.修改声音

# Conflicts:
#	BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift
harry il y a 3 ans
Parent
commit
2c122d0734

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

@@ -508,7 +508,8 @@ public class BFRecordScreenController: BFBaseViewController {
                 newSubtitle.text = showText
                 newSubtitle.audioFilePath = audioFilePath ?? ""
 
-                BFLog(1, message: "添加字幕数据 timelineIn \(newSubtitle.timelineIn) timelineOut \(newSubtitle.timelineOut) text: \(newSubtitle.text) 音频路径为:\(audioFilePath ?? "")")
+                BFLog(message: "添加字幕数据 timelineIn \(newSubtitle.timelineIn) timelineOut \(newSubtitle.timelineOut) text: \(newSubtitle.text) 音频路径为:\(audioFilePath ?? "") 传入的地址:\(self?.recorderManager?.voiceModel?.wavFilePath ?? "aa")")
+                
                 newSubtitle.setting = self?.subtitleSettingView.subtitle.setting ?? BFSubTitileSettingModel()
 
                 self?.itemModels[self?.currItemModelIndex ?? 0].titleStickers.append(newSubtitle)
@@ -1075,7 +1076,7 @@ public class BFRecordScreenController: BFBaseViewController {
     /// 不足一秒,主动取消录制
     /// - Parameter voiceModel: <#voiceModel description#>
     @objc func recordManagerCancelRecord(voiceModel: PQVoiceModel?) {
-        if currentAssetProgress.seconds - (recorderManager?.voiceModel?.startCMTime.seconds ?? 0) < 1.0 {
+        if voiceModel != nil && (currentAssetProgress.seconds - (recorderManager?.voiceModel?.startCMTime.seconds ?? 0) < 1.0) {
             cShowHUB(superView: nil, msg: "最短录制1秒")
         }
         // 删除文件
@@ -1388,6 +1389,7 @@ public class BFRecordScreenController: BFBaseViewController {
         } ?? (-1, nil)
 
         guard let recordedAudio = recordedAudio, recordedAudio.wavFilePath.count > 0 else {
+            BFLog(3, message: "未找到可播放录音")
             return
         }
         BFLog(1, message: "当前时间:\(CMTimeGetSeconds(currentT)), 找到的音频:\(recordedAudio.startCMTime.seconds) ~ \(recordedAudio.endCMTime.seconds), \(recordedAudio.wavFilePath ?? "")")
@@ -1540,7 +1542,6 @@ public class BFRecordScreenController: BFBaseViewController {
             currentAssetProgress = CMTime.zero
         }
         if itemModels[currItemModelIndex].mediaType == .VIDEO {
-            assetPlayer?.volume = noSpeakVolume
             if !movieIsProcessing {
                 movie?.startProcessing()
                 movieIsProcessing = true
@@ -1574,11 +1575,8 @@ public class BFRecordScreenController: BFBaseViewController {
         recordPlayer?.pause()
         recordStartPlayTime = CMTime.zero
         pauseTime = currentAssetProgress.seconds
-
-        //
-//        assetPlayer?.seek(to: currentAssetProgress, toleranceBefore: CMTime(value: 1, timescale: 1_000_000), toleranceAfter: CMTime(value: 1, timescale: 1_000_000), completionHandler: { _ in
-//            cShowHUB(superView: nil, msg: "end seek: \(self.assetPlayer?.currentItem?.currentTime().seconds ?? 0)")
-//        })
+        currentPlayRecordIndex = -1
+        hadPrepareToPlayRecord = false
         // 暂停状态
         playBtn.isSelected = (itemModels[currItemModelIndex].mediaType == .IMAGE && itemModels[currItemModelIndex].voiceStickers.count <= 0)
     }