mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Change player size based on aspect ratio
This commit is contained in:
@@ -6,6 +6,16 @@ final class PlayerViewController: NSViewController {
|
||||
var playerView = AVPlayerView()
|
||||
var pictureInPictureDelegate = PictureInPictureDelegate()
|
||||
|
||||
var aspectRatio: Double? {
|
||||
let ratio = Double(playerView.videoBounds.width) / Double(playerView.videoBounds.height)
|
||||
|
||||
if !ratio.isFinite {
|
||||
return VideoPlayerView.defaultAspectRatio
|
||||
}
|
||||
|
||||
return [ratio, 1.0].max()!
|
||||
}
|
||||
|
||||
override func viewDidDisappear() {
|
||||
super.viewDidDisappear()
|
||||
}
|
||||
|
Reference in New Issue
Block a user