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

Improved Gifs #1901

Merged
merged 16 commits into from
Mar 20, 2025
Merged

Improved Gifs #1901

merged 16 commits into from
Mar 20, 2025

Conversation

EricBAndrews
Copy link
Member

@EricBAndrews EricBAndrews commented Mar 19, 2025

Issues

Description

  • Improves scrubbing performance for gifs and webps. Scrubbing backwards on large gifs is now nice and smooth (https://sh.itjust.works/post/33262204 being a nice testing image)
  • Adds time markers to playback bar

Implementation Notes

  • Rewrites AnimatedImageView as a UIViewRepresentable around SDAnimatedImageView. This gives us access to SDAnimatedImage.preloadAllFrames(), loads the entire gif into memory and thus enables smooth backwards scrubbing. It also simplifies a lot of the logic around interacting with the AnimatedImageView.
  • Updates how AnimatedImageView populates controlState.playbackPosition; there is now an observer on the SDAnimatedImagePlayer that listens to frame changes.
  • Adds scrubbingAvailable to MediaControlState. This lets us only perform preloadAllFrames when we actually need to.
  • Adds duration to MediaControlState

@EricBAndrews EricBAndrews requested a review from a team as a code owner March 19, 2025 23:30
@EricBAndrews EricBAndrews requested review from Sjmarf and removed request for a team March 19, 2025 23:30
Copy link
Member

@Sjmarf Sjmarf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is super smooth! One minor implementation question

@EricBAndrews EricBAndrews enabled auto-merge (squash) March 20, 2025 22:13
@EricBAndrews EricBAndrews merged commit 2281638 into dev Mar 20, 2025
2 checks passed
@EricBAndrews EricBAndrews deleted the eric/improved-gifs branch March 20, 2025 22:18
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 this pull request may close these issues.

Better webp, gif rendering
2 participants