SDWebImageWebPCoder
SDWebImageWebPCoder copied to clipboard
Frames loading
Hello, I'm trying to use animated webp images as cells for collection view and it works nice on new devices, but on devices like iPhone 7 I have such an issue: on first appearing of cell the loading of images is freezed, and scrolling is not (I can scroll the collection without freezes, so it is not main thread lock). There are approximately 50 cells of images, and they loads by frame. After some time (I guess when all frames of images are passed) all cells begin to animate correctly (after closing and reopening the screen too). Looks like it is something connected with caching. All webp-s are local files, so it is not network loading. Am doing something wrong? Here is the code:
SDWebImageManager.shared.optionsProcessor = SDWebImageOptionsProcessor { _, options, context in
var mutableOptions = options
mutableOptions.insert([.retryFailed, .highPriority/*, .preloadAllFrames*/]) // no efffect on frames loading
return SDWebImageOptionsResult(options: mutableOptions, context: context)
}
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)
SDWebImageDownloader.shared.setValue("image/webp,image/*,*/*;q=0.8", forHTTPHeaderField: "Accept")
...
var stickerImageView = SDAnimatedImageView(frame: .zero)
// stickerImageView.shouldIncrementalLoad = true // no efffect on frames loading
stickerImageView.sd_imageTransition = .fade(duration: 0.3)
...
stickerImageView.sd_setImage(with: url, placeholderImage: placeholder)