position-based-group-sync

Installation
SKILL.md

Absorb the loading gap with position, not with waiting

Each client in a shared session resolves its own stream, so "start now" arrives at devices that will be ready at different moments. There are two ways to keep them together and only one of them scales: hold everybody until the slowest is ready, or let everybody start when they can and land at the right position. The second is what makes the session feel live.

That costs three things, all of which have to be present together:

// adapted — names generalized; the role checks and logging elided
private suspend fun applyTransport(running: Boolean, position: Long) = withContext(uiContext) {
    // 1. the command carried a position, and 2. it is advanced by however long it spent in flight
    val corrected = clock.positionAt(position, running)
    // 3. a small drift is normal; seeking on every tick stutters. Only a real gap earns a seek.
    if (abs(component.currentPosition - corrected) > SEEK_TOLERANCE_MS) component.seekTo(corrected)
}
Installs
2
GitHub Stars
35
First Seen
6 days ago
position-based-group-sync — maxrave-dev/kotlin-footguns