-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A few video in a list overlap each other #1107
Comments
Thank you for your report, @kotya341 While we are still exploring the interoperability of Media3 and Compose, I could look into this issue for you if you provide a complete sample code for us to reproduce the issue. When I played around with landscape/portrait orientation, I needed to switch between RESIZE_MODE_ZOOM and RESIZE_MODE_FIT, also use a more fine grained modifier (e.g. fillMaxSize(), fillMaxWidth(), wrapContentSize() and aspectRatio()) |
I think the repository might be private - the link navigates to 404 sadly |
sorry my bad, I just changed settings |
Great, thanks! It seems like the main problem is the resize mode. By default, PlayerView has RESIZE_MODE_FIT and if you change your default value here, it will indeed work When you set RESIZE_MODE_ZOOM, the video is stretched such that the width is fully occupied, while the height will be whatever it needs to be to maintain the correct aspect ratio. That means the surface of AspectRatioFrameLayout is larger than the parent component (MyStyledPlayerView). Ideally, the parent component should crop the view to the boundaries of the parent, but I guess it doesn't. To see the overlap more clearly, I added red spacers between the 3 items like:
From the LayoutInspector, we can see that:
Then if we look at the next item, the two AspectRatioFrameLayout will overlap inside the spacer, but at least not in the PlayerView component My conclusion is to either use FIT or remove the height of the Box (420dp). You seem to have two nested Boxes:
Also, if LazyColumn doesn't feel like the right choice, you might want to consider VerticalPager (for a video to snap to the middle), but I haven't explored it myself yet. Let me know if I understood you and your requirements correctly! |
Thanks a lot for such a details analysis. VerticalPager is the same as increasing the size of the cell, both of the solutions would lead to an increase in the size of the element. Maybe this case worth to create a bug in MediaPlayer just to avoid this issue for the future? |
btw |
When I played around with it, I also noticed that Could I ask you how you injected the xml attribute? (I manually changed the variable in PlayerView, but I'm assuming you had to inflate a layout in a hacky way?) On a different note, the current timeline is to aim for a more native Compose solution (no AndroidView interoperability), hence we are unlikely to try to make this work -- given that it's better to concentrate our efforts on a longer-term stable vision. I will close the issue, since it is not related to Media3 library as such. |
you are correct about my inflation way
I'll create the bug anyway and hope that you will find some time to fix an issue. |
Duplicate of #1237 |
Re-opening and un-duping based on #1237 (comment) |
Hi @kotya341,
|
Thanks a lot for helping me with the topic. in my production app, I just use this custom inflate from xml method that is commented in my example app. However, there are some performance issues with And I had to find a balance, which problem I could live with and I chose flickering :( |
@oceanjules could you please share some updates with me? |
Same issue reported on react native video implementation. |
Version
Media3 1.2.1
More version details
We are designing a social media feed for our app and we are facing a problem with with our compose implementation
in a feed we are using
androidx.media3.exoplayer.ExoPlayer
and viaAndroidView( modifier = Modifier.align(Alignment.BottomCenter), factory =PlayerView(content)
where I set a player per an item like this
this.player = player
and to fit the screen size I use
AspectRatioFrameLayout.RESIZE_MODE_ZOOM
it looks like a player takes all of the player Views to show a video
as a result, you can see the same video in several list items
it looks like the same issue was reported for old exo-player, however without a working solution unfortunately
Please help me to provide the best experience to our users
Devices that reproduce the issue
Pixel 5
Reproduction steps
Expected result
The video should take a frame size and don't interact with a neighbour item
Actual result
Current video plays in several list items
Media
Screen_recording_20240219_142945.mp4
Bug Report
adb bugreport
to android-media-github@google.com after filing this issue.The text was updated successfully, but these errors were encountered: