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

APNG Animation Playing Too Fast #139

Closed
alexander-steel opened this issue Oct 26, 2023 · 12 comments · Fixed by #140
Closed

APNG Animation Playing Too Fast #139

alexander-steel opened this issue Oct 26, 2023 · 12 comments · Fixed by #140

Comments

@alexander-steel
Copy link

alexander-steel commented Oct 26, 2023

Hi. I have an issue where the APNG animation plays at an extremely fast speed when I load it with a certain piece of code. Is this a bug?

"The application starts by displaying a splash screen. After the splash screen completes, the main ViewController is loaded. The APNG images are set up within the viewDidLoad method of the main ViewController."

2023-10-26.18.41.34.mov
let apngImage = try! APNGImage(named: defaultImageName)
        imageView.autoStartAnimationWhenSetImage = false
        setImage(image: apngImage)
        imageView.startAnimating()
    }

    private func setImage(image: APNGImage) {
        imageView.image = image
        setFrameSize(image: image)
    }

    private func setFrameSize(image: APNGImage) {
        let deviceWidth = UIScreen.main.bounds.width
        let frameHeight = deviceWidth * image.size.height / image.size.width
        frame.size = CGSize(width: deviceWidth, height: frameHeight)
    }
@onevcat
Copy link
Owner

onevcat commented Oct 27, 2023

@alexander-steel Does the same thing happen in the viewWillAppear:? And if possible, can you give me a link or post the used image here? I can check if it is the issue in the image itself.

@devflow
Copy link

devflow commented Dec 8, 2023

Same issue on iOS 17. but 16 works normally.

@onevcat
Copy link
Owner

onevcat commented Dec 8, 2023

Does it happen for all images or a certain one? Any reproducible code snippet or sample images are welcome and helpful for tracking this better.

@devflow
Copy link

devflow commented Dec 8, 2023

@onevcat

I've committed a few lines to my repository to reproduce the bug (Master branch) Please check it!, thanks!

https://github.com/devflow/APNGKit

@onevcat
Copy link
Owner

onevcat commented Dec 8, 2023

Umm, seems it is an issue that the first .applicationDidBecomeActive notification comes earlier for the app startup than iOS 16, and an edge case happens if there is already an instance of APNGImage which receives a wrong timestamp.

Fixed in #140

@onevcat
Copy link
Owner

onevcat commented Dec 9, 2023

Fixed and released as 2.2.4.

@devflow
Copy link

devflow commented Dec 11, 2023

it seems like still having issue. at my forked repo with apngkit 2.2.4. (iOS 17, Simulator)

@devflow
Copy link

devflow commented Dec 11, 2023

it seems like still having issue. at my forked repo with apngkit 2.2.4. (iOS 17, Simulator)

Ok, it's only happening when launch an app with XCode. other normal app launch behavior likes SB or Spotlight works as well. it not important issue.

Thank you.

@onevcat
Copy link
Owner

onevcat commented Dec 11, 2023

A stupid error. I will fix again soon.

@onevcat
Copy link
Owner

onevcat commented Dec 11, 2023

Ref: #141

@onevcat
Copy link
Owner

onevcat commented Dec 11, 2023

@devflow Done in 2.2.5. Do you have a chance to check it again?

@devflow
Copy link

devflow commented Dec 11, 2023

@onevcat yes, 2.2.5 works as well!! at both DEMO and the private project. 💯

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