|
@@ -16,7 +16,13 @@ import UIKit
|
|
|
|
|
|
class INVideoExportController: BFBaseViewController {
|
|
class INVideoExportController: BFBaseViewController {
|
|
var avplayerTimeObserver: NSKeyValueObservation?
|
|
var avplayerTimeObserver: NSKeyValueObservation?
|
|
- let backV = UIView()
|
|
|
|
|
|
+ let backV : UIView = {
|
|
|
|
+ let v = UIView()
|
|
|
|
+ v.backgroundColor = UIColor.hexColor(hexadecimal: "#1A1A1A")
|
|
|
|
+
|
|
|
|
+ return v
|
|
|
|
+ }()
|
|
|
|
+
|
|
var hasExportAll = false
|
|
var hasExportAll = false
|
|
var hasExportOnly = false
|
|
var hasExportOnly = false
|
|
var hasSaveAll = false
|
|
var hasSaveAll = false
|
|
@@ -339,7 +345,6 @@ class INVideoExportController: BFBaseViewController {
|
|
leftButton(image: nil, imageName: nil, tintColor: UIColor.white)
|
|
leftButton(image: nil, imageName: nil, tintColor: UIColor.white)
|
|
|
|
|
|
// backV.frame = CGRect(x: 0, y: navHeadImageView?.bottomY ?? 0, width: cScreenWidth, height: cScreenWidth)
|
|
// backV.frame = CGRect(x: 0, y: navHeadImageView?.bottomY ?? 0, width: cScreenWidth, height: cScreenWidth)
|
|
- backV.backgroundColor = .black
|
|
|
|
// backV.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(play)))
|
|
// backV.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(play)))
|
|
|
|
|
|
addSubviews()
|
|
addSubviews()
|
|
@@ -360,6 +365,8 @@ class INVideoExportController: BFBaseViewController {
|
|
view.addSubview(errorView)
|
|
view.addSubview(errorView)
|
|
|
|
|
|
playerLayer = AVPlayerLayer(player: avplayer)
|
|
playerLayer = AVPlayerLayer(player: avplayer)
|
|
|
|
+ playerLayer.borderWidth = 1
|
|
|
|
+ playerLayer.borderColor = ThemeStyleColor.cgColor
|
|
backV.layer.addSublayer(playerLayer)
|
|
backV.layer.addSublayer(playerLayer)
|
|
|
|
|
|
backV.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(playAction)))
|
|
backV.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(playAction)))
|
|
@@ -422,8 +429,12 @@ class INVideoExportController: BFBaseViewController {
|
|
}
|
|
}
|
|
|
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0) { [weak self] in
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0) { [weak self] in
|
|
- self?.backV.frame = CGRect(x: 0, y: self?.navHeadImageView?.frame.maxY ?? 0, width: self?.view.width ?? 0, height: (self?.bottomView.frame.minY ?? 0) - (self?.navHeadImageView?.frame.maxY ?? 0))
|
|
|
|
- self?.playerLayer.frame = self!.backV.bounds
|
|
|
|
|
|
+ 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)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -431,6 +442,7 @@ class INVideoExportController: BFBaseViewController {
|
|
func addVideoSliderView() {
|
|
func addVideoSliderView() {
|
|
if sliderView == nil {
|
|
if sliderView == nil {
|
|
sliderView = BFVideoPlayerSliderView(frame: CGRect(x: 0, y: backV.frame.height - 60, width: backV.frame.width, height: 50))
|
|
sliderView = BFVideoPlayerSliderView(frame: CGRect(x: 0, y: backV.frame.height - 60, width: backV.frame.width, height: 50))
|
|
|
|
+ sliderView?.showFullBtn = false
|
|
sliderView?.valueChangeBloc = { [weak self] sender in
|
|
sliderView?.valueChangeBloc = { [weak self] sender in
|
|
let cmtime = CMTime(value: CMTimeValue(Float64(sender.value) * Float64(self?.avplayer.currentItem?.asset.duration.seconds ?? 0) * 1000.0), timescale: CMTimeScale(1000.0))
|
|
let cmtime = CMTime(value: CMTimeValue(Float64(sender.value) * Float64(self?.avplayer.currentItem?.asset.duration.seconds ?? 0) * 1000.0), timescale: CMTimeScale(1000.0))
|
|
BFLog(message: "cmtime == \(cmtime),\(cmtime.seconds)")
|
|
BFLog(message: "cmtime == \(cmtime),\(cmtime.seconds)")
|
|
@@ -708,7 +720,9 @@ extension INVideoExportController {
|
|
isHiddenStatus = false // (0.0, 64.0, 375.0, 401.0)
|
|
isHiddenStatus = false // (0.0, 64.0, 375.0, 401.0)
|
|
navHeadImageView?.isHidden = false
|
|
navHeadImageView?.isHidden = false
|
|
backV.frame = CGRect(x: 0, y: navHeadImageView?.frame.maxY ?? 0, width: view.width, height: bottomView.frame.minY - (navHeadImageView?.frame.maxY ?? 0))
|
|
backV.frame = CGRect(x: 0, y: navHeadImageView?.frame.maxY ?? 0, width: view.width, height: bottomView.frame.minY - (navHeadImageView?.frame.maxY ?? 0))
|
|
- playerLayer.frame = CGRect(x: 0, y: 0, width: view.width, height: bottomView.frame.minY - (navHeadImageView?.frame.maxY ?? 0))
|
|
|
|
|
|
+ let width = backV.height * (cScreenWidth / cScreenHeigth)
|
|
|
|
+ playerLayer.frame = CGRect(x: (backV.width - width)/2, y: 0, width: width, height: backV.height)
|
|
|
|
+// playerLayer.frame = CGRect(x: 0, y: 0, width: view.width, height: bottomView.frame.minY - (navHeadImageView?.frame.maxY ?? 0))
|
|
sliderView?.frame = CGRect(x: 0, y: backV.frame.height - 60, width: view.frame.width, height: 50)
|
|
sliderView?.frame = CGRect(x: 0, y: backV.frame.height - 60, width: view.frame.width, height: 50)
|
|
UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
|
UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
|
self?.changeOrientation(orientation: .portrait)
|
|
self?.changeOrientation(orientation: .portrait)
|
|
@@ -723,7 +737,9 @@ extension INVideoExportController {
|
|
isHiddenStatus = true
|
|
isHiddenStatus = true
|
|
navHeadImageView?.isHidden = true
|
|
navHeadImageView?.isHidden = true
|
|
backV.frame = CGRect(x: 0, y: 0, width: view.frame.height, height: view.frame.width)
|
|
backV.frame = CGRect(x: 0, y: 0, width: view.frame.height, height: view.frame.width)
|
|
- playerLayer.frame = backV.bounds
|
|
|
|
|
|
+ let width = view.width * (cScreenWidth / cScreenHeigth)
|
|
|
|
+ playerLayer.frame = CGRect(x: (view.height - width)/2, y: 0, width: width, height: backV.width)
|
|
|
|
+// playerLayer.frame = backV.bounds
|
|
sliderView?.frame = CGRect(x: 0, y: backV.frame.height - 60, width: backV.frame.width, height: 50)
|
|
sliderView?.frame = CGRect(x: 0, y: backV.frame.height - 60, width: backV.frame.width, height: 50)
|
|
UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
|
UIView.animate(withDuration: 0.2, animations: { [weak self] in
|
|
let orientation = UIDevice.current.orientation
|
|
let orientation = UIDevice.current.orientation
|