Skip to main content

Function: applyPersisted()

function applyPersisted(service: MediaServiceApi, session: PersistedSession): void;

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

Broadcast a restored session, in the order the channels expect.

Queue first, then the item, then the state: the state carries queueIndex, and the current entry is enriched by merging setMediaItem over queue[queueIndex] (ARCHITECTURE §10). Sending the state first would make the native side briefly resolve an index into an empty queue.

A one-liner an app could write itself — which is exactly why it lives here: getting the order wrong produces a notification with no scrubber and no error, the single hardest class of bug this package has.

Parameters

ParameterType
serviceMediaServiceApi
sessionPersistedSession

Returns

void