You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SurfaceView inside Compose AndroidView often shown stretched/cropped on API 34 #1237
+1 this
We've spent days trying to understand issues we have with Android 14 devices recently.
Going back to our previous app versions doesn't fix anything, so we came up with the same conclusion as @MykolaKosianchuk , it's probably related to a recent Android patch.
Reacted by MykolaKosianchuk, Didier116, Morten Holmgaard and Angelo Moroni
@phcannesson Yes, we found this issue and tried to reproduce it on the device without the last patch but we can't. However, once we updated the phone, the issue appeared.
We have the same problem. We had already observed this in the QPR but unfortunately did not create an issue. Interestingly, we "only" have the problem if we use the AndroidView (which creates the PlayerView) in an if block, i.e. the composable is not called immediately.
Please can you test this? It would help us to debug if we know whether it can be reproduced in the demo app.
Interestingly, we "only" have the problem if we use the AndroidView (which creates the PlayerView) in an if block, i.e. the composable is not called immediately.
Is this true for everyone else that has commented on this bug? Is everyone else experiencing this only in Compose contexts, or also in conventional views? This looks like it might be a duplicate of #1123 but it's interesting to hear that the behaviour changes between Android 14 before the March 5th update and after it.
Please can you test this? It would help us to debug if we know whether it can be reproduced in the demo app.
Interestingly, we "only" have the problem if we use the AndroidView (which creates the PlayerView) in an if block, i.e. the composable is not called immediately.
Is this true for everyone else that has commented on this bug? Is everyone else experiencing this only in Compose contexts, or also in conventional views? This looks like it might be a duplicate of #1123 but it's interesting to hear that the behaviour changes between Android 14 before the March 5th update and after it.
On our side we're using Compose.
We did not test with conventional views.
I have faced exact same issue, except I was using resizeMode with fixed height.
I addition I have noticed that the video gets right aspect ratio after I switched orientation to landscape and then back to portrait.
Hi @icbaker , I was also not able to reproduce the issue on your demo app on Pixel 7, Android 14, march 5th update, but we have the issue in our compose app using AndroidView. The issue is present in this sample app that uses compose, (press on the "Exo PlayerView" button):
@devno44 In order to backport the code change to an older version of the library you will need to build your chosen version locally (media3 instructions, ExoPlayer 2.19.0 instructions), and then apply the changes in 968f72f and 9980306 to your local copy of the code (note that in the exoplayer2, the equivalent of media3's PlayerView is StyledPlayerView.
@phcannesson This issue is fixed in 1.4.0-rc01. If you're experiencing similar problems on that version or later, please open a new issue with details & repro steps.
@icbaker how would we be able to replicate your fix when we aren't using the PlayerView directly but instead use the AspectRatioFrameLayout and SurfaceView inside the AndroidView. I have created something similar in compose for our use case as below. let me know if this looks good
Heads up for those subscribed to this thread: We have received a report (#1594) that the workaround we introduced in 30cb762 has introduced a regression in the behaviour of Shared Element Transitions. We are currently investigating this, and will update #1594 when we have more info.
@Omkar-Amberkar Does it work? That's probably the best/first test. In general we don't have the capacity for 1:1 code review, and we are also not the experts in these graphics APIs - so I'm afraid not best placed to debug your integration with them, if you're unable to adapt our published workaround to your needs.
I'm afraid that due to the unintended side-effects of the workaround reported in #1594 (for non-Compose use-cases), I've had to make the workaround opt-in (rather than automatically enabled) in 87bd9ba.
This means that those of you using PlayerView inside AndroidView will need to call playerView.setEnableComposeSurfaceSyncWorkaround(true) to enable the workaround. This change will probably go live in 1.5.0-beta01.
Activity
phcannesson commentedon Apr 3, 2024
+1 this
We've spent days trying to understand issues we have with Android 14 devices recently.
Going back to our previous app versions doesn't fix anything, so we came up with the same conclusion as @MykolaKosianchuk , it's probably related to a recent Android patch.
MykolaKosianchuk commentedon Apr 3, 2024
@phcannesson Yes, we found this issue and tried to reproduce it on the device without the last patch but we can't. However, once we updated the phone, the issue appeared.
harry248 commentedon Apr 3, 2024
We have the same problem. We had already observed this in the QPR but unfortunately did not create an issue. Interestingly, we "only" have the problem if we use the AndroidView (which creates the PlayerView) in an if block, i.e. the composable is not called immediately.
icbaker commentedon Apr 8, 2024
Please can you test this? It would help us to debug if we know whether it can be reproduced in the demo app.
Is this true for everyone else that has commented on this bug? Is everyone else experiencing this only in Compose contexts, or also in conventional views? This looks like it might be a duplicate of #1123 but it's interesting to hear that the behaviour changes between Android 14 before the March 5th update and after it.
phcannesson commentedon Apr 8, 2024
On our side we're using Compose.
We did not test with conventional views.
promanowicz commentedon Apr 8, 2024
I have faced exact same issue, except I was using resizeMode with fixed height.
I addition I have noticed that the video gets right aspect ratio after I switched orientation to landscape and then back to portrait.
MykolaKosianchuk commentedon Apr 8, 2024
@icbaker It is not reproducible in the demo app
Looks like it is related to the compose
speedclaud commentedon Apr 11, 2024
Hi @icbaker , I was also not able to reproduce the issue on your demo app on Pixel 7, Android 14, march 5th update, but we have the issue in our compose app using AndroidView. The issue is present in this sample app that uses compose, (press on the "Exo PlayerView" button):
compose-media.zip
This is what it looks like:
30 remaining items
devno44 commentedon Jul 30, 2024
Is there any workaround for older versions ?
We can not change the ExoPlayer version right now, and can not use TextureView instead of SurfaceView.
icbaker commentedon Jul 30, 2024
@devno44 In order to backport the code change to an older version of the library you will need to build your chosen version locally (media3 instructions, ExoPlayer 2.19.0 instructions), and then apply the changes in 968f72f and 9980306 to your local copy of the code (note that in the
exoplayer2, the equivalent of media3'sPlayerViewisStyledPlayerView.kotya341 commentedon Jul 30, 2024
@oceanjules
could you please reopen our thread, I can't reply on it
This conversation has been locked and limited to collaborators.icbaker commentedon Jul 30, 2024
@kotya341 Looks like @tonihei has unlocked the thread and you should be able to reply - apologies for missing that when I re-opened it.
phcannesson commentedon Jul 30, 2024
Should we also reopen this one or does
1.4.0contain a valid fix ?icbaker commentedon Jul 30, 2024
@phcannesson This issue is fixed in
1.4.0-rc01. If you're experiencing similar problems on that version or later, please open a new issue with details & repro steps.Omkar-Amberkar commentedon Aug 2, 2024
@icbaker how would we be able to replicate your fix when we aren't using the
PlayerViewdirectly but instead use theAspectRatioFrameLayoutandSurfaceViewinside theAndroidView. I have created something similar in compose for our use case as below. let me know if this looks goodicbaker commentedon Aug 5, 2024
Heads up for those subscribed to this thread: We have received a report (#1594) that the workaround we introduced in 30cb762 has introduced a regression in the behaviour of Shared Element Transitions. We are currently investigating this, and will update #1594 when we have more info.
@Omkar-Amberkar Does it work? That's probably the best/first test. In general we don't have the capacity for 1:1 code review, and we are also not the experts in these graphics APIs - so I'm afraid not best placed to debug your integration with them, if you're unable to adapt our published workaround to your needs.
Omkar-Amberkar commentedon Aug 5, 2024
@icbaker yes it does but wanted to check in with you guys to see if that seems correct when using compose.
efemoney commentedon Aug 9, 2024
@Omkar-Amberkar it is correct. It does the exact same thing. I have the same workaround in my code.
icbaker commentedon Sep 4, 2024
I'm afraid that due to the unintended side-effects of the workaround reported in #1594 (for non-Compose use-cases), I've had to make the workaround opt-in (rather than automatically enabled) in 87bd9ba.
This means that those of you using
PlayerViewinsideAndroidViewwill need to callplayerView.setEnableComposeSurfaceSyncWorkaround(true)to enable the workaround. This change will probably go live in1.5.0-beta01.Make `PlayerView` Compose workaround opt-in