|
@@ -146,6 +146,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
var touchStart: CGPoint = CGPoint(x: 0, y: 0)
|
|
|
var avplayerTimeObserver: NSKeyValueObservation?
|
|
|
|
|
|
+ var indirectionView: BFIndirectionProgressView?
|
|
|
+
|
|
|
lazy var progreddL: UILabel = {
|
|
|
let l = UILabel()
|
|
|
l.textAlignment = .center
|
|
@@ -407,7 +409,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
// add by ak 取 nsl token
|
|
|
BFRecordScreenViewModel.getNlsAccessToken {[weak self] token, appkey in
|
|
|
BFLog(message: "nls appkey is \(appkey), token is \(token)")
|
|
|
- self?.speechTranscriberUtil = PQSpeechTranscriberUtil(token, appid: appkey)
|
|
|
+// self?.speechTranscriberUtil = PQSpeechTranscriberUtil(token, appid: appkey)
|
|
|
}
|
|
|
|
|
|
view.backgroundColor = .black
|
|
@@ -762,10 +764,18 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
assetPlayer?.play()
|
|
|
// 暂停状态
|
|
|
(collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell)?.playBtn.isSelected = true
|
|
|
- } else {
|
|
|
- recorderManager.audioRecorder?.recorderProgross = { [weak self] progress in
|
|
|
+ }
|
|
|
+ recorderManager.audioRecorder?.recorderProgross = { [weak self] progress in
|
|
|
+ if self?.itemModels[self?.currItemModelIndex ?? 0].mediaType == .IMAGE {
|
|
|
self?.imageRecordProgress(isRecord: true, progress: progress)
|
|
|
}
|
|
|
+// self?.indirectionView?.setProgress(index: (self?.itemModels[self?.currItemModelIndex ?? 0].voiceStickers.count ?? 0), start: self?.currentAssetProgress.seconds ?? 0, progress: progress)
|
|
|
+ }
|
|
|
+ recorderManager.audioRecorder?.recorderStartHandle = {[weak self] in
|
|
|
+// if self?.indirectionView == nil {
|
|
|
+// self?.indirectionView = BFIndirectionProgressView.init(frame: self?.progressThumV.progessIndicateBackV.bounds ?? CGRect.zero, percenWidth: self?.itemModels[self?.currItemModelIndex ?? 0].mediaType == .IMAGE ? (self?.progressThumV.thumbImageWidth ?? 0) / 2 : 0, totalDuration: self?.itemModels[self?.currItemModelIndex ?? 0].materialDuraion ?? 0)
|
|
|
+// self?.progressThumV.progessIndicateBackV.addSubview((self?.indirectionView)!)
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -814,7 +824,17 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
itemModels[currItemModelIndex].voiceStickers.insert(tuple.0, at: tuple.1)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ //恢复字幕
|
|
|
+ let titleTuples = action.deletedTittles
|
|
|
+ if titleTuples != nil, titleTuples!.count > 0 {
|
|
|
+
|
|
|
+ titleTuples?.forEach { titleTuple in
|
|
|
+ itemModels[currItemModelIndex].titleStickers.insert(titleTuple.0, at: titleTuple.1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
drawOrUpdateRecordProgessLable()
|
|
|
jumpTime = model.startTime
|
|
|
}
|
|
@@ -829,6 +849,17 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
itemModels[currItemModelIndex].voiceStickers.insert(tuple.0, at: tuple.1)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //恢复字幕
|
|
|
+ let titleTuples = action.deletedTittles
|
|
|
+ if titleTuples != nil, titleTuples!.count > 0 {
|
|
|
+
|
|
|
+ titleTuples?.forEach { titleTuple in
|
|
|
+ itemModels[currItemModelIndex].titleStickers.insert(titleTuple.0, at: titleTuple.1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
drawOrUpdateRecordProgessLable()
|
|
|
} else {}
|
|
|
events.removeLast()
|
|
@@ -1200,16 +1231,18 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
/// - Parameter CMTime: <#CMTime description#>
|
|
|
func periodicTimeObserver(item: AVPlayerItem?, time: CMTime) {
|
|
|
// 进度监控
|
|
|
- currentAssetProgress = CMTime(seconds: time.seconds, preferredTimescale: 1000)
|
|
|
- BFLog(1, message: "curr:\(CMTimeGetSeconds(currentAssetProgress))")
|
|
|
- if CMTimeGetSeconds(item?.duration ?? CMTime.zero) > 0 {
|
|
|
- DispatchQueue.main.async { [weak self] in
|
|
|
- self?.progreddL.text = String(format: "%@", CMTimeGetSeconds(time).formatDurationToHMS())
|
|
|
- let su = !(self?.isDragingProgressSlder ?? false) || (self?.isRecording ?? false && self?.isNormalPlaying ?? false)
|
|
|
- if su {
|
|
|
- self?.progressThumV.progress = time.seconds
|
|
|
+ if itemModels[currItemModelIndex].mediaType == .VIDEO {
|
|
|
+ currentAssetProgress = CMTime(seconds: time.seconds, preferredTimescale: 1000)
|
|
|
+ BFLog(1, message: "curr:\(CMTimeGetSeconds(currentAssetProgress))")
|
|
|
+ if CMTimeGetSeconds(item?.duration ?? CMTime.zero) > 0 {
|
|
|
+ DispatchQueue.main.async { [weak self] in
|
|
|
+ self?.progreddL.text = String(format: "%@", CMTimeGetSeconds(time).formatDurationToHMS())
|
|
|
+ let su = !(self?.isDragingProgressSlder ?? false) || (self?.isRecording ?? false && self?.isNormalPlaying ?? false)
|
|
|
+ if su {
|
|
|
+ self?.progressThumV.progress = time.seconds
|
|
|
+ }
|
|
|
+ self?.updateSubtitle(time: time)
|
|
|
}
|
|
|
- self?.updateSubtitle(time: time)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1254,6 +1287,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
guard let sself = self else {
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
sself.progressThumV.progessIndicateBackV.subviews.forEach { vv in
|
|
|
vv.removeFromSuperview()
|
|
|
}
|
|
@@ -1414,7 +1448,7 @@ public extension BFRecordScreenController {
|
|
|
isNormalPlaying = true
|
|
|
playRecord(at: currentAssetProgress, periodicTimeObserver: { [weak self] currentT, currentItem in
|
|
|
BFLog(message: "播放一段进度:\(currentT),\(currentItem)")
|
|
|
- self?.imageRecordProgress(progress: CMTimeGetSeconds(currentT))
|
|
|
+ self?.imageRecordProgress(progress: CMTimeGetSeconds(currentT) / 2)
|
|
|
}, didPlayToEndTime: { [weak self] recordedAudio, currentItem in
|
|
|
BFLog(message: "播放一段结束:\(String(describing: recordedAudio)),\(String(describing: currentItem))")
|
|
|
if (recordedAudio?.endTime ?? 0) >= (self?.itemModels[self?.currItemModelIndex ?? 0].voiceStickers.last?.endTime ?? 0) {
|