SDWebImage: SDWebImage didn't added AWebPCoder by default, which cause `.webp` bundled images don't animate
New Issue Checklist
- I have read and understood the CONTRIBUTING guide
- I have read the Documentation
- I have searched for a similar issue in the project and found none
Issue Info
| Info | Value |
|---|---|
| Platform Name | ios |
| Platform Version | 17.6.1 |
| SDWebImage Version | 5.19.6 |
| Integration Method | SPM |
| Xcode Version | 15.4 |
| Repro rate | 100% |
| Repro with our demo prj | n/a |
| Demo project link | n/a |
Issue Description and Steps
.webp images that are bundled with the application don’t seem to automatically play. If they do come from the network (aka loading them via SDAnimatedImageView.sd_setImage(with:placeholderImage:options:completed:), they do animate as expected.
Is there a way to load local files that are bundled with the app and make them play? We do have .gif images that are bundled with the app and those play just fine, it’s just the .webp ones that don’t play. They load, but they look as if they were a static jpg/png, they don’t animate.
To load them, I’m doing the following:
let imageView = SDAnimatedImageView()
if let url = Bundle.main.url(forResource: "example", withExtension: "webp") {
imageView.image = SDAnimatedImage(contentsOfFile: url.path)
}
addSubview(imageView)
If the example.webp was an example.gif, it does play. But it doesn’t if it’s a .webp.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 24 (16 by maintainers)
Updated the README to make this more user-friendly for new user, see:
Maybe. But Changing a default value which will effect the current other SDWebImage users. This default behavior was introduced actually 3 years ago, many users used to use SDWebImage with their own register code logic (in AppDelegate or somewhere) to add WebP coders.
If you really want, we have to release another minor version like SDWebImage 5.20.0.
And also, there are another
SDImageHEICCoderwhich should be added to default coder list, if you run on iOS 12+Seems there are some documentation hidden in wiki pages.
https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#awebp-coder
But new user didn’t notice this.
The documentation can be highlighted on README again (current it’s linked in the
SDWebImageAWebPCoder), see my screenshot.