mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Change player size based on aspect ratio
This commit is contained in:
@@ -8,6 +8,16 @@ final class PlayerViewController: UIViewController {
|
||||
var playerModel: PlayerModel!
|
||||
var playerViewController = AVPlayerViewController()
|
||||
|
||||
var aspectRatio: Double? {
|
||||
let ratio = Double(playerViewController.videoBounds.width) / Double(playerViewController.videoBounds.height)
|
||||
|
||||
if !ratio.isFinite {
|
||||
return VideoPlayerView.defaultAspectRatio
|
||||
}
|
||||
|
||||
return [ratio, 1.0].max()!
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
|
Reference in New Issue
Block a user