setScaleType has no effect
See original GitHub issue- ✅ I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
- ExoMedia version:
4.0.2
- Device OS version:
5.1
- Devide Manufacturer:
LG
- Device Name:
NEXUS 4
Reproduction Steps
Created fresh fragment and put following code in onStart:
video_view.setVideoURI(Uri.parse("/android_asset/onboarding.mp4"))
video_view.setMeasureBasedOnAspectRatioEnabled(false)
video_view.setScaleType(ScaleType.CENTER_CROP)
video_view.setOnPreparedListener {
video_view.start()
}
video_view.setOnCompletionListener {
video_view.restart()
}
Layout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<com.devbrackets.android.exomedia.ui.widget.VideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
Expected Result
The video should fill the entire screen and be cropped. The aspect ration should not change.
Actual Result
The video fills the screen, however there is a black padding at the bottom, which is not coming from the layout. I added a white background to my layout to check this. So the black space must come from within the video view. Besides that the aspect ration of the video changed.
Description
So I was looking for a way to have the video just scale and crop to fill the entire screen. But setting the scale type has not the desired effect. The video has full height but not full width (white space on left and right). Then I stumbled upon this issue https://github.com/brianwernick/ExoMedia/issues/164 and set
video_view.setMeasureBasedOnAspectRatioEnabled(false)
which even created another problem (change of aspect ratio)
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
This sounds like an issue with the
SurfaceView
implementation (default), if this is something you need now then theTextureView
backing should work correctly (addapp:useTextureViewBacking="true"
)Yeah, the performance improvements in the SurfaceView vs the TextureView is why it’s used as the default backing. I definitely do plan on fixing this, I just haven’t had much time to work on it yet; once I get the 2.0 release out for PlaylistCore I should be able to focus on bug fixes/improvements in ExoMedia