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

Too fast Animation of APNG loaded via Glide into RecyclerView #176

Open
Zylence opened this issue Jan 25, 2023 · 4 comments · May be fixed by #214
Open

Too fast Animation of APNG loaded via Glide into RecyclerView #176

Zylence opened this issue Jan 25, 2023 · 4 comments · May be fixed by #214

Comments

@Zylence
Copy link

Zylence commented Jan 25, 2023

Issue Info

Info Value
Device Info Poco F3 and Moto G5
System Version 12 and 8.1
APNG4Android Library Version 2.24.0
Repro rate 100%
Repro with our demo project not checked
Demo project link BugDemo.zip

Issue Description and Steps

Too fast Animation of APNG inside RecyclerView loaded via Glide

Sometimes when loading a bunch of APNGs into a RecyclerView some of them are speed up by roughly 2x.
This happens inside the example app ~1/20 of the time when loading 10 initial images. 

Slowly adding them exhibits the same behavior, but is much more frequently reproducible. When APNGs are loaded via button click, they animate faster until automatic scrolling kicks in.

Scrolling or refreshing in general seems to reset them to "normal" speeds. 

I attached some recorded videos as well to showcase it.

Note:

  • It may also happen that some only speed up after being scrolled into view -  but that's rare
  • I have also seen this behavior without glide - but that was not reproducible

https://user-images.githubusercontent.com/81491426/214593147-d2445b5b-b871-4502-908a-370d5ed29bd2.mp4
https://user-images.githubusercontent.com/81491426/214593156-e810a1ca-9e8e-4670-805e-716b24ece496.mp4

@charlag
Copy link

charlag commented Feb 22, 2024

It also reproduces in isolation with empty activity like this:

class TestActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val layout = FrameLayout(this)

        val imageView = ImageView(this)
        imageView.layoutParams = LinearLayout.LayoutParams(Utils.dpToPx(this, 64), Utils.dpToPx(this, 64))
        layout.addView(imageView)
        setContentView(layout)

        Glide.with(this)
            .load("https://mastodon.derg.nz/system/custom_emojis/images/000/000/208/original/1ba4096c050a3b1b.png")
            .into(imageView)
    }
}

so it has nothing to do with RecyclerView in or custom targets in our case

@tudou0digua
Copy link

It also reproduces in isolation with empty activity like this:

class TestActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val layout = FrameLayout(this)

        val imageView = ImageView(this)
        imageView.layoutParams = LinearLayout.LayoutParams(Utils.dpToPx(this, 64), Utils.dpToPx(this, 64))
        layout.addView(imageView)
        setContentView(layout)

        Glide.with(this)
            .load("https://mastodon.derg.nz/system/custom_emojis/images/000/000/208/original/1ba4096c050a3b1b.png")
            .into(imageView)
    }
}

so it has nothing to do with RecyclerView in or custom targets in our case

the reason of the problem of this image url (https://mastodon.derg.nz/system/custom_emojis/images/000/000/208/original/1ba4096c050a3b1b.png)
is:
this image frameDuration is 10ms,when browser decode image , force set frame duration to 100ms
but this library just use 10ms (as the image required)

@tudou0digua
Copy link

Issue Info

Info Value
Device Info Poco F3 and Moto G5
System Version 12 and 8.1
APNG4Android Library Version 2.24.0
Repro rate 100%
Repro with our demo project not checked
Demo project link BugDemo.zip

Issue Description and Steps

Too fast Animation of APNG inside RecyclerView loaded via Glide

Sometimes when loading a bunch of APNGs into a RecyclerView some of them are speed up by roughly 2x. This happens inside the example app ~1/20 of the time when loading 10 initial images. 

Slowly adding them exhibits the same behavior, but is much more frequently reproducible. When APNGs are loaded via button click, they animate faster until automatic scrolling kicks in.

Scrolling or refreshing in general seems to reset them to "normal" speeds. 

I attached some recorded videos as well to showcase it.

Note:

  • It may also happen that some only speed up after being scrolled into view -  but that's rare
  • I have also seen this behavior without glide - but that was not reproducible

https://user-images.githubusercontent.com/81491426/214593147-d2445b5b-b871-4502-908a-370d5ed29bd2.mp4 https://user-images.githubusercontent.com/81491426/214593156-e810a1ca-9e8e-4670-805e-716b24ece496.mp4

@penfeizhou
use the demo code, in mi 11(Android 13), can reproduce the bug

this is temp fix
#214

@tudou0digua tudou0digua linked a pull request Feb 24, 2024 that will close this issue
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 a pull request may close this issue.

3 participants