Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Gif plays slower than original (30 fps) #65

Open
MARS1 opened this issue Oct 25, 2017 · 4 comments
Open

Gif plays slower than original (30 fps) #65

MARS1 opened this issue Oct 25, 2017 · 4 comments

Comments

@MARS1
Copy link

MARS1 commented Oct 25, 2017

I know I'm doing something wrong but don't know what.

I have a gif spinner at 30fps, but it plays about half as slow as the gif.

Does anyone have this issue?

Here is the original gif, but when played on the device it's slower

loader

When played on device:

https://goo.gl/xp9ZBb

@seunghee2
Copy link

Hi there, I've got the same issue too. When I load my gif file, it was looked twice as slow as the original. so I tried like the below code, it's working well for me 😀

let animatedImage = UIImage.gif(name: "FILE_NAME")
let imageView = UIImageView(...)
imageView.animationImages = animatedImage?.images
imageView.animationDuration = (animatedImage?.duration)! / 2
imageView.startAnimating()

@xAlien95
Copy link

Probably your GIF image frames have delays less than 0.1 and currently SwiftGif prevents this. To solve, comment these lines in UIImage+Gif.swift:

https://github.com/bahlo/SwiftGif/blob/d26325392aefe7822dea79a757d4e300c694d010/SwiftGifCommon/UIImage%2BGif.swift#L94-L96

@kublaios
Copy link

Solution of @xAlien95 worked for me but it's better if we don't need to edit a pod's source. Maybe make this optional, like an additional parameter like a fixDelayIfNeeded which is true by default?

kublaios added a commit to kubilaye/SwiftGif that referenced this issue Apr 20, 2018
@yzhong52
Copy link

yzhong52 commented Jan 3, 2019

@bahlo Is it possible to make a new release from the master? And then we can close this since it includes a fix for this: #55.

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

No branches or pull requests

5 participants