Set the video resize mode

The resize mode controls how video scales inside the PlayerView. Use it to letterbox a video so nothing is cropped, or to fill the view and crop the overflow, which is what full-screen feeds do.


Before you begin

Make sure you have the FastPix Android Player SDK installed and a player set up. See Install FastPix Android player and Set up the player.


Set the resize mode

Set resizeMode on the PlayerView in code:

1playerView.resizeMode = ResizeMode.ZOOM // fill the view, cropping the overflow

Or set it in your layout XML:

1<io.fastpix.media3.PlayerView
2 android:id="@+id/playerView"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 app:fastPixResizeMode="zoom" />

Resize modes

ModeBehavior
FIT (default)Scale to fit inside the view, letterboxing as needed.
FIXED_WIDTHMatch the view’s width; height follows the content.
FIXED_HEIGHTMatch the view’s height; width follows the content.
FILLStretch to fill, ignoring aspect ratio.
ZOOMFill while preserving aspect ratio, cropping the overflow.

FIT is right for a general-purpose player, where cropping would hide content. Full-screen feeds normally want ZOOM, so a source of any shape fills the page the way short-form apps present it.


Frequently asked questions

How do I make a video fill the screen without black bars?

Set resizeMode = ResizeMode.ZOOM (or app:fastPixResizeMode="zoom" in XML). ZOOM fills the view while preserving aspect ratio and crops the overflow, so there are no letterbox bars.

What's the default resize mode?

FIT. It scales the video to fit inside the view and letterboxes as needed, so no content is cropped. This is the right default for a general-purpose player.

What's the difference between FILL and ZOOM?

FILL stretches the video to fill the view and ignores aspect ratio, which can distort the picture. ZOOM fills the view while preserving aspect ratio and crops whatever overflows, so the picture stays undistorted.

Can I set the resize mode in XML instead of code?

Yes. Use the app:fastPixResizeMode attribute on the PlayerView, for example app:fastPixResizeMode="zoom". You can also change it at runtime with the resizeMode property.


What’s next