Playback

Control audio transport, read playback state, and react to playback changes.

Playback API for plugins

The Playback API controls audio states: play, pause, stop, seek, and subscribe to state changes. It doesn't handle track navigation, use the Queue API for that.

circle-info

Access playback via api.Playback.* in your plugin's lifecycle hooks. All methods are asynchronous and return Promises.


Core concepts

Playback state

Playback state is exposed through a single object:

type PlaybackState = {
  status: PlaybackStatus;
  seek: number;      // Current position in seconds
  duration: number;  // Total duration in seconds
};

type PlaybackStatus = 'playing' | 'paused' | 'stopped';

seek and duration are always in seconds, not milliseconds.

Playback vs. Queue

These two domains divide playback responsibilities:

Domain
Responsibility

Playback

Audio transport: play, pause, stop, seek

Queue

Track navigation: next, previous, shuffle, repeat


Usage

circle-exclamation

Reference

Types

Last updated