|
@@ -146,6 +146,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
var touchStart: CGPoint = CGPoint(x: 0, y: 0)
|
|
var touchStart: CGPoint = CGPoint(x: 0, y: 0)
|
|
var avplayerTimeObserver: NSKeyValueObservation?
|
|
var avplayerTimeObserver: NSKeyValueObservation?
|
|
|
|
|
|
|
|
+ var indirectionView: BFIndirectionProgressView?
|
|
|
|
+
|
|
lazy var progreddL: UILabel = {
|
|
lazy var progreddL: UILabel = {
|
|
let l = UILabel()
|
|
let l = UILabel()
|
|
l.textAlignment = .center
|
|
l.textAlignment = .center
|
|
@@ -407,7 +409,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
// add by ak 取 nsl token
|
|
// add by ak 取 nsl token
|
|
BFRecordScreenViewModel.getNlsAccessToken {[weak self] token, appkey in
|
|
BFRecordScreenViewModel.getNlsAccessToken {[weak self] token, appkey in
|
|
BFLog(message: "nls appkey is \(appkey), token is \(token)")
|
|
BFLog(message: "nls appkey is \(appkey), token is \(token)")
|
|
- self?.speechTranscriberUtil = PQSpeechTranscriberUtil(token, appid: appkey)
|
|
|
|
|
|
+// self?.speechTranscriberUtil = PQSpeechTranscriberUtil(token, appid: appkey)
|
|
}
|
|
}
|
|
|
|
|
|
view.backgroundColor = .black
|
|
view.backgroundColor = .black
|
|
@@ -761,10 +763,18 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
assetPlayer?.play()
|
|
assetPlayer?.play()
|
|
// 暂停状态
|
|
// 暂停状态
|
|
(collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell)?.playBtn.isSelected = true
|
|
(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?.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)!)
|
|
|
|
+// }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1217,16 +1227,18 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
/// - Parameter CMTime: <#CMTime description#>
|
|
/// - Parameter CMTime: <#CMTime description#>
|
|
func periodicTimeObserver(item: AVPlayerItem?, time: CMTime) {
|
|
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)
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1271,6 +1283,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
guard let sself = self else {
|
|
guard let sself = self else {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
sself.progressThumV.progessIndicateBackV.subviews.forEach { vv in
|
|
sself.progressThumV.progessIndicateBackV.subviews.forEach { vv in
|
|
vv.removeFromSuperview()
|
|
vv.removeFromSuperview()
|
|
}
|
|
}
|
|
@@ -1431,7 +1444,7 @@ public extension BFRecordScreenController {
|
|
isNormalPlaying = true
|
|
isNormalPlaying = true
|
|
playRecord(at: currentAssetProgress, periodicTimeObserver: { [weak self] currentT, currentItem in
|
|
playRecord(at: currentAssetProgress, periodicTimeObserver: { [weak self] currentT, currentItem in
|
|
BFLog(message: "播放一段进度:\(currentT),\(currentItem)")
|
|
BFLog(message: "播放一段进度:\(currentT),\(currentItem)")
|
|
- self?.imageRecordProgress(progress: CMTimeGetSeconds(currentT))
|
|
|
|
|
|
+ self?.imageRecordProgress(progress: CMTimeGetSeconds(currentT) / 2)
|
|
}, didPlayToEndTime: { [weak self] recordedAudio, currentItem in
|
|
}, didPlayToEndTime: { [weak self] recordedAudio, currentItem in
|
|
BFLog(message: "播放一段结束:\(String(describing: recordedAudio)),\(String(describing: currentItem))")
|
|
BFLog(message: "播放一段结束:\(String(describing: recordedAudio)),\(String(describing: currentItem))")
|
|
if (recordedAudio?.endTime ?? 0) >= (self?.itemModels[self?.currItemModelIndex ?? 0].voiceStickers.last?.endTime ?? 0) {
|
|
if (recordedAudio?.endTime ?? 0) >= (self?.itemModels[self?.currItemModelIndex ?? 0].voiceStickers.last?.endTime ?? 0) {
|