You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the requirement to improve the scroll performance when collection view has many GIFs, thus pause the playback in scrolling state and resume after scroll finished. (By setting runloop mode to default mode other than common mode)
For example, a gif has 20 frames, frame interval 16ms, collection view not scrolled, now it's playing 5th frame, and scroll started, after scroll finished, maybe 5s passed, it started to resume, and even 5s passed, it still need to play 6th frame.
But in our implementation currently, we use absolute time(CACurrentMediaTime) to calculate which frame we should play, leads to frame skip. Another simple example, if a gif's loop count is 1(play only once), 20 frames, frame interval 16ms, after it played 1th frame, scroll started, keep runloop mode to default 3s, after that, gif would not resume any more, because elapsed time already exceed total duration of gif.
@garrettmoon Any reason why we choose absolute time to calculate frame index? seems all other third frameworks like YYImage/FLAnimatedImage... use CADisplayLink.duration.
The text was updated successfully, but these errors were encountered:
I have the requirement to improve the scroll performance when collection view has many GIFs, thus pause the playback in scrolling state and resume after scroll finished. (By setting runloop mode to default mode other than common mode)
For example, a gif has 20 frames, frame interval 16ms, collection view not scrolled, now it's playing 5th frame, and scroll started, after scroll finished, maybe 5s passed, it started to resume, and even 5s passed, it still need to play 6th frame.
But in our implementation currently, we use absolute time(CACurrentMediaTime) to calculate which frame we should play, leads to frame skip. Another simple example, if a gif's loop count is 1(play only once), 20 frames, frame interval 16ms, after it played 1th frame, scroll started, keep runloop mode to default 3s, after that, gif would not resume any more, because elapsed time already exceed total duration of gif.
@garrettmoon Any reason why we choose absolute time to calculate frame index? seems all other third frameworks like YYImage/FLAnimatedImage... use
CADisplayLink.duration
.The text was updated successfully, but these errors were encountered: