"Provide two honest seek modes: a configurable relative seek for repeated keyboard movement, and exact seek for Recall handoff, Jump to Time, and A-B boundaries."
Two Things Users Mean by 'Seek'
When someone taps the right-arrow four times to skip past a slow scene, they want motion — smooth, instant, responsive. They do not care whether they land on the exact frame; they're scanning. When someone clicks a Recall transcript line, they want precision — that exact remembered second, no compromise. Same verb, opposite priorities. A player that treats both as one operation will disappoint one of them.
The reason they can't be the same is physical. Video is stored so that only some frames (keyframes) can be decoded on their own; the rest depend on their neighbors. Jumping to the nearest keyframe is fast but lands you a bit off. Decoding forward to the precise frame is exact but costs more work. You cannot have instant and exact from the same seek — so Ashen Reel offers both, and picks by intent.
The dispatch is tiny once you name why the seek is happening:
Where Each Mode Belongs
Once the split exists, assigning modes is obvious. Held arrow keys and scrubbing → keyframe seek, because the user is scanning and wants the picture to move now. Recall handoff, Jump to Time, chapter jumps, and A-B loop boundaries → exact seek, because those are promises about a specific frame. The mode is never guessed from the keypress alone; it's chosen from what the user is trying to do. That's the whole trick: a seek's correct behavior depends on its intent, so intent is what the code branches on.
Code
enum SeekIntent { case scanning; case precise } // WHY the seek is happening
func seek(by delta: Double, intent: SeekIntent) {
switch intent {
case .scanning:
// Repeated arrow taps / scrub: keyframe seek. Trade precision for
// instant response -- the user is scanning, not landing.
try? mpvCommand(mpv, ["seek", "\(delta)", "relative+keyframes"])
case .precise:
// Recall jump, Jump to Time, chapter, A-B boundary: exact, decode
// forward to the right frame even though it costs a little more.
try? mpvCommand(mpv, ["seek", "\(delta)", "relative+exact"])
}
}
// The keypress doesn't decide the mode. The user's INTENT does:
// holding an arrow -> .scanning; clicking a transcript line -> .precise.External links
Exercise
Hint
Progress
Comments 0
🔔 Reply notifications (sign in)No comments yet — be the first.