横屏不变形
This commit is contained in:
parent
2148dcb241
commit
9810af4c01
@ -156,14 +156,14 @@ class ZZHCustomPlayer: UIView {
|
||||
// avPlayer?.allowsExternalPlayback = true
|
||||
// avPlayer?.usesExternalPlaybackWhileExternalScreenIsActive = true
|
||||
// avPlayer?.externalPlaybackVideoGravity = .resizeAspect
|
||||
|
||||
// avPlayer.
|
||||
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 = .resize
|
||||
avPlayerLayer?.videoGravity = .resizeAspect
|
||||
playerLayerBgView!.layer.addSublayer(avPlayerLayer!)
|
||||
// playerLayerBgView?.backgroundColor = UIColor.red
|
||||
// self.backgroundColor = .orange
|
||||
|
||||
Loading…
Reference in New Issue
Block a user