Skip to content
This repository was archived by the owner on Jan 29, 2026. It is now read-only.

API Types

github-actions[bot] edited this page Jan 26, 2026 · 1 revision

数据类型 (Types)

Track

核心音频对象结构。

export interface Track {
  /** 唯一标识符 */
  id: string;

  /**
   * 音频流地址。
   * 特殊协议: orpheus://bilibili?bvid=...
   */
  url: string;

  /** 标题 */
  title?: string;

  /** 艺术家 */
  artist?: string;

  /** 封面图 URL */
  artwork?: string;

  /** 时长 (秒) */
  duration?: number;

  /**
   * 响度标准化参数
   * 用于 ReplayGain 或类似处理
   */
  loudness?: {
    measured_i: number; // 测量的各向同性响度 (LUFS)
    target_i: number; // 目标响度
  };
}

PlaybackState

播放器状态枚举。

export enum PlaybackState {
  IDLE = 1, // 空闲 / 无资源
  BUFFERING = 2, // 缓冲中
  READY = 3, // 准备就绪 / 可播放
  ENDED = 4, // 播放结束
}

RepeatMode

重复模式。

export enum RepeatMode {
  OFF = 0, // 不重复
  TRACK = 1, // 单曲循环
  QUEUE = 2, // 列表循环
}

DownloadTask & DownloadState

下载任务详情。

export enum DownloadState {
  QUEUED = 0,
  STOPPED = 1,
  DOWNLOADING = 2,
  COMPLETED = 3,
  FAILED = 4,
  REMOVING = 5,
  RESTARTING = 7,
}

export interface DownloadTask {
  id: string;
  state: DownloadState;
  percentDownloaded: number; // 0 - 100
  bytesDownloaded: number;
  contentLength: number;
  track?: Track; // 关联的 Track 对象信息
}

Clone this wiki locally