packages
packages copied to clipboard
[video_player] Seek to live edge
This PR adds the seekToDefaultPosition method:
fixes flutter/flutter#168097
Before adding tests/changelog/etc, I'd like to know if you agree with this change in general 😉
Pre-Review Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene page, which explains my responsibilities.
- [x] I read and followed the relevant style guides and ran the auto-formatter.
- [x] I signed the CLA.
- [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g.
[shared_preferences] - [x] I linked to at least one issue that this PR fixes in the description above.
- [ ] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under[^1]. - [ ] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under[^1]. - [x] I updated/added any relevant documentation (doc comments with
///). - [ ] I added new tests to check the change I am making, or I have commented below to indicate which test exemption this PR falls under[^1].
- [ ] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
[^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.
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.
If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?
Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.
Thanks for the contribution!
Please see https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#platform-support. This is exposing new API at the app-facing package layer, but only implementing it on Android, and there's no discussion of what this would look like on other platforms; it would not be landed as-is.
Have you looked at iOS and web to see what the equivalent functionality is?
Hi @stuartmorgan-g , thanks for the feedback. I have no web or ios programming experience but I gave it a shot. Here are my remarks:
darwin
It seems the current play/pause behavior on macos already is different from android. On Android, playing a live stream automatically jumps to the live edge. When you pause, wait 5 secs, and resume, the video resumes where it left off. On macOS, starting the player on the same url at the same time, I get a whole different picture (and point in time).
My current hypothesis:
when starting to play a livestream on macos it does not automatically seek to the live edge. Instead, it starts playing at the oldest timestamp available. Hence, when you pause the video, wait 5 secs, and resume playing, the player makes a jump in time (5 secs) instead of resuming from where it was paused.
Using the new seekToDefaultPosition functionality, I have the impression it jumps correctly to the live edge. Unfortunately, when pausing and resuming again, it jumps back to the start of the buffer (oldest timestamp).
web
I did not find a sample stream that would decode on web. I kept getting "unsupported format". So I was not able to test the implementation.
conclusion
Unless somebody experienced can jump in and help me out, I think I will have to reduce scope and only add this functionality to android package. If I leave out the changes to the app facing package interface and only add the functionality to video_player_android package, would that get accepted?
BTW, i extended the example to include a HLS live stream.
If I leave out the changes to the app facing package interface and only add the functionality to
video_player_androidpackage, would that get accepted?
I left a comment on the issue; we need to fully understand the problem you want to solve before we start evaluating specific solutions. In general, adding a bunch of bespoke platform-specific wrappers is not what we want to do with most of our plugins.
From triage: @mx1up Are you planning on updating the issue with use case details, so we can figure out how to move forward here?
hi @stuartmorgan-g , sorry for the delay, i was on vacation. I will update the issue
Edit: issue updated
Based on the update to the issue, it sounds like this should be renamed/rescoped to seek to live edge, so that we have a path to implementing it on other platforms.
@mx1up Are you still planning on moving forward with the renamed version?
@stuartmorgan-g yes, ok. to be clear: you'd like me to rename the method from seekToDefaultPosition to seekToLiveEdge?
Yes, a seekToLiveEdge method has a clearly describable behavior that can apply to other player implementations, so is something we can add.
ok, i will make the change
From triage: Are you still planning on updating this PR based on the discussion above?
Thank you for your contribution. Since there are outstanding comments but the PR hasn’t been updated in several months, I’m going to close it so that our PR queue reflects active PRs. Please don't hesitate to submit a new PR if you have the time to address the review comments. Thanks!
hi stuart, yes I understand. I was hoping to find some time but didn't manage :/ I might come back to it when I release a new version of the app using this feature.