androidx / androidx/media

Advise on setting display framerate to match video (in jetpack/kotlin context)?

Open
#2,602 0 comments 0 reactions 1 assignee View on GitHub

@microkatz is already working on this.

Since Jul 14, 2025.

needs triage question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Hi,

I'm hacking a lot on NextPlayer to support my own custom way of sharing a video. I can get much of it working but i'm just massively stuck when it comes to frame rate control.

I did disable setVideoChangeFrameRateStrategy.

As the docs describe, i probably want to have CHANGE_FRAME_RATE_ALWAYS for video. The conceptual idea to do this is simple. Get the FPS from your video and set that on the surface with the setFrameRate function. Easy, right?..

Not so much. This is the code context i'm in and i'm having serious issues wrapping my head around how to do this. To make it more to the point in terms of questions:

  1. Where exactly does it make sense in the ExoPlayer API functions to change the surface framerate? I'm thinking as soon as anything gets rendered would be a good time. Hence onRenderedFirstFrame.
  2. But within that scope, how do you get the FPS from a current video?
  3. And how do you even get the surface from that scope?

I'm sorry if these questions seem beginner/n00b questions. I thought so too. But based on the many hours wasted on this (including AI help), it apparently just doesn't trigger for me just yet.

Thank you for any help you can provide!
Mark

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.