|
@@ -479,14 +479,18 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
|
|
|
let tt = currentAssetProgress - currPlayTime
|
|
|
BFLog(1, message: "asset - tt: \(tt.seconds), curr:\(currentAssetProgress.seconds)")
|
|
|
- setCoverImage(mod.timelineCMOut)
|
|
|
-
|
|
|
- avplayer.currentItem?.seek(to: tt, toleranceBefore: CMTime(value: 1, timescale: 1_000_000), toleranceAfter: CMTime(value: 1, timescale: 1_000_000), completionHandler: {[weak avplayer] _ in
|
|
|
-
|
|
|
+ if CMTimeCompare(tt, (avplayer.currentItem?.duration ?? .zero)) == 0 {
|
|
|
if needPlay {
|
|
|
- avplayer?.play()
|
|
|
+ avplayer.play()
|
|
|
}
|
|
|
- })
|
|
|
+ }else {
|
|
|
+ avplayer.currentItem?.seek(to: tt, toleranceBefore: CMTime(value: 1, timescale: 1_000_000), toleranceAfter: CMTime(value: 1, timescale: 1_000_000), completionHandler: {[weak avplayer] _ in
|
|
|
+
|
|
|
+ if needPlay {
|
|
|
+ avplayer?.play()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
playRecordVoice(needPlay: needPlay)
|
|
|
}else {
|
|
@@ -526,6 +530,8 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
// 如果离结束大于0.7s,代表还有下一段视频
|
|
|
if ((wself.recordItem?.materialDuraion ?? .zero) - wself.currentAssetProgress).seconds > 0.7 {
|
|
|
wself.findNextModel()
|
|
|
+ wself.setCoverImage(wself.currentAssetProgress)
|
|
|
+
|
|
|
wself.prepareToPlayNext()
|
|
|
}else{
|
|
|
// 播放到末尾了
|
|
@@ -549,15 +555,16 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
// 播放视频
|
|
|
if let mod = recordItem?.videoStickers.first(where: { m in
|
|
|
CMTimeCompare(m.timelineCMIn, currentAssetProgress) <= 0 && CMTimeCompare(m.timelineCMOut, currentAssetProgress) > 0
|
|
|
- }){
|
|
|
+ }), (CMTimeCompare(currentAssetProgress, (recordItem?.materialDuraion ?? .zero)) < 0){
|
|
|
+ BFLog(1, message: "drag end:\(currentAssetProgress.seconds), mod:\(mod.timelineCMIn)")
|
|
|
currPlayTime = mod.timelineCMIn
|
|
|
+ playerCoverIV.image = getThumbImageAtTime(urlAsset: AVURLAsset(url: URL(fileURLWithPath: mod.locationPath)), time: currentAssetProgress - currPlayTime)
|
|
|
+ playerCoverIV.isHidden = false
|
|
|
|
|
|
avplayerReplaceItem(newItem: AVPlayerItem(url: URL(fileURLWithPath: mod.locationPath)))
|
|
|
- setCoverImage(mod.timelineCMOut)
|
|
|
|
|
|
- prepareToPlayNext(needPlay: false)
|
|
|
+// prepareToPlayNext(needPlay: false)
|
|
|
}
|
|
|
- playerCoverIV.isHidden = (CMTimeCompare(currentAssetProgress, recordItem?.materialDuraion ?? .zero) >= 0)
|
|
|
}
|
|
|
|
|
|
|
|
@@ -566,10 +573,8 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
if let mod = recordItem?.videoStickers.first(where: { m in
|
|
|
CMTimeCompare(m.timelineCMIn, (dur + CMTime(seconds: 0.5, preferredTimescale: 1000))) <= 0 && CMTimeCompare(m.timelineCMOut, (dur + CMTime(seconds: 0.5, preferredTimescale: 1000))) > 0
|
|
|
}){
|
|
|
- playerCoverIV.isHidden = false
|
|
|
playerCoverIV.image = PQVideoSnapshotUtil.videoSnapshot(videoURL: URL(fileURLWithPath: mod.locationPath), time: .zero)
|
|
|
}
|
|
|
- playerCoverIV.isHidden = (CMTimeCompare(currentAssetProgress, recordItem?.materialDuraion ?? .zero) >= 0)
|
|
|
}
|
|
|
|
|
|
override func changeRecordMaterail(){
|