fix(pip): correct aspect ratio

This commit is contained in:
edde746
2026-01-02 01:34:11 +01:00
parent 08f8d2373a
commit a10dfcc004
+20 -1
View File
@@ -20,6 +20,25 @@ class VideoPIPManager {
final supported = await PipService.isSupported();
if (!supported) return;
await PipService.enter(width: _playerSize?.width.toInt(), height: _playerSize?.height.toInt());
// Try to get actual video dimensions from MPV
int? width;
int? height;
try {
final dwidth = await player.getProperty('dwidth');
final dheight = await player.getProperty('dheight');
if (dwidth != null && dheight != null) {
width = int.tryParse(dwidth);
height = int.tryParse(dheight);
}
} catch (_) {
// Fall through to use viewport size
}
// Fall back to viewport size if video dimensions unavailable
width ??= _playerSize?.width.toInt();
height ??= _playerSize?.height.toInt();
await PipService.enter(width: width, height: height);
}
}