Variable: DEFAULT_CACHE_SECS
const DEFAULT_CACHE_SECS: 30 = 30;
Defined in: packages/player/src/player.ts:1455
Default --cache-secs, i.e. how far ahead the demuxer is allowed to read on
a network stream.
mpv's own default is 1000 * 60 * 60 seconds (demux/demux.c,
demux_conf.defaults.min_secs_cache, mpv 0.35.1), and demux.c takes
min_secs = MPMAX(demuxer-readahead-secs, cache-secs) whenever the cache is
active — which --cache=auto makes true for anything that looks like a
network stream. The only brake left is --demuxer-max-bytes, whose default
is 150 MiB: on a 128 kbit/s radio stream that is ~2.7 hours of audio which
mpv will happily download, over mobile data, while paused. (Measured
on-device: a paused Shoutcast entry's buffered readout climbed past 45 s
and kept going.)
30 s is the balance point. It does not delay startup — how far ahead the
demuxer reads is independent of when playback starts, which is gated by the
AO queue (--audio-buffer, 0.2 s) and not by the cache, since
--cache-pause-initial defaults to no (mpv 0.35.1 options.rst). It
leaves 30 s of slack to ride out a mobile-network stall, and mpv only needs
--cache-pause-wait (1 s) buffered to resume after one. The cost is that a
stall longer than 30 s rebuffers where mpv's default would not have; that is
the deliberate trade for bounded memory and bounded data use.
Override per player with mpvOptions: { 'cache-secs': '…' }.