Some APIs already exist that can help with this, but some aren't.
Meaning ability to have a playback control and information, such as shown and used on various players on the web browser. Examples:
https://onlinegiftools.com/play-gif
https://captaincodeman.github.io/gif-player/components/gif-player/demo/
https://lottiefiles.com/free-animation/loading-animation-blue-VNMY2Tu4UQ (I know it's not a GIF player)
So, for this, we would need query of current frame vs total frames, being able to go to specific frame, being able to get image of specific frame, have duration of each frame, set speed of the playback, being able to go to next/previous frame while paused (and get the new bitmap), etc...