avplayer的投屏设置,不知道有没有用
This commit is contained in:
parent
b74d31cd85
commit
2885b1de4b
@ -140,13 +140,17 @@ class ZZHCustomPlayer: UIView {
|
||||
make.height.equalTo(playerHeight)
|
||||
}
|
||||
avPlayer = AVPlayer()
|
||||
// avPlayer?.allowsExternalPlayback = true
|
||||
// avPlayer?.usesExternalPlaybackWhileExternalScreenIsActive = true
|
||||
// avPlayer?.externalPlaybackVideoGravity = .resizeAspect
|
||||
|
||||
avPlayer?.addPeriodicTimeObserver(forInterval: CMTime(value: 1, timescale: self.avPlayer?.currentItem?.duration.timescale ?? 600), queue: DispatchQueue.main, using: {[weak self] ct in
|
||||
self?.updateSliderUI(ct: ct)
|
||||
})
|
||||
|
||||
avPlayerLayer = AVPlayerLayer(player: avPlayer)
|
||||
avPlayerLayer?.frame = CGRect(x: 0, y: 0, width: Int(playerWidth), height: playerHeight)
|
||||
avPlayerLayer?.videoGravity = .resizeAspectFill
|
||||
avPlayerLayer?.videoGravity = .resizeAspect
|
||||
playerLayerBgView!.layer.addSublayer(avPlayerLayer!)
|
||||
// playerLayerBgView?.backgroundColor = UIColor.red
|
||||
// self.backgroundColor = .orange
|
||||
|
||||
Loading…
Reference in New Issue
Block a user