Skip to content
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

Fix playback speed on non-60hz displays #180

Merged
merged 1 commit into from
Dec 23, 2022

Conversation

donmai-me
Copy link
Contributor

Fixes #170 and brings back tvOS support. This is a band aid solution to the problem as the playback speed gets slow when my iPad pro is on low power mode.

Fix fast playback speed on promotion displays
@alexiscreuzot
Copy link
Owner

Interesting, I'm thinking there's probably a way to detect this state change. Anyway good work, I'm merging your PR

@alexiscreuzot alexiscreuzot merged commit 2167bec into alexiscreuzot:master Dec 23, 2022
@donmai-me
Copy link
Contributor Author

donmai-me commented Dec 24, 2022

Best I can think of is using the display link's targetTimestamp and timestamp to get the current display framerate. Like

let actualFramesPerSecond = 1 / (displaylink.targetTimestamp - displaylink.timestamp)

For macOS:

// WARNING: This is divide-by-zero if the display is not available
let actualFramesPerSecond = 1 / CVDisplayLinkGetActualOutputVideoRefreshPeriod(displaylink)

SwiftyGifManager already uses the appropriate display link on macOS and iOS for its timer. Maybe it can also be used to get the current framerate.

@rjvir
Copy link

rjvir commented May 19, 2023

It seems like this change regressed GIF playback on my app.

For some reason, all GIFs play super slow on 120hz iPhones (e.g. 14 pro max).

I had to downgrade to 5.4.3 to fix it.

@igor2890
Copy link

It seems like this change regressed GIF playback on my app.

For some reason, all GIFs play super slow on 120hz iPhones (e.g. 14 pro max).

I had to downgrade to 5.4.3 to fix it.

I confirm, faced the same problem

@alexiscreuzot
Copy link
Owner

Reverted this commit, but seem to cause other issues

@donmai-me
Copy link
Contributor Author

Hi! Like I said above this is a bandaid fix. The correct solution would be something like I proposed above; to use the appropriate display link to get the current framerate rather than hardcoding framerates.

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

Successfully merging this pull request may close these issues.

Issues with M1 ipad Pro with playback speed
4 participants