AnDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pompom454/tea/llms.txt
Use this file to discover all available pages before exploring further.
AudioList represents a playlist — a sequenced collection of audio tracks that plays one after another. You obtain an instance via SimpleAudio.lists.get(listId) after registering the playlist with SimpleAudio.lists.add(). Playlists support shuffle mode, looping, per-list volume and mute, and the same fade methods available on individual tracks.
Playlists are for sequential playback. If you want to apply simultaneous operations to multiple tracks without sequencing them, use a group instead.
Playback methods
<AudioList>.play() → Promise
Begins playback of the playlist from the current track. Returns a Promise that resolves when playback starts, or rejects with an error.
<AudioList>.playWhenAllowed()
Begins playback immediately if allowed, or queues the playlist to begin as soon as the player next interacts with the document. Use this when autoplay restrictions may block play().
<AudioList>.pause()
Pauses playback of the playlist at the current track’s current position.
<AudioList>.stop()
Stops playback of the playlist and resets it to the beginning of the current track.
<AudioList>.skip()
Skips ahead to the next track in the playlist. If the playlist is at its last track, behavior depends on the loop state.
<AudioList>.load()
Pauses playback and forces all tracks in the playlist to drop existing buffered data and reload from source.
<AudioList>.unload()
Stops playback and forces all tracks in the playlist to drop their buffered data. Playback cannot resume until the tracks are reloaded.
Once unloaded, the playlist cannot play until its tracks have been loaded again.
Fade methods
Fade methods operate on the currently playing track within the playlist.<AudioList>.fade(duration, toVol [, fromVol]) → Promise
Starts playback and fades the current track from an optional starting volume to a destination volume over the given seconds.
When
Config.audio.pauseOnFadeToZero is true (the default), tracks faded to 0 are automatically paused.Number of seconds for the fade.
Destination volume (0–1).
Starting volume (0–1). Defaults to the current track’s current volume.
<AudioList>.fadeIn(duration [, fromVol]) → Promise
Starts playback and fades the current track up to 1 (loudest) over the given number of seconds.
Number of seconds for the fade.
Starting volume. Defaults to the current track’s current volume.
<AudioList>.fadeOut(duration [, fromVol]) → Promise
Starts playback and fades the current track down to 0 (silent) over the given number of seconds.
Number of seconds for the fade.
Starting volume. Defaults to the current track’s current volume.
<AudioList>.fadeStop()
Interrupts an in-progress fade on the current track. The volume is left at whatever level it had reached.
State methods
Methods that set state return theAudioList instance for chaining.
<AudioList>.volume([level]) → number | AudioList
Gets or sets the playlist’s volume level (default: 1).
Volume level to set (0–1).
<AudioList>.mute([state]) → boolean | AudioList
Gets or sets the playlist’s mute state (default: false).
true to mute, false to unmute.<AudioList>.loop([state]) → boolean | AudioList
Gets or sets whether the playlist restarts after reaching the end of its last track (default: false).
true to loop, false to play once.<AudioList>.shuffle([state]) → boolean | AudioList
Gets or sets the playlist’s shuffle state (default: false). When enabled, tracks are played in a randomly shuffled order.
true to enable shuffled playback, false for sequential.<AudioList>.time() → number
Returns the playlist’s current playback position within the active track in seconds, or NaN if no metadata exists.
Unlike
AudioTrack.time(), the playlist version is read-only — it does not accept a value to seek to.<AudioList>.duration() → number
Returns the playlist’s total playtime in seconds across all tracks. Returns Infinity if any track is a stream, or NaN if metadata is unavailable.
<AudioList>.remaining() → number
Returns how many seconds remain in the playlist. Returns Infinity if any track is a stream, or NaN if metadata is unavailable.
State query methods
All state-query methods return aboolean and take no arguments.
| Method | Returns true when… |
|---|---|
isPlaying() | The playlist is actively playing. |
isPaused() | Playback has been paused. |
isStopped() | Playback has been stopped. |
isEnded() | The playlist played all tracks to the end (without looping). |
isFading() | A fade is in progress on the current track. |
Event methods
These are thin wrappers over jQuery’s event methods applied to the underlying audio elements. Always use a custom namespace to avoid conflicts with Tea’s internal event handling.<AudioList>.on(events, handler) → AudioList
Attaches a persistent event handler.
<AudioList>.one(events, handler) → AudioList
Attaches a single-use event handler that fires once and then removes itself.
<AudioList>.off(events [, handler]) → AudioList
Removes event handlers from the playlist.
Audio events
| Event | Fires when… |
|---|---|
:faded | A fade on the current track completes normally. |
:fading | A fade on the current track starts. |
:stopped | Playback is stopped via .stop(). |