Context
The player SDK is a headless lesson player I designed and wrote almost alone in 2026. It sits under the learner platform's lesson page and now plays every lesson type by default.
The problem
The old web player was one large block. Video, DRM video, PDF, YouTube, Vimeo and SCORM each had their own logic. The new lesson experience needed one player, and gating rules such as drip, lock and live scheduling had to behave exactly as before.
What I did
I defined the contracts first, as schemas, so every package agreed on its data before any code.
I built a finite-state-machine core with a separate DRM state machine, and thin React and vanilla mounts on top.
I wrote providers as plugins: HTML5, image, PDF slides, YouTube, Vimeo and DRM.
I moved gating into the SDK so there is one implementation, and added xAPI and SCORM tracking, watch time, completion, bookmarks, a watermark and a buffering watchdog.
I grew the error map from 3 codes to 13, and used mutation testing as the quality gate.
Key decision
I built a headless core with pluggable providers rather than rewriting the old player in place. State lives in explicit machines, so each browser and DRM path can be tested on its own.
The trade-off was a larger up-front design: 8 packages and a strict contract layer before the first lesson played. It paid back in how few places gating logic lives now.
Result
The SDK is the default player, behind a feature flag in production. Its suite passes 198/198 tests. The player adapter has a 98% mutation score, and core is at 86.7%.
I have no learner-facing playback numbers, such as start failures or rebuffering, so I make no claim about them.
What I learned
I would use contracts-first and mutation testing again. I would wire player telemetry in from the start, so the improvement can be shown with data.
Stack
- TypeScript
- Zod
- React
- Finite state machines
- EME / Widevine / PlayReady / FairPlay
- Stryker
