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: make multi frame image can replay. #685

Merged
merged 15 commits into from
Sep 16, 2021

Conversation

wssgcg1213
Copy link
Member

@wssgcg1213 wssgcg1213 commented Sep 15, 2021

Close #664

  • Flutter 默认会缓存 ImageStreamCompleter,多帧图片使用的 MultiFrameImageStreamCompleter 保存了动图的播放状态 (经过的时间、帧数等) ,所以在二次加载图片的时候, 会命中缓存的同时保持原先的播放状态, 这与 Web 下的表现不一致
  • 根据 Load gif animation multiple times, not play from the first frame flutter/flutter#51775 在 detach renderer 的时候踢出对应缓存,这样做的副作用是重复加载图片的时候会重新走一次加载过程 (网络/本地/...)
    • 不过 Kraken 上个月实现 HttpCache 能力后,对于允许命中 HTTP 缓存的图片会命中此缓存,所以并不会再次发送网络请求
    • 对于 HTTP Header 中未声明 CacheControl 或 expires 的,再次发送网络请求也符合逻辑
  • 这个 PR 顺便解决了 Kraken 加载大量图片不会自动释放图片缓存占用的内存的问题 (ImageCache max size 默认 1000)

@wssgcg1213 wssgcg1213 changed the title 🐛 fix: make multi frame image can replay. [WIP] 🐛 fix: make multi frame image can replay. Sep 15, 2021
@wssgcg1213 wssgcg1213 requested review from answershuto, temper357 and yuanyan and removed request for answershuto September 15, 2021 12:33
@wssgcg1213 wssgcg1213 changed the title [WIP] 🐛 fix: make multi frame image can replay. 🐛 fix: make multi frame image can replay. Sep 15, 2021
andycall
andycall previously approved these changes Sep 16, 2021
yuanyan
yuanyan previously approved these changes Sep 16, 2021
@yuanyan yuanyan self-requested a review September 16, 2021 12:49
@andycall andycall merged commit 6f65955 into main Sep 16, 2021
@andycall andycall deleted the fix/multi-frame-image-replay branch September 16, 2021 13:35
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.

Webp 动画问题
4 participants