Skip to main content

Variable: PERSISTENCE_SCHEMA_VERSION

const PERSISTENCE_SCHEMA_VERSION: 2 = 2;

Defined in: packages/media-session/src/persistence.ts:80

Version stamped into every record and required on the way back in.

Bumped whenever the persisted shape changes in a way an older reader would mis-read. A reader that finds a version it does not know returns RestoreResult unsupportedVersion rather than guessing — the whole point of the field.

Version history

  • 1{playbackState, mediaItem, queue} with 6-field media items.

  • 2playbackState gained repeatMode / shuffleEnabled, and media items gained albumArtist, trackNumber, discNumber, year, subtitle, isLive and extras.

    Bumped even though the change is additive, because the reader that matters here is not this one. ResumptionStore on Android reads the same record with no JavaScript in the process, and the version is the only thing it can check; leaving it at 1 would let a v1-era native reader in a half-upgraded install (an app update that replaced the JS bundle but is still running the previous service) rebuild a session that silently drops repeat, shuffle and the extended tags. unsupportedVersion — "I will not guess" — is the answer this field exists to give, and the cost of it is one session's resumption card, which the next broadcast rewrites.