Flipboard/FLAnimatedImage

gif is slower than original one

Opened this issue · 16 comments

Hello,

The gif plays slower than real one in iOS 10:

loader

what's the problem and how could I solve it?

Remove the following line 299 from FLAnimatedImageView.m and the 3 lines above it:

self.displayLink.frameInterval = MAX([self frameDelayGreatestCommonDivisor] * kDisplayRefreshRate, 1);

Then change line 385 from:
self.accumulator += displayLink.duration * displayLink.frameInterval;
to
self.accumulator += displayLink.duration;

And change line 412 from:
[self.debug_delegate debug_animatedImageView:self waitingForFrame:self.currentFrameIndex duration:(NSTimeInterval)displayLink.duration * displayLink.frameInterval];
to
[self.debug_delegate debug_animatedImageView:self waitingForFrame:self.currentFrameIndex duration:(NSTimeInterval)displayLink.duration];

frameInterval has been deprecated in iOS 10 and the compiler will suggest that you use preferredFramesPerSecond instead which I did automatically. However, that doesn't plug straight into FLAnimatedImageView.m in a like for like manner. All of my gif animations slowed down to a crawl.

The preferredFramesPerSecond property has a default value of 0, which uses the native cadence of the display hardware. So, the best approach I have found is to remove both the frameInterval and preferredFramesPerSecond from the code and allow the ImageView to animate at the native speed of the hardware.

@knagle thanks for your answer, but the problem hasn't been solved yet

Hey I am also facing this issue. Did anyone solve this?

@raphaelschaad My gif animation is 3 seconds but FLAnimated takes around 10-13 seconds to finish one loop (with the dynamic-memory-category branch). The animation is pretty heavy but I feel that shouldn't affect the gifs speed. Can you give any inputs regarding this?

@novinfard @kpavankotesh I had the same issue when testing app on Simulator. When I executed it on real device, GIF animation work fine. You can run test (on simulator & real device) to check displayLink properties:
https://github.com/6david9/CADisplayLinkTest

I am also facing the same issue on the real device.

I am also facing the same issue on the real device・・・

bawn commented

+1

+1

+1 tried it on both real device and using simulators

+1 I am alse facing the same issue on the raal device!

+1 有人解决了吗

+1

okvv commented

same over here...
simulator + real device play GIF slow.
GIF works fine on desktop and android
(tried the above-mentioned solutions)

also facing this issue
has anyone found a workaround?

@EsquilliDev your issue reference is also the answer above #161 (comment)
I haven't found a solution for this.
Anyone please HELP!

Had the exact same issue. Couldn't find a way to make my GIF play properly with this FLAnimatedImage library. I decided to upload my gif on the GIPHY app to see how it would display over there. To my surprise, it worked perfectly. Did some research and found out the library they're using for GIFs playbacks.

GIPHY is using the YYImage pod, tried it and fixed my problem completely! So then, I removed FLAnimatedImage from my dependencies.