Skip to content
Real-time systems

A Video Call Is Not a Clinical Workflow

Remote movement assessment needs more than video. Exercise state, recordings and either participant leaving at any moment all have to be explicit product states, or patients end up stuck.

3 min read0 comments

Two participant screens connected through a sequence of explicit session states

The video was the easy part

At MyMedicalHub, patients do guided movement assessments with a provider over a live session. On the surface it looks like a video call. In practice, both sides must stay synchronised while exercises change, instructions play, recordings start and stop, pain or strength questions appear, network quality shifts, and either participant can leave at any moment.

Camera, microphone, permissions and WebRTC lifecycle events also behave differently across browsers and patient devices. A happy-path demo works on day one. The product is everything that happens around it.

Two bugs with the same root cause

Two defects taught me the most. In the first, a patient finished one exercise, moved to the next, and saw the previous exercise's recording preview again. In a clinical system, showing the wrong movement's video in the wrong task is not cosmetic.

In the second, when the provider left the session, the patient was left on a loading screen. Nothing was coming, and nothing told them so.

Both came from the same assumption: we had treated state as belonging to the call rather than to the clinical workflow.

If state belongs to the call, it leaks between tasks. If it belongs to the workflow, it has an owner and an end.

Each real-time concern got an owner

Socket, media, recording and error lifecycles now live in separate, focused React contexts. One high-frequency concern no longer owns every room transition, so a burst of socket events cannot accidentally reset recording state.

Exercise-owned media is reset whenever the selected exercise changes. Recorded previews, questions and movement state are cleared at that boundary, so stale clinical media cannot reappear in a new task.

Optional behaviour such as strength analysis is driven by tenant features. Controls appear and execute only when the current tenant's contract supports them, which let us add workflows without forking the telehealth application.

Leaving, disconnecting and failing became states

Provider exit, peer disconnect, API failure and degraded network paths now transition to explicit messages and redirects instead of indefinite loading. Each has words a patient can understand and a next step.

The stack is Next.js and TypeScript, with WebRTC media hooks, Socket.IO room coordination and Redux for assessment state. None of that is unusual. What made the difference was deciding that "someone left" is a screen we design, not an error we hope never happens.

In real-time products, the exit paths are the product.

Working through a similar challenge?

Share your context, constraints, and timeline to start a focused conversation.