Skip to main content

Variable: DEFAULT_AUTOSAVE_INTERVAL_MS

const DEFAULT_AUTOSAVE_INTERVAL_MS: 30000 = 30_000;

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

The default PersistenceAutosaveOptions.intervalMs: 30 seconds.

Chosen from what each end costs, not from taste:

  • The write. One setItem of a few kilobytes per interval — 120 an hour of continuous playback, two a minute. Async engines do it off the JS thread; MMKV's synchronous write of a payload this size is microseconds. That is not a hot path by any reading of "performance first", and it is several orders of magnitude away from the per-frame traffic the discontinuity rule exists to forbid.
  • The loss. An un-warned kill costs at most one interval of position. Thirty seconds is under the threshold where a listener notices being put back in the wrong place; a minute or more is not, and past that the write you saved is worth less than the position you lost.

Deliberately not a fraction of the track: an interval that depends on duration is a number nobody can reason about, and it does not exist for a live stream at all.