|
@@ -119,7 +119,12 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
}
|
|
}
|
|
sself.itemModels[sself.currItemModelIndex].voiceStickers.append(model)
|
|
sself.itemModels[sself.currItemModelIndex].voiceStickers.append(model)
|
|
if sself.itemModels[sself.currItemModelIndex].mediaType == .IMAGE {
|
|
if sself.itemModels[sself.currItemModelIndex].mediaType == .IMAGE {
|
|
- sself.itemModels[sself.currItemModelIndex].materialDuraion = sself.itemModels[sself.currItemModelIndex].materialDuraion + (Double(model.duration ?? "0") ?? 0)
|
|
|
|
|
|
+ var duration: Double = 0
|
|
|
|
+ sself.itemModels[sself.currItemModelIndex].voiceStickers.forEach { item in
|
|
|
|
+ duration = duration + (Double(model.duration ?? "0") ?? 0)
|
|
|
|
+ }
|
|
|
|
+ sself.itemModels[sself.currItemModelIndex].materialDuraion = duration
|
|
|
|
+ sself.currentAssetProgress = CMTime(seconds: duration, preferredTimescale: 1000)
|
|
}
|
|
}
|
|
sself.drawOrUpdateRecordProgessLable()
|
|
sself.drawOrUpdateRecordProgessLable()
|
|
|
|
|
|
@@ -934,7 +939,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- BFLog(1, message: "当前时间:\(CMTimeGetSeconds(currentT)), 找到的音频:\(recordedAudio.startTime), \(recordedAudio.endTime)")
|
|
|
|
|
|
+ BFLog(1, message: "当前时间:\(CMTimeGetSeconds(currentT)), 找到的音频:\(recordedAudio.startTime), \(recordedAudio.endTime),, \(recordedAudio.wavFilePath)")
|
|
|
|
|
|
// 创建播放器
|
|
// 创建播放器
|
|
if recordPlayer == nil || (recordPlayer?.currentItem?.asset as? AVURLAsset)?.url.lastPathComponent != (recordedAudio.wavFilePath as NSString).lastPathComponent {
|
|
if recordPlayer == nil || (recordPlayer?.currentItem?.asset as? AVURLAsset)?.url.lastPathComponent != (recordedAudio.wavFilePath as NSString).lastPathComponent {
|
|
@@ -1185,6 +1190,9 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
} else {
|
|
} else {
|
|
if itemModels[currItemModelIndex].materialDuraion > 0 {
|
|
if itemModels[currItemModelIndex].materialDuraion > 0 {
|
|
currentAssetProgress = CMTime(value: CMTimeValue(progress * Float(itemModels[currItemModelIndex].materialDuraion) * 1000), timescale: 1000)
|
|
currentAssetProgress = CMTime(value: CMTimeValue(progress * Float(itemModels[currItemModelIndex].materialDuraion) * 1000), timescale: 1000)
|
|
|
|
+ DispatchQueue.main.async { [weak self] in
|
|
|
|
+ self?.progreddL.text = String(format: "%@", CMTimeGetSeconds(self!.currentAssetProgress).formatDurationToHMS())
|
|
|
|
+ }
|
|
BFLog(message: "progress = \(progress),currentAssetProgress = \(currentAssetProgress)")
|
|
BFLog(message: "progress = \(progress),currentAssetProgress = \(currentAssetProgress)")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1369,11 +1377,10 @@ public extension BFRecordScreenController {
|
|
func imageRecordProgress(progress: Float64) {
|
|
func imageRecordProgress(progress: Float64) {
|
|
BFLog(message: "图片录音进度:\(progress)")
|
|
BFLog(message: "图片录音进度:\(progress)")
|
|
if itemModels[currItemModelIndex].mediaType == .IMAGE {
|
|
if itemModels[currItemModelIndex].mediaType == .IMAGE {
|
|
- currentAssetProgress = CMTime(seconds: progress, preferredTimescale: 1000)
|
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
DispatchQueue.main.async { [weak self] in
|
|
- self?.progreddL.text = String(format: "%@", progress.formatDurationToHMS())
|
|
|
|
- self?.progressThumV.progress = progress
|
|
|
|
- self?.updateSubtitle(time: CMTime(value: CMTimeValue(progress), timescale: 1))
|
|
|
|
|
|
+ self?.progreddL.text = String(format: "%@", (progress + (self?.currentAssetProgress.seconds ?? 0)).formatDurationToHMS())
|
|
|
|
+ self?.progressThumV.progress = (progress + (self?.currentAssetProgress.seconds ?? 0))
|
|
|
|
+ self?.updateSubtitle(time: CMTime(value: CMTimeValue((progress + (self?.currentAssetProgress.seconds ?? 0))), timescale: 1))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|