index ↓

lyrics

client.lyrics

requests

you ask, the daemon answers. await the tagged result and check .ok

get(): Promise<TypedRequestResult<LyricsReply, LyricsErrorReply>>

push form: onLyricsReply (subscribe instead of awaiting)

Returns the lyrics for the track that is playing.

const res = await client.lyrics.get();
if (res.ok) {
  console.log(res.response.lyrics);
} else {
  console.warn(res.kind, res.error);
}

types

shapes referenced above, as the sdk types them

type LyricsReply = {
  lyrics?: Lyrics;
};
type LyricsErrorReply = {
  message: string;
};

synced and plain are independent; either can be null.

type Lyrics = {
  synced?: LyricLine[];
  plain?: string;
  source: string;
};
type LyricLine = {
  startMs: number; // Offset from track start.
  text: string;
};