SDWebImage / SDWebImageSwiftUI

SwiftUI Image loading and Animation framework powered by SDWebImage
https://sdwebimage.github.io/SDWebImageSwiftUI
MIT License
2.18k stars 224 forks source link

isAnimating is not working with AVIFS #294

Closed lschaupp closed 6 months ago

lschaupp commented 9 months ago

I am trying to make this example work. It does work with mp4 on my end. However, it does not work with AVIFS. Since I am loading many AVIFS files within a LazyHStack, I am getting memory issues, therefore I need to be able to stop them.

     VStack {
                                            AnimatedImage(url: URL(string:"https://raw.githubusercontent.com/link-u/avif-sample-images/master/star-12bpc-with-alpha.avifs")!, isAnimating: $isAnimating)
                                        Button(action: {
                                            self.isAnimating.toggle()

                                        }, label: {
                                            HStack{
                                                Text("Stop")
                                                    .font(.system(.title3))
                                                    .fontWeight(.bold)

                                            }
                                        })
                                        }
dreampiggy commented 9 months ago

...I guess this is similiar to your previous issues report.

The AnimatedImage actually does not care about any Image Format

If it's a bug of isAnimating animtion control, then all animated image must encounter this bug.


I can not reproduce on our demo, can you provide the full reproducable project or full source code to analayze ?


Can not reproduce even using this simple code:

struct ContentView: View {
    @State var isAnimating: Bool = true
    var body: some View {
        VStack {
               AnimatedImage(url: URL(string:"https://raw.githubusercontent.com/link-u/avif-sample-images/master/star-12bpc-with-alpha.avifs")!, isAnimating: $isAnimating)
           Button(action: {
               self.isAnimating.toggle()

           }, label: {
               HStack{
                   Text("Stop")
                       .font(.system(.title3))
                       .fontWeight(.bold)

               }
           })
           }
    }
}
dreampiggy commented 9 months ago

20240103174222

dreampiggy commented 9 months ago

I think this is still something about your Library version or integration issue

Check https://github.com/SDWebImage/SDWebImageSwiftUI/pull/292 again

  1. SDWebImage: use latest
  2. SDWebImageSwiftUI: use 2.x latest or 3.0.0-beta2
  3. libavif: use latest and choose dav1d as codec (subspecs => 'libdav1d')
  4. libdav1d: use latest