|
@@ -90,7 +90,8 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
let iv = UIImageView()
|
|
|
iv.frame = UIScreen.main.bounds
|
|
|
iv.layer.addSublayer(playerLayer)
|
|
|
-
|
|
|
+ iv.contentMode = .scaleAspectFit
|
|
|
+ iv.backgroundColor = .black
|
|
|
return iv
|
|
|
}()
|
|
|
lazy var playerLayer : AVPlayerLayer = {
|
|
@@ -412,7 +413,7 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
|
|
|
let tt = currentAssetProgress - currPlayTime
|
|
|
BFLog(1, message: "asset - tt: \(tt.seconds), curr:\(currentAssetProgress.seconds)")
|
|
|
- playerCoverIV.image = PQVideoSnapshotUtil.videoSnapshot(videoURL: URL(fileURLWithPath: mod.locationPath), time: tt.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
|
|
|
|
|
@@ -456,7 +457,8 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
// 播放到末尾了
|
|
|
wself.dele?.isEndPlay = true
|
|
|
wself.dele?.pause()
|
|
|
- wself.playerLayer.removeFromSuperlayer()
|
|
|
+// wself.playerLayer.removeFromSuperlayer()
|
|
|
+ wself.playerCoverIV.isHidden = true
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -475,11 +477,9 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
CMTimeCompare(m.timelineCMIn, currentAssetProgress) <= 0 && CMTimeCompare(m.timelineCMOut, currentAssetProgress) > 0
|
|
|
}){
|
|
|
currPlayTime = mod.timelineCMIn
|
|
|
- let tt = currentAssetProgress - currPlayTime
|
|
|
|
|
|
avplayerReplaceItem(newItem: AVPlayerItem(url: URL(fileURLWithPath: mod.locationPath)))
|
|
|
- playerCoverIV.isHidden = false
|
|
|
- playerCoverIV.image = PQVideoSnapshotUtil.videoSnapshot(videoURL: URL(fileURLWithPath: mod.locationPath), time: tt.seconds)
|
|
|
+ setCoverImage(mod.timelineCMOut)
|
|
|
|
|
|
prepareToPlayNext(needPlay: false)
|
|
|
}else{
|
|
@@ -487,6 +487,15 @@ class BFRecordScreenCameraManager : BFRecordScreenBaseManager{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ func setCoverImage(_ dur: CMTime){
|
|
|
+ playerCoverIV.isHidden = false
|
|
|
+ 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.image = PQVideoSnapshotUtil.videoSnapshot(videoURL: URL(fileURLWithPath: mod.locationPath), time: .zero)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
override func changeRecordMaterail(){
|
|
|
//
|
|
|
if recordItem?.videoStickers.count ?? 0 == 0 {
|