pinterest / PINRemoteImage

A thread safe, performant, feature rich image fetcher
Apache License 2.0
4.01k stars 511 forks source link

Add support for Querying and Setting the Playback Timestamp in PINAnimatedImageView #623

Open kylehowells opened 2 years ago

kylehowells commented 2 years ago

If you have GIFs in a table view or collection view and you want to let them scroll off screen, then back on screen, and resume playback from the same frame, as if they were never unloaded you need to be able to save the current playback timestamp and then resume playback from that timestamp.

Added 3 new public methods to PINAnimatedImageView to achieve this.

@property (nonatomic, readonly) CFTimeInterval lastDisplayedTimestamp;
-(void)setCurrentTimestamp:(CFTimeInterval)newTimestamp;

-(void)setAnimatedImage:(PINCachedAnimatedImage*)image atTimestamp:(CFTimeInterval)newTimestamp