The problem
Camera and microphone pickers had been rewritten by hand in every surface of the product: the web client, the admin console, the Electron desktop app and the pre-call test page. Each one handled permissions, device labels and hot-plug slightly differently, so a bug fixed in one place stayed broken in three others.
Outcome
One implementation behind a small API, adopted across every surface. Feature work that touched device handling dropped by roughly 60%, and a fix now lands everywhere at once.
Trade-off
It is deliberately not a UI component. Each product surface still owns its own markup, which was the right call for white-labelling but means the library cannot enforce consistent UX on its own.
How it was built
- 01Pulled device enumeration, permission state and selection persistence out of the UI layer and into one framework-agnostic module.
- 02Handled the case most implementations miss: device labels are empty strings until permission is granted, so enumeration has to be re-run after the first getUserMedia call.
- 03Subscribed to the devicechange event so plugging in a headset mid-call updates the list and the active track without a page reload.
- 04Persisted the chosen deviceId and fell back cleanly when that device disappears between sessions, instead of throwing OverconstrainedError at the user.