Class Track<UserData, PluginInfo>

Represents a music track with metadata and playback information

Type Parameters

  • UserData extends JsonObject = CommonUserData
  • PluginInfo extends JsonObject = CommonPluginInfo

Constructors

Properties

id: string

Unique identifier of the track

title: string = "Unknown Track"

Title of the track

author: string = "Unknown Author"

Author/artist of the track

isLive: boolean = false

Whether the track is a live stream

isSeekable: boolean = false

Whether the track is seekable

duration: number = 0

Duration of the track in milliseconds

formattedDuration: string = "00:00"

Formatted duration string (hh:mm:ss or mm:ss)

uri: null | string = null

Uniform Resource Identifier of the track

isrc: null | string = null

International Standard Recording Code

url: null | string = null

URL of the track (validated URI)

artworkUrl: null | string = null

Artwork/thumbnail URL

userData: UserData = ...

Custom user data attached to the track

pluginInfo: PluginInfo = ...

Additional info from plugins

encoded: string

Encoded string representation (Lavalink format)

sourceName: string = "unknown"

Source name (youtube, spotify, soundcloud, etc.)

Accessors

  • get info(): {
        identifier: string;
        position: number;
        title: string;
        author: string;
        length: number;
        isStream: boolean;
        isSeekable: boolean;
        uri: null | string;
        isrc: null | string;
        artworkUrl: null | string;
        sourceName: string;
    }
  • Returns {
        identifier: string;
        position: number;
        title: string;
        author: string;
        length: number;
        isStream: boolean;
        isSeekable: boolean;
        uri: null | string;
        isrc: null | string;
        artworkUrl: null | string;
        sourceName: string;
    }

    • identifier: string
    • position: number
    • title: string
    • author: string
    • length: number
    • isStream: boolean
    • isSeekable: boolean
    • uri: null | string
    • isrc: null | string
    • artworkUrl: null | string
    • sourceName: string

Methods

  • JSON representation of the track

    Returns Record<string, unknown>