-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[video_player] Fix aspect ratio #690
[video_player] Fix aspect ratio #690
Conversation
…ssible values are: 0, 90, 180 and 270. * Updated the aspectRatio getter to use the video rotation. * Fixed the aspect ratio of videos in the video_player plugin example. It now properly displays 'rotated' videos.
…ratio in image_picker
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
…_player plugin on iOS devices. The fix sets the videoComposition of the respective AVPlayerItem to use the preferredTransform of the video (the rotation matrix for the video)
…_player plugin on iOS devices. The fix sets the videoComposition of the respective AVPlayerItem to use the preferredTransform of the video (the rotation matrix for the video)
…tion in Android (possibly happening in iOS too)
…deo is in portratit mode then height > width
…e. Plus remove extra sendInitialized call - Add support for playing PHAssets from localIdentifier. Currently used from flutter like File('phasset://LOCAL_IDENTIFIER')
…ot have the tx and ty values populated, which in turn renders black videos. We work around this by settings the tx and ty values ourselves
…added on a different branch (phAsset)
Apologies for the delay in getting to this PR. We're slowly making our way through. I'll take a look at this in the next few days. Thanks for your contribution! |
Thanks @cbracken! Looking forward to your review. |
@mnazim You can meanwhile use this like so I just tried that and worked perfectly!
|
What is going on with |
Any updates on this? |
@recastrodiaz I was testing network videos with this PR and I run into this error, I understand that this only fixes file videos, but I think it should still at least display network videos correctly.
The offending line seems to be 245 in video_player which has
Any clues on why this would be happening ? my pubspec.yml:
|
@uiboy
|
@recastrodiaz oops my bad, yes that seems to work. Thanks for your response. Happy Holidays! |
@recastrodiaz
But error saying
Any idea? |
@uiboy Could you share your |
@Tj543 I have this in my pubspec.yml (0.8.0) , maybe that is why it doesnt work for you.
|
- addListener is not required to render the first video frame - call setState() on play/pause to update the UI - dispose() the controller when the widget is disposed - fix video urls
Can you merge this in with master to get CI doing what it needs to? Sorry for the delay again. We haven't lost track of this (completely)! |
packages/video_player/README.md
Outdated
_controller.value.isPlaying | ||
? _controller.pause() | ||
: _controller.play(); | ||
setState(() {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we calling setState empty here? Can we either move the lines above this to the closure for setState, or comment on the unusual use of setState here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll move them inside the setState. We need setState as otherwise the play/pause button UI does not get updated.
packages/video_player/pubspec.yaml
Outdated
@@ -2,7 +2,7 @@ name: video_player | |||
description: Flutter plugin for displaying inline video with other Flutter | |||
widgets on Android and iOS. | |||
author: Flutter Team <flutter-dev@googlegroups.com> | |||
version: 0.8.0 | |||
version: 0.8.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a 0.9.0 bump? Could we end up surprising anyone with this change if they had some other work around in place to handle it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Updated to 0.9.0
Just a couple small things and a merge (or rebase) needed, and this should be good to go. |
- Move play/pause logic within setState closure in video_player example
@dnfield Thanks for looking at this again! Very much appreciated! Any other issues please let me know. |
LGTM |
Hey @recastrodiaz , the version 0.9.0 is not here: https://pub.dartlang.org/packages/video_player#-versions-tab- ? |
The latest version on pub should have this change. Looks like no one ever published 0.9.0 but we can fix that. |
@mklim has taken care of this - 0.9.0 is now available on pub. See flutter/flutter#27258 - we're working on making sure these don't get missed in the future. |
* * Added access to the video rotation in degrees (rotationDegrees). Possible values are: 0, 90, 180 and 270. * Updated the aspectRatio getter to use the video rotation. * Fixed the aspect ratio of videos in the video_player plugin example. It now properly displays 'rotated' videos. * Ensure videos are not upside down nor streteched when using the video_player plugin on iOS devices. The fix sets the videoComposition of the respective AVPlayerItem to use the preferredTransform of the video (the rotation matrix for the video) * - Bump video_player version to 0.9.0 - Move play/pause logic within setState closure in video_player example
This reverts commit 1da1ae5.
This PR adds a
rotationDegrees
field to theVideoPlayerValue
class and fixes theaspectRatio
field so it takes the rotation of the video into account. This ensures that videos are properly displayed when wrapped with anAspectRatio
Widget. (Currently portrait videos look squashed).Test Methodology:
cd packages/image_picker/example && flutter run
)This PR fixes flutter/flutter#17606.