[video_player] Added setMaxVideoResolution to disambiguate over different video stream resolutions#6230
[video_player] Added setMaxVideoResolution to disambiguate over different video stream resolutions#6230AngeloAvv wants to merge 17 commits intoflutter:mainfrom
Conversation
Fixed analysis for master channel Fixed unit tests due do mismatching import
stuartmorgan-g
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
It looks like this only has tests that the new parameters are passed all the way through to the native code, but no tests that the native code actually does the correct things with them. We'll need test coverage of that in order to proceed with this PR, since that's the core of the functionality.
| this.playbackSpeed = 1.0, | ||
| this.rotationCorrection = 0, | ||
| this.errorDescription, | ||
| this.maxVideoResolution, |
There was a problem hiding this comment.
Do we actually need this to be part of the state stream?
There was a problem hiding this comment.
If I remove it, we should only rely on setMaxVideoResolution method to set the value. Plus, we won't be able to access to this information since we will need to remove it from the toString() method.
WDYT?
packages/video_player/video_player_android/android/gradle/wrapper/gradle-wrapper.properties
Show resolved
Hide resolved
# Conflicts: # packages/video_player/video_player_android/CHANGELOG.md # packages/video_player/video_player_android/pubspec.yaml
# Conflicts: # packages/video_player/video_player_android/CHANGELOG.md # packages/video_player/video_player_android/pubspec.yaml
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
# Conflicts: # packages/video_player/video_player/CHANGELOG.md # packages/video_player/video_player_android/CHANGELOG.md # packages/video_player/video_player_avfoundation/CHANGELOG.md # packages/video_player/video_player_platform_interface/CHANGELOG.md
|
Hey @stuartmorgan, I added tests on both sides: Android and iOS native! Let me know if it's ok |
# Conflicts: # packages/video_player/video_player/CHANGELOG.md # packages/video_player/video_player_android/CHANGELOG.md # packages/video_player/video_player_avfoundation/CHANGELOG.md # packages/video_player/video_player_platform_interface/CHANGELOG.md # packages/video_player/video_player_platform_interface/lib/messages.g.dart # packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart # packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart # packages/video_player/video_player_platform_interface/pigeons/messages.dart # packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart # packages/video_player/video_player_platform_interface/test/test.dart
|
Hey @stuartmorgan , do we have an ETA for this PR? I need to understand if this feature will ever land in production. |
hellohuanlin
left a comment
There was a problem hiding this comment.
The iOS part looks good. But android folks (maybe @camsim99?) may want to take a look as well.
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
| - (instancetype)init NS_UNAVAILABLE; | ||
| + (instancetype)makeWithTextureId:(NSNumber *)textureId | ||
| width:(NSNumber *)width | ||
| height:(NSNumber *)height; |
There was a problem hiding this comment.
it's recommended to do alloc/init explicitly instead of combining them.
There was a problem hiding this comment.
This is Pigeon-generated code; I filed a bug a while ago about it being non-idiomatic.
camsim99
left a comment
There was a problem hiding this comment.
Left some comments on the Android side :)
| path: ../ | ||
| video_player_platform_interface: ">=4.2.0 <6.0.0" | ||
| video_player_platform_interface: | ||
| path: ../../video_player_platform_interface |
There was a problem hiding this comment.
Was this just for testing?
| sdk: flutter | ||
| video_player_platform_interface: ^5.1.1 | ||
| video_player_platform_interface: | ||
| path: ../video_player_platform_interface |
…deo_player_resolution # Conflicts: # packages/video_player/video_player_android/CHANGELOG.md
# Conflicts: # packages/webview_flutter/webview_flutter_android/test/webview_android_widget_test.mocks.dart
|
@stuartmorgan Could you take a look at this to see if this API is reasonable? |
camsim99
left a comment
There was a problem hiding this comment.
The Android part looks good to me! @stuartmorgan @bparrishMines can one of you take a look at the overall structure?
| /// Sets the max video resolution to a [resolution] value allowing the player | ||
| /// to reproduce lwoer resolution streams. |
There was a problem hiding this comment.
nit: I think the wording on this could be improved. Something like
| /// Sets the max video resolution to a [resolution] value allowing the player | |
| /// to reproduce lwoer resolution streams. | |
| /// Sets the maximum allowed video resolution to [resolution], allowing the | |
| /// player to produce streams below this resolution. |
| /// The video resolution, the number of distinct pixels in each dimension that | ||
| /// can be displayed |
There was a problem hiding this comment.
I think this can be improved as well:
| /// The video resolution, the number of distinct pixels in each dimension that | |
| /// can be displayed | |
| /// The number of distinct pixels in each dimension that can be displayed for | |
| /// a video. |
| # NOTE: We strongly prefer non-breaking changes, even at the expense of a | ||
| # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes | ||
| version: 6.0.0 | ||
| version: 6.0.1 |
There was a problem hiding this comment.
This should be bumped to 6.1.0 since it is adding a new feature.
| // Setting the playback speed on iOS will trigger the video to play. We | ||
| // prevent this from happening by not applying the playback speed until | ||
| // the video is manually played from Flutter. | ||
| if (!value.isPlaying) { |
There was a problem hiding this comment.
Is this check necessary for this method? It looks like it was copied from _applyPlaybackSpeed().
| return; | ||
| } | ||
|
|
||
| // If we haven't set a max video resolution we won't do anything |
There was a problem hiding this comment.
Why is setting a max video resolution ignored if one is not already set? The public method, setMaxVideoResolution, should also contain this information.
| /// Sets the max video resolution of [this]. | ||
| /// | ||
| /// The [resolution] will be used to set a maximum resolution value which will | ||
| /// allow the player to pick a different stream to play |
There was a problem hiding this comment.
nit:
| /// allow the player to pick a different stream to play | |
| /// allow the player to pick a different stream to play. |
| repository: https://github.com/flutter/plugins/tree/main/packages/video_player/video_player | ||
| issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22 | ||
| version: 2.4.7 | ||
| version: 2.4.8 |
There was a problem hiding this comment.
This should be a major version bump since it is adding a feature. (e.g. 2.5.0). Although the exact value may change by the time the PR is ready to land.
ditman
left a comment
There was a problem hiding this comment.
(Please, do revert changes to files that are not relevant to the PR; thanks!)
| class _FakeLostDataResponse_1 extends _i1.Fake | ||
| implements _i2.LostDataResponse {} | ||
| class _FakeLostDataResponse_1 extends _i1.Fake implements _i2.LostDataResponse { | ||
| } |
There was a problem hiding this comment.
Please, revert this file, this pr has nothing to do with the image_picker package.
| class _FakeDownloadListener_0 extends _i1.Fake | ||
| implements _i2.DownloadListener {} | ||
| class _FakeDownloadListener_0 extends _i1.Fake implements _i2.DownloadListener { | ||
| } |
There was a problem hiding this comment.
Please, revert this file, this pr has nothing to do with the webview_flutter package.
|
@AngeloAvv Are you still planning on updating this based on the comments above? |
1 similar comment
|
@AngeloAvv Are you still planning on updating this based on the comments above? |
|
@stuartmorgan @reidbaker sure! I just need to find a spot in the next weeks to address the changes. |
|
We've just completed the migration of the plugin code to the flutter/packages repository, as described in https://flutter.dev/go/flutter-plugins-repo-migration, and this repository is now being archived. Unfortunately that means that all in-progress PRs here must be moved to flutter/packages. Please see our instructions for an explanation of how to move your PR, and if you have any issues moving your PR please don't hesitate to reach out in the #hackers-ecosystem channel in Discord. Our apologies that your PR was caught in this one-time transition. We're aware that it's disruptive in the short term, and appreciate your help in getting us to a better long-term state! |
Since HLS streams can deliver multiple tracks with a single URL, it could be particularly useful to set a maximum video resolution to spare network bandwidth instead of picking the best stream that could also be calculated according to the device network speed.
The main issue:
Related issues:
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.