mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Fix incorrect anamorphic handling in Leanback extension
The leanback library doesn't know about non-square pixels. So if we're playing content that uses non-square pixels, we need to adjust the video dimensions that we provide to leanback such that it renders the video with the correct aspect ratio. PiperOrigin-RevId: 277042560
This commit is contained in:
parent
7277df3547
commit
8ec6cf154c
1 changed files with 5 additions and 1 deletions
|
|
@ -307,7 +307,11 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
|||
@Override
|
||||
public void onVideoSizeChanged(
|
||||
int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
||||
getCallback().onVideoSizeChanged(LeanbackPlayerAdapter.this, width, height);
|
||||
// There's no way to pass pixelWidthHeightRatio to leanback, so we scale the width that we
|
||||
// pass to take it into account. This is necessary to ensure that leanback uses the correct
|
||||
// aspect ratio when playing content with non-square pixels.
|
||||
int scaledWidth = Math.round(width * pixelWidthHeightRatio);
|
||||
getCallback().onVideoSizeChanged(LeanbackPlayerAdapter.this, scaledWidth, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue