Function
The player the keys belong to. Its element is read when the listeners are attached, not while rendering, and the player itself must keep its identity between renders
The hook says which way, not how far. It reports a direction and seeks nothing: the step, the run it joins and the indicator that answers belong to the caller that holds the player and the remote. Whether a seek may happen at all is the caller's too — a key reported here has already been taken, so a caller that declines it leaves the press with no effect, which is what keeps the library's own keyboard display from answering instead.
The keys are taken in the capture phase, on the document. Vidstack binds
them to its own seek, by its layout's step, and answers with its own
display. Its listener is on the player element, and a focused time slider
handles its arrows before even that — so the one place that runs ahead of
both is the document, capturing. useSpeedHold records why the library's
shortcut table is not the way to do this.
The release is taken too. The library commits a keyboard seek on keyup, to a position it worked out on keydown. Handed a release whose press it never saw, it has no position and seeks to none.
Every repeat is reported. A key held down is a learner scrubbing, and each repeat the platform sends is one more step. The caller's run counts from where it started rather than from where the video is, so a repeat that arrives before the previous seek has landed loses nothing.
Meta, Ctrl and Alt leave the key to the browser — Alt with an arrow
is "back". Shift does not, because the letter keys are typed with it.
Takes the player's seek keys from the library and reports the direction each one asks for.