|
@@ -22,6 +22,13 @@ class INVideoExportController: BFBaseViewController {
|
|
|
return v
|
|
|
}()
|
|
|
|
|
|
+ let coverIV : UIImageView = {
|
|
|
+ let iv = UIImageView()
|
|
|
+ iv.alpha = 0.5
|
|
|
+ iv.contentMode = .scaleAspectFit
|
|
|
+ return iv
|
|
|
+ }()
|
|
|
+
|
|
|
var hasExportAll = false
|
|
|
var hasExportOnly = false
|
|
|
var hasSaveAll = false
|
|
@@ -45,6 +52,7 @@ class INVideoExportController: BFBaseViewController {
|
|
|
lazy var progressView: UIView = {
|
|
|
let v = UIView()
|
|
|
v.backgroundColor = ThemeStyleColor
|
|
|
+ v.alpha = 0.5
|
|
|
return v
|
|
|
}()
|
|
|
|
|
@@ -110,16 +118,16 @@ class INVideoExportController: BFBaseViewController {
|
|
|
}()
|
|
|
|
|
|
lazy var errorView : UIView = {
|
|
|
- let backV = UIView()
|
|
|
- backV.backgroundColor = .black
|
|
|
- backV.isHidden = true
|
|
|
+ let errbackV = UIView()
|
|
|
+ errbackV.backgroundColor = .black
|
|
|
+ errbackV.isHidden = true
|
|
|
|
|
|
let titleL = UILabel()
|
|
|
titleL.text = "合成失败"
|
|
|
titleL.font = UIFont.systemFont(ofSize: 36)
|
|
|
titleL.textColor = .white
|
|
|
titleL.textAlignment = .center
|
|
|
- backV.addSubview(titleL)
|
|
|
+ errbackV.addSubview(titleL)
|
|
|
|
|
|
let subTitleL = UILabel()
|
|
|
subTitleL.text = "请重新尝试"
|
|
@@ -129,7 +137,7 @@ class INVideoExportController: BFBaseViewController {
|
|
|
subTitleL.textAlignment = .center
|
|
|
subTitleL.contentCompressionResistancePriority(for: NSLayoutConstraint.Axis.horizontal)
|
|
|
subTitleL.numberOfLines = 0
|
|
|
- backV.addSubview(subTitleL)
|
|
|
+ errbackV.addSubview(subTitleL)
|
|
|
|
|
|
let retryBtn = UIButton()
|
|
|
retryBtn.backgroundColor = ThemeStyleColor
|
|
@@ -138,7 +146,7 @@ class INVideoExportController: BFBaseViewController {
|
|
|
retryBtn.setTitleColor(.white, for: .normal)
|
|
|
retryBtn.addCorner(corner:5)
|
|
|
retryBtn.addTarget(self, action: #selector(retryAction(sender:)), for: .touchUpInside)
|
|
|
- backV.addSubview(retryBtn)
|
|
|
+ errbackV.addSubview(retryBtn)
|
|
|
|
|
|
retryBtn.snp.makeConstraints { make in
|
|
|
make.width.equalTo(245)
|
|
@@ -157,7 +165,7 @@ class INVideoExportController: BFBaseViewController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- return backV
|
|
|
+ return errbackV
|
|
|
}()
|
|
|
|
|
|
var playerLayer: AVPlayerLayer!
|
|
@@ -194,7 +202,7 @@ class INVideoExportController: BFBaseViewController {
|
|
|
// let width = export.data?.first?.width ?? 0
|
|
|
sself.progressL.text = String(format: "%d%%", Int(progress * 100))
|
|
|
sself.progressView.snp.updateConstraints { make in
|
|
|
- make.width.equalTo(cScreenWidth * CGFloat(progress))
|
|
|
+ make.width.equalTo(sself.playerLayer.bounds.width * CGFloat(progress))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -208,6 +216,7 @@ class INVideoExportController: BFBaseViewController {
|
|
|
UIApplication.shared.isIdleTimerDisabled = false
|
|
|
|
|
|
sself.resetViewStatus()
|
|
|
+ sself.coverIV.isHidden = true
|
|
|
|
|
|
if let fileUrl = url {
|
|
|
sself.sliderView?.isHidden = false
|
|
@@ -348,7 +357,8 @@ class INVideoExportController: BFBaseViewController {
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
view.backgroundColor = .black
|
|
|
- navHeadImageView?.backgroundColor = .black
|
|
|
+ navHeadImageView?.backgroundColor = .clear
|
|
|
+
|
|
|
leftButton(image: nil, imageName: nil, tintColor: UIColor.white)
|
|
|
|
|
|
// backV.frame = CGRect(x: 0, y: navHeadImageView?.bottomY ?? 0, width: cScreenWidth, height: cScreenWidth)
|
|
@@ -372,12 +382,13 @@ class INVideoExportController: BFBaseViewController {
|
|
|
view.addSubview(errorView)
|
|
|
|
|
|
playerLayer = AVPlayerLayer(player: avplayer)
|
|
|
- playerLayer.borderWidth = 1
|
|
|
+ playerLayer.borderWidth = 2
|
|
|
playerLayer.borderColor = UIColor.hexColor(hexadecimal: "#1A1A1A").cgColor
|
|
|
backV.layer.addSublayer(playerLayer)
|
|
|
|
|
|
backV.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(playAction)))
|
|
|
|
|
|
+ backV.addSubview(coverIV)
|
|
|
backV.addSubview(progressView)
|
|
|
backV.addSubview(progressL)
|
|
|
|
|
@@ -390,15 +401,25 @@ class INVideoExportController: BFBaseViewController {
|
|
|
make.edges.equalToSuperview()
|
|
|
}
|
|
|
|
|
|
+ coverIV.snp.makeConstraints { make in
|
|
|
+ make.bottom.centerX.equalToSuperview()
|
|
|
+ make.width.equalTo(coverIV.snp.height).multipliedBy(cScreenWidth / cScreenHeigth)
|
|
|
+ make.height.equalToSuperview().offset(-1 * cDevice_iPhoneNavBarAndStatusBarHei + 30)
|
|
|
+ }
|
|
|
progressView.snp.makeConstraints { make in
|
|
|
- make.left.top.height.equalToSuperview()
|
|
|
+ make.top.left.bottom.equalTo(coverIV)
|
|
|
make.width.equalTo(0)
|
|
|
}
|
|
|
|
|
|
progressL.snp.makeConstraints { make in
|
|
|
- make.center.width.equalToSuperview()
|
|
|
+ make.width.centerX.centerY.equalTo(coverIV)
|
|
|
make.height.equalTo(28)
|
|
|
}
|
|
|
+
|
|
|
+ backV.snp.makeConstraints { make in
|
|
|
+ make.left.right.top.equalToSuperview()
|
|
|
+ make.bottom.equalTo(bottomView.snp.top)
|
|
|
+ }
|
|
|
|
|
|
bottomView.snp.makeConstraints { make in
|
|
|
make.left.right.equalToSuperview()
|
|
@@ -439,9 +460,12 @@ class INVideoExportController: BFBaseViewController {
|
|
|
guard let sself = self else {
|
|
|
return
|
|
|
}
|
|
|
- sself.backV.frame = CGRect(x: 0, y: sself.navHeadImageView?.frame.maxY ?? 0, width: sself.view.width, height: (sself.bottomView.frame.minY ) - (sself.navHeadImageView?.frame.maxY ?? 0))
|
|
|
- let width = sself.backV.height * (cScreenWidth / cScreenHeigth)
|
|
|
- sself.playerLayer.frame = CGRect(x: (sself.backV.width - width)/2, y: 0, width: width, height: sself.backV.height)
|
|
|
+// sself.backV.frame = CGRect(x: 0, y:0, width: sself.view.width, height: (sself.bottomView.frame.minY ))
|
|
|
+// let height = sself.backV.height - cDevice_iPhoneNavBarAndStatusBarHei + 30
|
|
|
+// let width = height * (cScreenWidth / cScreenHeigth)
|
|
|
+// sself.playerLayer.frame = CGRect(x: (sself.backV.width - width)/2, y: cDevice_iPhoneNavBarAndStatusBarHei - 30, width: width, height: height)
|
|
|
+ sself.playerLayer.frame = sself.coverIV.frame
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -508,6 +532,7 @@ class INVideoExportController: BFBaseViewController {
|
|
|
return
|
|
|
}
|
|
|
isExporting = true
|
|
|
+ coverIV.isHidden = false
|
|
|
playerLayer.borderColor = UIColor.hexColor(hexadecimal: "#1A1A1A").cgColor
|
|
|
avplayer.replaceCurrentItem(with: nil)
|
|
|
// bottomView.isHidden = true
|