From ea34ad7709d3be994c573215c7b8d6eab15beeeb Mon Sep 17 00:00:00 2001 From: AbdallahMehiz Date: Tue, 4 Jun 2024 23:52:20 +0100 Subject: [PATCH] fix: wrong stretch aspect ratios --- .../main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt b/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt index fc8bbda..cc8180f 100644 --- a/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt +++ b/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt @@ -2,6 +2,7 @@ package live.mehiz.mpvkt.ui.player import android.media.AudioManager import android.net.Uri +import android.util.DisplayMetrics import androidx.core.view.WindowInsetsCompat import androidx.lifecycle.ViewModel import `is`.xyz.mpv.MPVLib @@ -286,8 +287,9 @@ class PlayerViewModel( } VideoAspect.Stretch -> { - ratio = - activity.resources.displayMetrics.widthPixels / activity.resources.displayMetrics.heightPixels.toDouble() + val dm = DisplayMetrics() + activity.windowManager.defaultDisplay.getRealMetrics(dm) + ratio = dm.widthPixels / dm.heightPixels.toDouble() pan = 0.0 } }