|
@@ -108,7 +108,7 @@ public class PQGPUImagePlayerView: UIView {
|
|
|
/// Add filters to this array and call updateAsset(_:) method
|
|
|
public var filters: [ImageProcessingOperation] = []
|
|
|
|
|
|
- public var movie: PQMovieInput?
|
|
|
+ public var movie: PQMovieInput?
|
|
|
|
|
|
public var speaker: SpeakerOutput?
|
|
|
|
|
@@ -290,7 +290,7 @@ public class PQGPUImagePlayerView: UIView {
|
|
|
}
|
|
|
|
|
|
// 设置画布比例
|
|
|
- public func resetCanvasFrame(frame: CGRect) {
|
|
|
+ public func resetCanvasFrame(frame: CGRect) {
|
|
|
if self.frame.equalTo(frame) {
|
|
|
FilterLog(message: "新老值一样,不重置")
|
|
|
return
|
|
@@ -311,7 +311,11 @@ public class PQGPUImagePlayerView: UIView {
|
|
|
playMaskView.frame = CGRect.init(x: 0, y: 0, width: self.frame.width, height: self.frame.height)
|
|
|
tipLab.frame = CGRect(x: (self.frame.size.width - 100) / 2, y: (self.frame.size.height - 14) / 2, width: 100, height: 14)
|
|
|
progressLab.frame = CGRect(x: (self.frame.size.width - 140) / 2, y: 8, width: 140, height: 14)
|
|
|
- playView.frame = CGRect(x: (self.frame.size.width - self.frame.size.height / 3.6) / 2, y: (self.frame.size.height - self.frame.size.height / 3.6) / 2, width: self.frame.size.height / 3.6, height: self.frame.size.height / 3.6)
|
|
|
+
|
|
|
+ let bord = frame.size.width > frame.size.height ? CGFloat(64) : CGFloat(100)
|
|
|
+ playView.frame = CGRect(x: (CGFloat(frame.size.width) - bord) / 2 , y: (CGFloat(frame.size.height) - bord) / 2, width: bord, height: bord)
|
|
|
+
|
|
|
+// playView.frame = CGRect(x: (self.frame.size.width - self.frame.size.height / 3.6) / 2, y: (self.frame.size.height - self.frame.size.height / 3.6) / 2, width: self.frame.size.height / 3.6, height: self.frame.size.height / 3.6)
|
|
|
}
|
|
|
|
|
|
override public func layoutSubviews() {
|
|
@@ -402,29 +406,28 @@ public class PQGPUImagePlayerView: UIView {
|
|
|
}
|
|
|
}
|
|
|
guard let movie = movie else { return }
|
|
|
- movie.progress = { [weak self, movie] currTime, duration, prgressValue in
|
|
|
+ movie.progress = { [weak self] currTime, duration, prgressValue in
|
|
|
guard let strongSelf = self else { return }
|
|
|
|
|
|
- FilterLog(message: " movie.currentTime.seconds 进度\(movie.currentTime.seconds)")
|
|
|
- self?.changeFilter(currTime: movie.currentTime.seconds)
|
|
|
-
|
|
|
- self?.progress?(currTime, duration, prgressValue)
|
|
|
+// HHZPrint(" movie 进度\(currTime)")
|
|
|
+ strongSelf.changeFilter(currTime: currTime)
|
|
|
+ strongSelf.progress?(currTime, duration, prgressValue)
|
|
|
|
|
|
DispatchQueue.main.async {
|
|
|
- strongSelf.playbackTime = movie.currentTime.seconds
|
|
|
+ strongSelf.playbackTime = currTime
|
|
|
|
|
|
// Non-main thread change this property is not valid
|
|
|
strongSelf.animationLayer?.timeOffset = strongSelf.playbackTime
|
|
|
if strongSelf.showProgressLab {
|
|
|
-
|
|
|
+
|
|
|
if(strongSelf.showProgressStartTime == 0 ){
|
|
|
- strongSelf.showProgressStartTime = Float(CMTimeGetSeconds(movie.startTime ?? .zero))
|
|
|
+ strongSelf.showProgressStartTime = Float(CMTimeGetSeconds(strongSelf.movie?.startTime ?? .zero))
|
|
|
}
|
|
|
if duration < 1 {
|
|
|
-
|
|
|
- strongSelf.progressLab.text = "\((currTime - Double(CMTimeGetSeconds(movie.startTime ?? .zero))).formatDurationToHMS()) / 00:01"
|
|
|
+
|
|
|
+ strongSelf.progressLab.text = "\((currTime - Double(CMTimeGetSeconds(strongSelf.movie?.startTime ?? .zero))).formatDurationToHMS()) / 00:01"
|
|
|
} else {
|
|
|
-
|
|
|
+
|
|
|
var showTime = currTime - Double(strongSelf.showProgressStartTime)
|
|
|
if (showTime < 0){
|
|
|
showTime = 0
|
|
@@ -462,7 +465,7 @@ public class PQGPUImagePlayerView: UIView {
|
|
|
if mStickers?.count ?? 0 > 0 {
|
|
|
|
|
|
for (index , sticker) in mStickers!.enumerated() {
|
|
|
- print( "mStickers timelinein:\(sticker.timelineIn) timelineout: \(sticker.timelineOut) index : \(index)")
|
|
|
+ BFLog(message: "mStickers timelinein:\(sticker.timelineIn) timelineout: \(sticker.timelineOut) index : \(index)")
|
|
|
|
|
|
}
|
|
|
|
|
@@ -483,7 +486,7 @@ public class PQGPUImagePlayerView: UIView {
|
|
|
showFitler = PQImageFilter(sticker: currentSticker)
|
|
|
}
|
|
|
if showFitler != nil {
|
|
|
- print( " 加入到缓存 的 filter timelinein:\(currentSticker.timelineIn) timelineout: \(currentSticker.timelineOut) in :\(currentSticker.model_in) out: \(currentSticker.out) index : \(index)")
|
|
|
+ BFLog(message: " 加入到缓存 的 filter timelinein:\(currentSticker.timelineIn) timelineout: \(currentSticker.timelineOut) in :\(currentSticker.model_in) out: \(currentSticker.out) index : \(index)")
|
|
|
cacheFilters.append(showFitler!)
|
|
|
}
|
|
|
|