Skip to main content

Type Alias: SessionErrorCode

type SessionErrorCode =
| "backgroundPlaybackUnavailable"
| "playbackResumptionFailed"
| "playbackResumptionUnavailable"
| "playbackResumptionNotWired"
| "artworkFailed"
| "metadataMismatch"
| "iconNotFound"
| "localAudioSlotUnavailable"
| "playFromMediaIdUnhandled"
| "browseRootRejected";

Defined in: packages/media-session/src/specs/media-session.nitro.ts:225

Something the session could not do, on a channel the app can actually read.

Why this exists​

Every member below used to be a Log.e/Log.w/NSLog and nothing else: the platform refused something, the session carried on in a degraded state, and the only way to find out was to have a cable attached at the moment it happened. That is CLAUDE.md principle 6's "no swallowed errors" applied to the half of this package that runs where no JavaScript call is waiting — a media3 service callback, an MPRemoteCommandCenter target, a download completion. There is no promise to reject, so the failure needs a channel of its own, and this is it (fan-in, like every other remote event: MediaSessionHandlers.onSessionError).

What it is not​

Not the taxonomy for a call the app made — a bad argument, a double init — those still throw MediaSessionError synchronously, because there is a caller standing right there to catch it. This union is only for failures with no caller.

Platforms​

Each member documents which platforms can emit it and when. Three are emitted by both; four are emitted by Android alone, and every one of those four belongs to a feature that is already Android-only for a documented platform reason (playback resumption, holdLocalAudioSlot, drawable-named icons) — they do not add an asymmetry, they report on one that exists. There is no member iOS alone can emit, and that is stated rather than papered over.

NOTE: member names follow the enumerator rule on MediaPlaybackStatus — distinct case-insensitively, no Swift keywords.