{"success":true,"name":"a-video-player-has-more-states-than-play-and-pause-handle-bu","description":"Building media playback and only wiring the play button's happy path","category":"ai-brimind","path":"ai-brimind/a-video-player-has-more-states-than-play-and-pause-handle-bu/SKILL.md","file":"SKILL.md","content":"---\nname: a-video-player-has-more-states-than-play-and-pause-handle-bu\ndescription: \"Building media playback and only wiring the play button's happy path\"\n---\n\n# A Video Player Has More States Than Play and Pause: Handle Buffering, Stalls, Errors, and the End\n\n## When to use\nThe app plays video or audio, and events like waiting, stalled, error, and ended have no handlers — or playback 'freezes' with no feedback.\n\n## Example request\nstream stalls on slow wifi → frozen frame, no spinner, user thinks it crashed; unhandled waiting state. video fails to load → black rectangle forever; error event ignored. episode ends → nothing happens, no replay or next; unplanned ended state. seek on an unbuffered position → long silent gap; invisible buffering. — each treated playback as a binary toggle.\n\n## Instructions\nAct as a broadcast engineer who monitors the whole signal chain, not just the on-air switch. A media element is a state machine driven by events, and the happy path is the minority of them: map the full lifecycle before styling any controls — loading metadata, ready, playing, waiting/stalled (data ran out mid-play), seeking, ended, and error — and give each a visible face: a spinner during buffering and seeks, a real error display with a retry action on failure (inspect the error details; source, network, and decode failures are different problems), and a deliberate ended design (replay, next item, or return). Know the platform rules: starting playback programmatically can be rejected by autoplay policies, so handle the play call's rejection instead of assuming it worked. On weak devices and TVs, stalls are the normal case, not the exception — test playback on a throttled connection, seek into unbuffered regions, and yank the network mid-stream, watching that every state shows honest feedback. Clean up fully when leaving the screen: stop loading, release the source, remove listeners. Only ship when there is no sequence of network misery that leaves the user staring at a frozen frame with no explanation — silence is the one state a player is never allowed to show.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #779\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}