Skip to content

[video_player] Seek to live edge #9181

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

mx1up
Copy link

@mx1up mx1up commented Apr 30, 2025

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

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

@flutter-dashboard
Copy link

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.

@stuartmorgan-g
Copy link
Contributor

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?

@mx1up
Copy link
Author

mx1up commented May 3, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[video_player] Add seekToDefaultPosition to api
2 participants