--- name: animated-gif-playback-controls description: Build web apps that import animated GIFs and provide real playback controls (play/pause/stop, scrubber, speed control, frame counter) by decoding GIF frames to canvas instead of relying on browser GIF playback. version: 1.0.0 metadata: hermes: tags: [gif, animation, canvas, react, vite, playback, media] related_skills: [vps-app-deployment, test-driven-development] --- # Animated GIF Playback Controls Use this when building an app that needs to add/import animated GIFs and control playback with a movable playhead, stop/start, and speed changes. ## Core Lesson Do **not** use a normal `` if the user needs playback controls. Browser GIF playback is opaque: you cannot reliably pause on an exact frame, scrub the timeline, reset to frame zero, or change speed. Decode the GIF into frames and render onto a `` yourself. For **animated SVGs**, do not convert them to GIF just to make them playable. Host the SVG as a same-origin file and render it in an `