Repository navigation
Play GIF, animated WebP and SVG, with an optional loop count - #55
Merged
Merged
Conversation
Adds coil-gif and coil-svg. An animation is held while staged and starts from its first frame when it comes on screen. GaplessAsset.animationLoops plays it that many times, holds the last frame and emits Completed. The sample app gets an animated GIF and WebP that number their frames, an SVG, and an animated playlist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only Coil's core decoders were included, so a GIF or animated WebP showed its first frame and an SVG failed to load. The library now depends on
coil-gifandcoil-svg. Both register through Coil's service loader, so they also work with an app's ownImageLoader. Animated WebP needs Android 9 or newer.A preloaded animation would start playing while hidden, and be part way through or already done by its cut. Each image slot now holds its animation until it is on screen, then starts it from the first frame.
GaplessAsset.animationLoops: null, the default, loops until the nextplay(). A count plays it that many times, holds the last frame and emitsCompleted, as a video does at its end. Stopping an animation also reports an end, so only one that runs out while on screen counts. Zero or negative counts are rejected.The sample app gets
image_animated_gif, the same GIF asimage_animated_gif_3_loops,image_animated_webpandimage_svg, in ananimatedplaylist. The animations number their frames so a restart is visible.Checked on both TVs: a screen recording showed every cut to an animation starting at frame 1, after a video and after a still. The 3-loop GIF reported Completed 3.6 s after starting and held on its last frame, the looping GIF never reported, and the SVG rendered.