TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/TextAliveJp/textalive-app-api/llms.txt
Use this file to discover all available pages before exploring further.
Player class fires events throughout the lifecycle of a lyric app — from loading data to frame-by-frame playback updates. You respond to these events by registering a listener object with player.addListener().
The PlayerListener type
PlayerListener is a composite type that merges three listener interfaces:
| Interface | Purpose |
|---|---|
PlayerEventListener | Playback state: position updates, seek, play/pause/stop |
PlayerAppListener | App lifecycle: host connection, parameter changes, song changes |
LoaderListener | Data loading: fonts, lyrics, song map |
Registering and removing listeners
removeListener returns true if the listener was found and removed.
PlayerEventListener callbacks
These callbacks fire in response to playback mechanics.onVideoReady
The constructed video object containing all phrases, words, and characters with their timing information.
onTimerReady
Timer is ready for playback. At this point the player can start playing music. This fires after onVideoReady.
The timer instance controlling playback. Gives access to
isPlaying, position, and wait.onMediaElementSet
The updated media element.
onVolumeUpdate
Current volume, ranging from
0 to 100.onTimeUpdate
position using player.video.findChar(position) and update your visuals accordingly.
Current playback position in milliseconds.
onThrottledTimeUpdate
onTimeUpdate. Fires at a lower frequency controlled by PlayerOptions.throttleInterval. Use this for UI elements that do not need per-frame precision — for example, updating a progress bar or a lyrics text overlay.
Current playback position in milliseconds.
onMediaSeek
New media position in milliseconds.
onVideoSeekStart
onTimeUpdate is suppressed. Useful for pausing canvas animations during a scrub.
onVideoSeek
Video position in milliseconds during the seek.
onVideoSeekEnd
onTimeUpdate events resume.
onPlay
onPause
onStop
onSeek
Target position in milliseconds.
onSeekComplete
Final position in milliseconds after the seek.
onDispose
player.dispose(). Use this to release any resources your app has allocated.
PlayerAppListener callbacks
These callbacks track the lifecycle of your lyric app’s connection to the TextAlive API server and an optional host.onAppLoad
The app object, including connection status, song URL, and parameter values.
If the connection to the API server failed, this contains a human-readable error message.
onAppReady
app.managed here to decide whether to load a song manually.
The app object. When
app.managed is false, no host is connected and you should call player.createFromSongUrl() yourself.onAppParameterUpdate
The name of the parameter that was updated, matching one of the
name fields in your PlayerAppOptions.parameters array.The new value. Type is
IColor | string | number | boolean depending on the parameter widget.onAppMediaChange
The new song URL provided by the host.
A promise that resolves when the video object and timer are both ready. Await this to know when you can safely access lyrics data.
LoaderListener callbacks
LoaderListener is itself a combination of DataLoaderListener (= VideoLoaderListener & SongLoaderListener & TextLoaderListener & FontLoaderListener) and additional internal listeners.
onFontsLoad
The list of fonts that were successfully loaded.
Present when one or more fonts failed to load. The
reason.fonts array lists the fonts that could not be loaded.SongLoaderListener events
| Callback | When it fires |
|---|---|
onSongLoad(song, reason?) | Song metadata is loaded |
onSongMapLoad(songMap, reason?) | Beat, chord, and segment data is loaded |
onVocalAmplitudeLoad(data, reason?) | Vocal amplitude data is loaded (requires vocalAmplitudeEnabled: true) |
onValenceArousalLoad(data, reason?) | Valence/arousal data is loaded (requires valenceArousalEnabled: true) |
TextLoaderListener events
| Callback | When it fires |
|---|---|
onLyricsLoad(lyrics, reason?) | Lyrics timing information is loaded |
onTextLoad(lyricsBody, reason?) | Lyrics text content is loaded |