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.
Player is the primary class in the TextAlive App API. It implements the IPlayer interface and serves as the single entry point for loading songs, managing playback, and querying musical data.
Constructor
Initialization options for the player. See PlayerOptions for the full reference.
Properties
options
app
data
video
mediaElement
mediaSourceElement
mediaBannerElement
banner.
mediaPosition
Timer implementation.
videoPosition
wait
fps.
fps
wait.
isLoading
true while song information, lyrics, or other video data is being loaded.
isPlaying
true while the song is actively playing.
isVideoSeeking
true during an active seek operation. While seeking:
onTimeUpdateevents are suppressed.mediaPositioncontinues to update without triggering new render frames.
startVideoSeek and endVideoSeek to control this state when implementing a seekbar.
banner
mediaElement.
timer
Timer instance managing playback state. By default, SongleTimer is used. You can provide a custom timer via PlayerOptions.timer.
volume
0 (silent) to 100 (full volume).
Methods
addListener
Registers an event listener to receive player callbacks.An object implementing one or more of the callback interfaces. See Player events.
removeListener
Removes a previously registered event listener.The listener to remove.
true if the listener was found and removed; false otherwise.createFromSongUrl
Loads song map, lyrics, and timing data from a song URL, then constructs a video object.A full song URL (e.g., a Songle or piapro URL).
Optional overrides for video data. See PlayerVideoOptions.
Resolves with the constructed video object.
createFromSongPath
LikecreateFromSongUrl, but accepts a path (the URL without the https:// protocol prefix).
A song path string (e.g.,
"piapro.jp/t?id=...").Optional overrides for video data.
Resolves with the constructed video object.
createFromText
Generates a dummy song map and video object from plain text. Useful for testing without a real song.Plain text to use as lyrics.
Optional overrides for video data.
Resolves with the constructed video object.
createFromJSON
Constructs a video object directly from aVideoData JSON object.
A
VideoData object describing phrases and timing.Optional overrides for video data.
Resolves with the constructed video object.
getChoruses
Returns all chorus (repetitive) segments detected in the current song.Array of chorus segments. Returns an empty array if none are found.
findChorus
Finds the chorus segment that overlaps with the specified playback position.Position in milliseconds.
Optional search parameters (e.g.,
endTime for range overlap, loose for nearest-match).The matching chorus segment, or
null if none is found.findChorusChange
Looks for chorus segment transitions within a time range.Start of the time range in milliseconds.
End of the time range in milliseconds.
An object with
current, entered, left, previous, and next fields describing segment transitions in the range.getBeats
Returns all beats in the current song.Array of beats. Returns an empty array if the song map is not loaded.
findBeat
Finds the beat that overlaps with the specified position.Position in milliseconds.
Optional search parameters.
The matching beat, or
null if none is found.findBeatChange
Looks for beat transitions within a time range.Start of the time range in milliseconds.
End of the time range in milliseconds.
Beat transitions in the specified range.
getChords
Returns all chord progressions in the current song.Array of chord objects. Returns an empty array if the song map is not loaded.
findChord
Finds the chord progression that overlaps with the specified position.Position in milliseconds.
Optional search parameters.
The matching chord, or
null if none is found.findChordChange
Looks for chord progression transitions within a time range.Start of the time range in milliseconds.
End of the time range in milliseconds.
Chord transitions in the specified range.
getVocalAmplitude
Returns the vocal amplitude at the specified position.You must set
vocalAmplitudeEnabled: true in PlayerOptions before loading a song for this method to return data.Position in milliseconds.
Vocal amplitude at the given time. Ranges from
0 to the value returned by getMaxVocalAmplitude().getMaxVocalAmplitude
Returns the maximum vocal amplitude throughout the entire song.Requires
vocalAmplitudeEnabled: true in PlayerOptions.Maximum vocal amplitude value in the song.
getValenceArousal
Returns the valence/arousal coordinates at the specified position.Requires
valenceArousalEnabled: true in PlayerOptions.Position in milliseconds.
An object with
v (valence) and a (arousal) properties, both in the range [-1, 1].getMedianValenceArousal
Returns the median valence/arousal value across the entire song.Requires
valenceArousalEnabled: true in PlayerOptions.Median valence and arousal coordinates for the song.
setVideoPosition
Sets the video rendering position to the specified time.Target video position in milliseconds.
Resolves with the actual position that was set.
requestPlay
Starts or resumes music playback.true if the play request was accepted.requestStop
Stops playback and seeks to the beginning.true if the stop request was accepted.requestPause
Pauses music playback at the current position.true if the pause request was accepted.requestMediaSeek
Seeks the media playback to the specified position.Target media position in milliseconds.
true if the seek request was accepted.startVideoSeek
Begins a video seek operation. SetsisVideoSeeking to true and suppresses onTimeUpdate events.
endVideoSeek
Ends the video seek operation. SetsisVideoSeeking to false and resumes onTimeUpdate events.
requestStageUpdate
Forces an immediate re-render of the current video frame.Resolves with the current video position in milliseconds.
dispose
Destroys the player instance and releases all resources.Deprecated methods
| Method | Replacement |
|---|---|
setMediaElement(element: HTMLElement) | Assign to player.mediaElement directly |
setMediaPosition(position: number) | Use requestMediaSeek(position) instead |
findChorusBetween(startTime, endTime) | Use findChorus(time, options) instead |