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
[video_player_android] Correct rotation of videos recorded by the camera (#7846)
Hopefully � corrects the calculation used to determine the rotation correction of the video being played. These are the different cases this addresses:
1. **Strictly below Android API 22:** Kept this calculation the same as before because I was not able to test it. For context, it uses an unapplied rotation degrees reported by the video's size to correct the rotation. Note that this is always 0 after Android API 22+ (see [its docs](https://github.com/google/ExoPlayer/blob/dd430f7053a1a3958deea3ead6a0565150c06bfc/library/common/src/main/java/com/google/android/exoplayer2/video/VideoSize.java#L65))
2. **Above Android API 22, strictly below Android API 29:** The `SurfaceTexture` Impeller backend is used. From my testing, I see the preview is correctly rotated and sized without any further intervention, so the correction is set 0.
3. **Android API 29+:** The `ImageReader` Impelled backend is used and a preview correction was noticed by the community (see flutter/flutter#154696). To fix this, we now use the rotation correction reported by the video's format. We also now use this rotation to make the fix for a swapped = width and height when the correction is 90 or 270 degrees (indicating that the video is landscape) as the logic did before but instead with the unapplied rotation degrees (see case 1 for context).
Tested this on Android APIs 28, 30, 32, and 35.
A fix attempt for flutter/flutter#154696.
Copy file name to clipboardExpand all lines: packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/ExoPlayerEventListener.java
Copy file name to clipboardExpand all lines: packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/ExoPlayerEventListenerTest.java
0 commit comments