ExoPlayer2 Scaling

Viewed 9

I have an Activity that contains a FrameLayout where ExoPlayer takes place. This activity support both orientations and video aspect ratio should be preserved.

According to ExoPlayer docs, for the setResizeMode we can have one of the following:

  • RESIZE_MODE_FIT,
  • RESIZE_MODE_FIXED_WIDTH,
  • RESIZE_MODE_FIXED_HEIGHT,
  • RESIZE_MODE_FILL,
  • RESIZE_MODE_ZOOM

In my case, since I dont know the video size nor the device orientation, I can have two scenarios:

  • Video is larger than my Viewport, so I would like to have RESIZE_MODE_FIT to scale it down
  • Video is smaller than my Viewport, so I would like to have RESIZE_MODE_ZOOM to scale it up

But in the end I could not find a way to achieve this behavior. If I set RESIZE_MODE_FIT, small videos does not fill my Viewport. If I set RESIZE_MODE_ZOOM, large videos overflow the Viewport.

Thanks

0 Answers
Related