On the HiMedia/Amlogic TV the video renders through the vendor video plane, which scales the decoded stream to the whole panel and ignores the letterbox geometry AspectRatioFrameLayout lays out for the SurfaceView. Portrait videos therefore filled the screen instead of being letterboxed; on emulators the same code was correct. Render the video in a TextureView instead: it lives in the normal view tree, so the aspect ratio is honored on every device. Verified on the HiMedia box (vertical short letterboxed, landscape fills the screen as before) and on the emulator. Closes #1
13 lines
No EOL
772 B
XML
13 lines
No EOL
772 B
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- Player view with a TextureView surface: SurfaceView is routed through the
|
|
vendor video plane on some TV SoCs (Amlogic/HiMedia), which scales the
|
|
decoded video to the whole panel and ignores the letterbox geometry that
|
|
AspectRatioFrameLayout sets up, so portrait videos end up stretched full
|
|
screen. A TextureView renders in the normal view tree and honors the
|
|
aspect ratio everywhere (git issue #1). -->
|
|
<androidx.media3.ui.PlayerView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
android:id="@+id/player_view"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
app:surface_type="texture_view" /> |