yeatse / KingfisherWebP

Elegantly handle WebP format with Kingfisher.
MIT License
306 stars 73 forks source link

unusual animating #39

Closed iTofu closed 1 year ago

iTofu commented 4 years ago

Hi, I have a problem, I try to using a webp image, but it plays very slowly. It happends when I using KingfisherWebP, it works fine on Chrome brower. So could you please take a look at it for me? Thanks:)

This WebP file: test.webp.zip

iTofu commented 4 years ago

目前发现当 WebP 带类似空白帧的间隔时,稳定出现。大概是:

(△:帧)
△1-----△2------------------------△3

△1:动画开始
△2:动画结束
△3:空白动作,以实现间隔效果

这种效果的 WebP 使用 KingfisherWebP 显示异常,而 SDWebImage 和 Chrome 显示正常。猜测应该是解码那块有点问题?

yeatse commented 4 years ago

Due to the limitations of Kingfisher itself, the frame duration of a third party animated image can only be equally divided. But we are still working on to solve it. Any PR is also welcome.

dreampiggy commented 3 years ago

Learn hack code from SDWebImage for suck UIImage animation design:

https://github.com/SDWebImage/SDWebImage/blob/master/SDWebImage/Core/SDImageCoderHelper.m#L59

Tip: Repeat specify frames multiple times to make duration works. Calculate the Greatest common divisor to solve the issue.

But to say, it's bad on performance. Kingfisher should better provide the generic version of that GIFAnimatedImage class. Like SDWebImage's advanced custom Animated Image Class featurfe here: https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50