Documentation 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.
Overview
Player is the primary class of the TextAlive App API. Every lyric app starts by constructing a Player instance. It is responsible for:
- Loading a song’s musical analysis (beats, chords, chorus segments) from Songle
- Fetching and timing lyrics text
- Managing audio playback through a pluggable
Timer - Firing lifecycle events so your app can react to playback state changes
Player class implements the IPlayer interface, which defines the full surface area of the API.
Minimal initialization
When
app is set in PlayerOptions, the player automatically reads the
?song= query parameter and connects to the TextAlive host if the app is
embedded inside one.PlayerOptions
Pass an options object to thePlayer constructor to configure its behaviour.
Lyric app registration options. When this property is set the player reads
the song URL from the query string and tries to communicate with the
TextAlive host. Set
app.token to your developer token obtained from the
TextAlive portal.The
Timer implementation that drives audio playback and position updates.
Defaults to SongleTimer when not specified. Pass new BasicTimer() to
run without audio (useful for debugging).The DOM element (or a CSS selector string) that hosts the audio element
and the attribution banner. The player appends its media node as a child
of this element.
Minimum interval in milliseconds between emissions of the
onThrottledTimeUpdate event. Use this to rate-limit expensive DOM
updates. The onTimeUpdate event is always fired at the timer’s native
rate regardless of this setting.A list of font families to pre-load. Pass
null to load every font
available on TextAlive. Omit the option to load no extra fonts at startup.Set to
true to enable vocal amplitude data loading. Required before
calling player.getVocalAmplitude(time) or
player.getMaxVocalAmplitude().Set to
true to enable valence/arousal data loading. Required before
calling player.getValenceArousal(time) or
player.getMedianValenceArousal().IPlayer properties
Once constructed, you access the player’s state through read-only properties.| Property | Type | Description |
|---|---|---|
app | IPlayerApp | App status: managed/host mode, song URL, connection state |
data | IDataLoader | Loaded song map, lyrics, and font state |
video | IVideo | The constructed video object containing phrases, words, and chars |
mediaPosition | number | Current media playback position in milliseconds, updated periodically by the timer |
videoPosition | number | Current video position in milliseconds, updated after each rendered frame |
isLoading | boolean | true while any song data is still loading |
isPlaying | boolean | true while the timer is actively playing |
banner | IPlayerBanner | The attribution banner displayed inside mediaElement |
timer | Timer | The active timer instance |
volume | number | Playback volume in the range [0, 100] (read/write) |
wait | number | Frame interval in milliseconds (inverse of fps, read/write) |
fps | number | Target frame rate in frames per second (read/write) |
Playback control
All playback methods returnboolean indicating whether the request was accepted.
Song loading methods
Each method fetches the song map from Songle and builds theIVideo object.
All four return Promise<IVideo> and fire onVideoReady when complete.
PlayerVideoOptions second argument to override the lyrics ID, beat revision, or supply raw VideoData:
Event listeners
Register aPlayerListener to receive lifecycle callbacks:
Dispose
Callplayer.dispose() to release all resources (audio context, timers, DOM nodes) when your app unmounts.
For the complete property and method reference see /api/player.