Skip to content

feat(Android): Implement refresh rate matching for native player#997

Open
TwoToneEddy wants to merge 5 commits into
DonutWare:developfrom
TwoToneEddy:match-fr
Open

feat(Android): Implement refresh rate matching for native player#997
TwoToneEddy wants to merge 5 commits into
DonutWare:developfrom
TwoToneEddy:match-fr

Conversation

@TwoToneEddy

Copy link
Copy Markdown

Pull Request Description

Ports refresh rate matching from the native Android TV client to Fladder's native player backend on Android. When a video begins playing, the display refresh rate is switched to match the video's frame rate using Surface.setFrameRate() / Window preferred display mode. Playback pauses during the mode switch and resumes automatically once the display has settled. A toggle to enable/disable the feature is added to player settings.

Also fixes a visual artifact on player exit where the video texture was released mid-frame during the pop animation, causing the top-left quadrant of the video to flash briefly in the bottom-right of the UI. closePlayer() now awaits endOfFrame before navigating so the widget tree can rebuild and cleanly detach the texture first.

Tested On

  • Android
  • Android TV
  • iOS
  • Linux
  • Windows
  • macOS
  • Web

Checklist

  • If a new package was added, did you ensure it works for all supported platforms? Is the package well maintained
  • Check that any changes are related to the issue at hand.

@PartyDonut PartyDonut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for implementing this, looks good and seems to work.

I will admit not sure if I should see a visual change on TV but that might just be a me problem.

If you could re-base as well that would be great 👍

Comment thread android/gradle.properties Outdated
@TwoToneEddy

Copy link
Copy Markdown
Author

Thanks for taking a look. I have since added a soundbar to my system which passes through the HDMI. Since using this rather than direct to the TV I am noticing some issues with what I believe to be handshaking. I will investigate this over the next week an hopefully fix, along with your suggestion. Thanks

@TwoToneEddy

Copy link
Copy Markdown
Author

Seems to work reliably now with my soundbar so OK to merge once we sort those conflicts

TwoToneEddy and others added 5 commits June 12, 2026 13:47
The video texture was being released while still visible during the
pop animation. closePlayer() now awaits endOfFrame before navigating
so the widget tree can rebuild first, and the video widget hides
itself when VideoPlayerState.disposed is set.
Resetting the refresh rate fire-and-forget in onDestroy raced the
activity teardown: the HDMI link retrained while the surface was being
destroyed, which could black out pass-through soundbar/AVR chains until
a power cycle.

applyRefreshRate now returns the previous mode id, and finish() is
overridden to switch back to that mode and wait for the change to
settle (display listener + non-seamless delay) while the window is
still alive, only then completing the finish. onDestroy keeps a
fire-and-forget reset as a fallback.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
android.builtInKotlin and android.newDsl were inserted by a newer
Flutter checkout's migrator before the project was built with the
pinned 3.35.7, which doesn't reference them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@TwoToneEddy

Copy link
Copy Markdown
Author

OK i've done a rebase, everything seems to build and work still. Hopefully this is all OK

@PartyDonut PartyDonut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me thanks for implementing this. You do seem to have claude co-authored in the 2 latest commits. While I don't mind using AI, the co-authoring label is something I would like to prevent. If you could clean that up that would be great.

@PartyDonut PartyDonut changed the title Implement refresh rate matching for native player feat(Android): Implement refresh rate matching for native player Jun 14, 2026
@PartyDonut PartyDonut added the feature New feature or request label Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants