Open cassidyjames opened 1 year ago
The app delegates the playback of gifs to the system — in particular the new ImageDecoder API and whatever kind of drawable it uses internally on modern system versions. I will look into it but I'm almost sure that this particular gif file is to blame for breaking the format spec in some way.
Do other gifs play at the right speed for you?
It is also very fast on my Pixel 4a, which only does 60 Hz
That's some strange gif file. Frame delays are set to 0: This is what a correctly-timed animation looks like (hi Sam): The "delay time" field in the offending gif is set to 0 for all frames, which matches what Photoshop shows:
The GIF format specification says:
vii) Delay Time - If not 0, this field specifies the number of hundredths (1/100) of a second to wait before continuing with the processing of the Data Stream. The clock starts ticking immediately after the graphic is rendered. This field may be used in conjunction with the User Input Flag field.
I interpret this as "if it is 0, then the behavior is not defined". Some implementations (browsers and iOS) use some default delay value. Some interpret it as "literally no delay, show the next frame as quickly as possible".
I could hack something into my image loader to patch such gifs to have some sane frame delay value before handing them over to rest of the app, but that feels like too much of a workaround for something that happens so rarely and isn't even specified anywhere.
Here is another example of a headache-inducing GIF in the app that plays as expected in the browser: https://norden.social/@dirksen
Interestingly, it plays at the same speed in the native GitHub Android app and the native Google Photos Android app as in the browser.
The GIF avatar at https://hachyderm.io/@bazzargh plays extraordinarily fast in the Android app, to the point where it was making me nauseous. On the web, it plays at the expected framerate.
I'm on a Pixel 7 with a 90 Hz display if that's relevant.
Here’s a video, but unfortunately it doesn’t show quite how fast it actually looks on my screen thanks to YouTube’s re-encoding: https://youtube.com/shorts/9WQhSpWTTBYDirect link: https://cassidyjames.com/videos/mastodon-android-gif.mp4