Skip to main content

ReleaseMode

Determines what happens to the player's resources (the buffered audio and the underlying native player) when playback finishes or is stopped, and therefore how quickly, and at what cost, the same audio can be played again.

Inherits: enum.Enum

Properties

  • LOOP - Automatically restarts playback from the beginning every time it completes, creating a continuous loop.
  • RELEASE - Frees all resources once playback completes, as if Audio.release had been called automatically.
  • STOP - Stops playback when the audio completes but keeps all resources (the buffered audio and the native player) intact.

Properties

LOOPclass-attributeinstance-attribute

Automatically restarts playback from the beginning every time it completes, creating a continuous loop. All resources are kept buffered.

Best for audio that should repeat indefinitely, such as background music.

Note

Resources are never released automatically in this mode. To free them, change the source or call Audio.release.

RELEASEclass-attributeinstance-attribute

Frees all resources once playback completes, as if Audio.release had been called automatically. This is the default mode.

The buffered audio and the native player are released, so nothing is kept in memory while the audio is idle. Playing again is still supported, but the source is loaded again from scratch first (and a remote file is re-downloaded), which adds a short delay before playback starts.

Best when replays are rare or may never happen and keeping memory usage to a minimum matters.

Note
  • On Android, the native media player is resource-intensive; this mode lets it go and re-buffers the data only when needed.
  • On iOS and macOS, behaves like Audio.release.

STOPclass-attributeinstance-attribute

Stops playback when the audio completes but keeps all resources (the buffered audio and the native player) intact.

Because nothing is released, playing again is immediate: the audio restarts straight from the retained buffer, with no reloading or re-downloading. The trade-off is that these resources stay in memory while the audio is idle.

Best when you intend to replay the same audio and want instant, network-free playback (for example, short sound effects or repeated tones).