question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
brianwernickcommented, May 29, 2017

This sounds like an issue with the SurfaceView implementation (default), if this is something you need now then the TextureView backing should work correctly (add app:useTextureViewBacking="true")

3reactions
brianwernickcommented, Aug 24, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImageView setScaleType not working - Stack Overflow
setBackgroundResource sets imageView's background so it is normal behaviour that stretches... Use setImageResource instead, it will set imageview's source ...
Read more >
PreviewView - Android Developers
Custom View that displays the camera feed for CameraX's Preview use case. This class manages the preview Surface 's lifecycle. It internally uses...
Read more >
QCPAxis Class Reference - QCustomPlot
Returns the QCPGrid instance belonging to this axis. Access it to set details about the way the grid is displayed. § setScaleType(). void...
Read more >
Jetpack Compose Image Content ScaleType Fully Illustrated
The XML Image ScaleType has CenterCrop but there is no StartCrop or EndCrop. ... A quick look across all scaling effects on the...
Read more >
ScaleTypes - Fresco
However, do not use the android:scaleType attribute, nor the .setScaleType method. These have no effect on Drawees. Scale Type: “focusCrop”. Android, and Fresco ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found