packages icon indicating copy to clipboard operation
packages copied to clipboard

[video_player] Seek to live edge

Open mx1up opened this issue 7 months ago • 5 comments

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.

[^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.

mx1up avatar Apr 30 '25 20:04 mx1up

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.

flutter-dashboard[bot] avatar Apr 30 '25 20:04 flutter-dashboard[bot]

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?

stuartmorgan-g avatar May 02 '25 15:05 stuartmorgan-g

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.

mx1up avatar May 03 '25 17:05 mx1up

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?

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.

stuartmorgan-g avatar Jun 03 '25 19:06 stuartmorgan-g

From triage: @mx1up Are you planning on updating the issue with use case details, so we can figure out how to move forward here?

stuartmorgan-g avatar Jun 24 '25 18:06 stuartmorgan-g

hi @stuartmorgan-g , sorry for the delay, i was on vacation. I will update the issue

Edit: issue updated

mx1up avatar Jun 26 '25 13:06 mx1up

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.

stuartmorgan-g avatar Jul 29 '25 18:07 stuartmorgan-g

@mx1up Are you still planning on moving forward with the renamed version?

stuartmorgan-g avatar Aug 19 '25 18:08 stuartmorgan-g

@stuartmorgan-g yes, ok. to be clear: you'd like me to rename the method from seekToDefaultPosition to seekToLiveEdge?

mx1up avatar Aug 23 '25 18:08 mx1up

Yes, a seekToLiveEdge method has a clearly describable behavior that can apply to other player implementations, so is something we can add.

stuartmorgan-g avatar Aug 27 '25 17:08 stuartmorgan-g

ok, i will make the change

mx1up avatar Aug 29 '25 09:08 mx1up

From triage: Are you still planning on updating this PR based on the discussion above?

stuartmorgan-g avatar Oct 14 '25 18:10 stuartmorgan-g

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!

stuartmorgan-g avatar Nov 18 '25 16:11 stuartmorgan-g

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.

mx1up avatar Nov 18 '25 16:11 mx1up