Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@gabrielgarciagava
Copy link

@gabrielgarciagava gabrielgarciagava commented Feb 12, 2023

This PR updates the pigeon version that is being used by video_player_avfoundation so it is possible to use [AVPlayer seekTo:completionHandler:] method.

Potentially fixes https://github.com/flutter/flutter/issues/116056 ( Maybe I need some insights from you @stuartmorgan, specially related to this comment flutter/flutter#116056 (comment) )

This PR follows the step 1 of these instructions https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

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

@gabrielgarciagava gabrielgarciagava changed the title Make video player avfoundation seek to async [video_player] Make video player avfoundation seek to async Feb 12, 2023
Created a single commit for the pigeon upgrade so it is easier to read the second commit
where changes to `message.dart` will be done
@gabrielgarciagava gabrielgarciagava force-pushed the make-video-player-avfoundation-seekTo-async branch from 6c8d1c7 to 3da6bfe Compare February 12, 2023 21:44
@gabrielgarciagava gabrielgarciagava changed the title [video_player] Make video player avfoundation seek to async [video_player] Make video player avfoundation seekTo async Feb 12, 2023
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! I've left a few comments, and you'll need to fix the unit tests that no longer compile (per the CI failure).

This won't fix the issue you referenced, which is about how position is tracked in the plugin. It doesn't actually have anything to do with the implementation of seekTo.

@gabrielgarciagava
Copy link
Author

Thanks for the contribution! I've left a few comments, and you'll need to fix the unit tests that no longer compile (per the CI failure).

This won't fix the issue you referenced, which is about how position is tracked in the plugin. It doesn't actually have anything to do with the implementation of seekTo.

Thank you for the feedback. Since this is my first contribution, I really appreaciate it.

I will fix all tests. Now, about the github issue. Is it really required to have a issues linked to the PR? If that is the case, I will create one since I could not find any existent one related to this.

@gabrielgarciagava gabrielgarciagava force-pushed the make-video-player-avfoundation-seekTo-async branch 2 times, most recently from f62985d to b88b372 Compare February 13, 2023 13:19
@gabrielgarciagava gabrielgarciagava force-pushed the make-video-player-avfoundation-seekTo-async branch from b88b372 to 8eede17 Compare February 13, 2023 13:25
@stuartmorgan-g
Copy link
Contributor

Now, about the github issue. Is it really required to have a issues linked to the PR?

Since it's addressing a to-do that didn't have an associated issue it doesn't need one.

@gabrielgarciagava gabrielgarciagava requested review from stuartmorgan-g and removed request for hellohuanlin and tarrinneal February 13, 2023 13:41
@gabrielgarciagava
Copy link
Author

gabrielgarciagava commented Feb 13, 2023

All threads resolved.

Please check https://github.com/flutter/plugins/pull/7164/files#diff-ad57f5cf3efac84f7c3c41b77bd4b391d0a37e0f488309dfcf15b08423c71ae8 with care.

I updated that test to be able to properly seek to some part of a video.
I'm also testing that the player position is correct after the seek. So should the test be renamed?

completionHandler:^(BOOL finished) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.registry textureFrameAvailable:input.textureId.intValue];
completion(nil);
Copy link
Contributor

Choose a reason for hiding this comment

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

may wanna pass finished to dart side?

Copy link
Author

Choose a reason for hiding this comment

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

It is possible, however that would require an interface change, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

isn't changing from sync to async already an interface change? I think the question here is, if it's not finished, what do we expect UI to behave?

Copy link
Author

@gabrielgarciagava gabrielgarciagava Feb 13, 2023

Choose a reason for hiding this comment

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

It is not an interface change because the method channel calls are always async by its nature, right?

According to the documentation of AVPlayer, finished as true means that the seekTo completed properly, while finished as false means that seekTo was aborted because of another seekTo request. So in both cases it means the seekTo is not happening anymore. I agree it can be an useful information though, but I tried to go with a slightly simpler improvement as my first contribution :D

I can implement the interface change if needed, of course. Let me know.

Copy link
Author

Choose a reason for hiding this comment

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

When I say that it will require an interface change, I'm saying I will need to touch all packages, the app facing, the platform interface, and the platform implementations. While the current PR only require a change in the avfoundation one.

Copy link
Contributor

Choose a reason for hiding this comment

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

In theory we could pass it to the Dart side (changing the Pigeon interface definition) and then drop it here, which would still be an implementation-package-local change. I don't think there's much value in doing that since we have no plans to use that information, but @hellohuanlin if you feel strongly about adding it, it would be easy enough to do.

This PR definitely should not become a breaking change to the public seek API.

Copy link
Contributor

Choose a reason for hiding this comment

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

gotcha. i don't have an strong opinion. I just wanted to make sure the UI can revert back to the original position if finished is false. Sounds like we don't need this flag to achieve this.

Copy link
Contributor

Choose a reason for hiding this comment

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

In general, the position handling in video_player is not great right now; it can get out of sync with native for short periods quite easily, and is primary polling based. It needs an overhaul, and there are issues tracking that, but it's way out of scope here.

Copy link
Author

Choose a reason for hiding this comment

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

In this case, if I may ask, what are the following steps I need to take now?
I see that "submit-queue" is still failling, but I could not find out what that means.

Copy link
Contributor

Choose a reason for hiding this comment

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

submit-queue means the tree is closed, and isn't related to the PR; you don't need to worry about it.

@stuartmorgan-g
Copy link
Contributor

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!

@gabrielgarciagava
Copy link
Author

No problem at all. I am completly in favor of any kind of long term improvements.

I will reopen it in the flutter/packages channel as soon as I find time to work on it.

Thanks for the feedback.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants