Skip to content

[video_player_android] Fix incorrect dimensions swap #9199

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

Merged
merged 7 commits into from
May 19, 2025

Conversation

marvin-kolja
Copy link
Contributor

@marvin-kolja marvin-kolja commented May 4, 2025

Fixes flutter/flutter#166097

List which issues are fixed by this PR. You must list at least one issue.

Manual Testing Overview

  • Android API <= 21
  • Android API >= 29
API Device Video requires rotation Works w/o fix Works w/ fix Ref
35 Emulator yes no yes #9199 (comment) by @marvin-kolja
34 Pixel Tablet no no yes #9199 (comment) by @camsim99
34 Pixel Tablet yes no yes @camsim99
33 Samsung A71 ? ? yes #9199 (comment) by @PaulineMoovency
32 Pixel 3A yes no yes @camsim99
27 Samsung Galaxy J7 yes yes yes @camsim99

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

…270 rotation

Since flutter#6535 `VideoSize` is used to get width and height instead of getting them from the video `Format`. My testing concluded that `VideoSize` dimension values are post rotation and do not need to be swapped when there is a 90 or 270 degree rotation present.
@marvin-kolja
Copy link
Contributor Author

marvin-kolja commented May 4, 2025

Tested changes on an emulator using Android 15 (API 35):

Texture View before changes

before_texture_view

Texture View after changes

after_texture_view

Video Used
RedApple.MOV

@camsim99
Copy link
Contributor

camsim99 commented May 5, 2025

Just an FYI that I'm working on #9107, which will change the API >= 29 check (that gates the usage of Formats) to be more accurate. I'm not sure if it impacts this change, but it's just something to be aware of.

@camsim99
Copy link
Contributor

camsim99 commented May 5, 2025

Just tested out a Pixel Tablet running API 34 (handles crop and rotation automatically) and it appears to work on the main branch and in this PR (with the videos provided in the example app--not sure if this makes a difference). Will do more testing on physical devices.

return RotatedBox(
quarterTurns: rotation ~/ 90,
child: child,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just to mirror the changes that were done in #8685 to the _VideoPlayerWithRotation of the main video_player package.

I can revert that change if it doesn't make sense in this PR...But the example is broken otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok this definitely needs to be fixed then. Can you mention this change in the CHANGELOG?

@marvin-kolja
Copy link
Contributor Author

Just an FYI that I'm working on #9107, which will change the API >= 29 check (that gates the usage of Formats) to be more accurate. I'm not sure if it impacts this change, but it's just something to be aware of.

Thanks for bringing that up. I also thought about that, but I don't see any reason for conflict.

@marvin-kolja
Copy link
Contributor Author

Just tested out a Pixel Tablet running API 34 (handles crop and rotation automatically) and it appears to work on the main branch and in this PR (with the videos provided in the example app--not sure if this makes a difference). Will do more testing on physical devices.

Appreciate it! They will definitely reflect if this PR messed anything up with videos that do not need a rotation, but I don't think any of the example videos require rotation to begin with. Maybe we can add a new video that would meet that requirement?

@PaulineMoovency
Copy link

I just tested on API 33, on a Samsung A71, and the issue is resolved with your fix! Thank you so much!

@marvin-kolja
Copy link
Contributor Author

I just tested on API 33, on a Samsung A71, and the issue is resolved with your fix! Thank you so much!

Thank you! Just to make sure, you tried with a video that requires rotation?

@camsim99 camsim99 self-requested a review May 12, 2025 15:52
@camsim99
Copy link
Contributor

camsim99 commented May 12, 2025

Did some more testing (with your apple video) and updated the table in the PR description! Also tested on main to see if I could see the difference and I did 👍 change seems to work for me!

Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM! You'll need to fix the CHANGELOG merge conflict though. Thanks for taking on this issue!

return RotatedBox(
quarterTurns: rotation ~/ 90,
child: child,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok this definitely needs to be fixed then. Can you mention this change in the CHANGELOG?

@camsim99 camsim99 requested a review from bparrishMines May 12, 2025 20:47
@marvin-kolja
Copy link
Contributor Author

marvin-kolja commented May 13, 2025

Changes LGTM! You'll need to fix the CHANGELOG merge conflict though. Thanks for taking on this issue!

Will do the changes.
Sure thing. It has been fun to work on this :D

Did some more testing (with your apple video) and updated the table in the PR description! Also tested on main to see if I could see the difference and I did 👍 change seems to work for me!

Very nice. That's a good amount of testing, cheers!

@marvin-kolja
Copy link
Contributor Author

Alright, I've resolved the conflicts and added the example app fix to the CHANGELOG. Thanks for your attentive support on this issue!

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@camsim99 camsim99 added the autosubmit Merge PR when tree becomes green via auto submit App label May 19, 2025
@auto-submit auto-submit bot merged commit f444a1e into flutter:main May 19, 2025
82 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: video_player platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[video_player_android] Expose correct AspectRatio with rotationCorrection into consideration
4 participants