Skip to content

FCE-3586: device foundation — classified errors, platform types, mediaInitializer - #589

Open
MiloszFilimowski wants to merge 1 commit into
tsunami-migrationfrom
tsunami/04-device-foundation
Open

FCE-3586: device foundation — classified errors, platform types, mediaInitializer#589
MiloszFilimowski wants to merge 1 commit into
tsunami-migrationfrom
tsunami/04-device-foundation

Conversation

@MiloszFilimowski

@MiloszFilimowski MiloszFilimowski commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Description

  • devices/errors.ts: DeviceError classes with the legacy name literals (NotAllowedError / NotFoundError / OverconstrainedError / UNHANDLED_ERROR), recoverability, and the platform cause. Classification happens at the platform boundary: WebDeviceManager.getUserMedia / getDisplayMedia reject with a classified DeviceError, so raw platform error shapes never cross into the core.
  • IDeviceManager gains the PlatformMediaStreamTrack / PlatformMediaStream structural contracts — the core no longer types against DOM media, and react-native-webrtc's runtime objects satisfy them (listener methods stay optional per FCE-3689). onDeviceChange feature-detects mediaDevices without devicechange events (React Native's polyfill).
  • devices/mediaInitializer.ts: getAvailableMedia fallback ladder (audio-only / video-only on failure, Overconstrained retry with stripped deviceId) + recoverPersistedDevices — the platform contract states device ids are NOT stable across sessions, so a persisted device that resolves to nothing is re-matched by label and re-acquired with exact ids (no browser knowledge in the core).
  • mediaTypes.ts: the public middleware/initialization types. Exported once the device API lands (next PRs in the stack).

Motivation and Context

Foundation layer for porting device logic out of react-client: typed errors per the FCE-3580 error model, and a platform boundary that keeps the core free of navigator.mediaDevices and DOM media types.

Documentation impact

  • Documentation update required
  • Documentation updated in another PR
  • No documentation update required

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)

@MiloszFilimowski MiloszFilimowski changed the title tsunami: device foundation — classified errors, platform media types, mediaInitializer FCE-3586: device foundation — classified errors, platform types, mediaInitializer Aug 5, 2026
@linear

linear Bot commented Aug 5, 2026

Copy link
Copy Markdown

FCE-3586

@MiloszFilimowski
MiloszFilimowski marked this pull request as ready for review August 5, 2026 14:26
… mediaInitializer

DeviceError classes with legacy name literals and recoverability, classified
at the platform boundary: WebDeviceManager's getUserMedia/getDisplayMedia
reject with a classified DeviceError, so platform error shapes never cross
into the core. IDeviceManager gains the PlatformMediaStreamTrack/
PlatformMediaStream structural contracts (react-native-webrtc's tracks
satisfy them; listener methods stay optional per FCE-3689) and tolerates
mediaDevices without devicechange events. getAvailableMedia implements the
audio-only/video-only fallback ladder with the Overconstrained retry, plus
correctDevicesOnSafari label matching. mediaTypes carries the public
middleware/init types (exported once the device API lands).
@MiloszFilimowski
MiloszFilimowski force-pushed the tsunami/04-device-foundation branch from 694bd11 to dfa2e2c Compare August 5, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant