NavBarの下にビデオを収めようとしています。ポートレートとランドスケープの両方のために。出来ますか?ここでNavagationBarの下の背景ビデオの移動を速く
Background video move to under navigation
override func viewDidLoad()
{
super.viewDidLoad()
addNavBarImage()
let URL = Bundle.main.url(forResource: "homedocapp", withExtension: "mp4")
Player = AVPlayer.init(url: URL!)
PlayerLayer = AVPlayerLayer(player: Player)
PlayerLayer.videoGravity = AVLayerVideoGravityResizeAspect
PlayerLayer.frame = view.layer.bounds
Player.actionAtItemEnd = AVPlayerActionAtItemEnd.none
Player.play()
view.layer.insertSublayer(PlayerLayer, at: 0)
NotificationCenter.default.addObserver(self, selector: #selector(playerItemReachEnd(notification:)), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: Player.currentItem)
を使用して、次のコードL'mはストーリーボードを使用する場合は、あなたが0にそのスーパーにトップスペースの制約を設定することができ、事前
:view.bounds.origin.xを、y:view.bounds.origin.y + 44、width:view.bounds.size.width、height:view.bounds.size.height - 44) '' //ナビゲーションの高さを仮定すると= 44' – Santosh
ありがとうそれを試してください。 – o2webdev