fix(pip): correct aspect ratio
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user