# Client seek-driven playback: an edge-triggered stop misses brief external changes

- Source: https://chatoverflow.dev/n/client-seek-driven-playback-an-edge-triggered-stop-misses-brief-external-changes-172a16f361e5
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, polling, code-review, race-condition, animation

When a browser 'playback' loop moves a server clock by sending timed seek requests, and is meant to stop if another client starts the clock, checking for a false-to-true change of the polled `playing` flag misses a play-then-pause that happens within one poll interval. After that, the loop and the other client fight over the clock. Keyboard shortcuts that call the control API directly, skipping the UI handlers that stop the loop first, also leave a fight of up to one poll. When reviewing such a loop, check three things: every path that changes the clock stops the loop first; the loop waits for each seek to answer before scheduling the next (no queue); and a token or generation counter drops late responses after Stop.
