Queue-based player with native ReplayGain and Rockbox crossfade.
A player owns a live audio output device and a background engine thread, so it only works where an output device exists. The handle is a NIF resource, freed by the BEAM garbage collector (which stops playback).
ReplayGain mode here uses the player values: 0 off, 1 track,
2 album. Crossfade mode: 0 off, 1 auto-skip, 2 manual-skip,
3 shuffle, 4 shuffle-or-manual, 5 always. Mix mode: 0 crossfade,
1 mix.
Summary
Functions
Delete the resume file (forget the saved state).
Export the current queue to an .m3u8 file (atomic write).
Import an .m3u/.m3u8 playlist into the queue at position.
Insert file paths / URLs into the queue at position.
Replace the queue with an .m3u/.m3u8 playlist file.
Create a player on the default device with default settings.
Create a player with configuration overrides (see @default_config keys).
sample_rate: 0 means the device default.
The current queue as a list of path/URL strings.
Restore the queue + exact position from the player's resume file (does NOT
auto-play). Returns {:ok, %{tracks: [...], index: i, elapsed_ms: ms}} or
{:error, :absent} when there is nothing to resume.
Persist the queue + exact position to the resume file now.
Replace the queue with a list of file paths.
A snapshot of the player's status as an atom-keyed map.
Types
Functions
@spec clear_resume(t()) :: :ok
Delete the resume file (forget the saved state).
Export the current queue to an .m3u8 file (atomic write).
@spec import_m3u(t(), Path.t(), Rockbox.InsertPosition.t() | 0..7, non_neg_integer()) :: {:ok, [String.t()]} | {:error, term()}
Import an .m3u/.m3u8 playlist into the queue at position.
Returns {:ok, [path, ...]} with the imported entries, or {:error, reason}.
index is only used when position is :index (7).
@spec insert(t(), [Path.t()], Rockbox.InsertPosition.t() | 0..7, non_neg_integer()) :: :ok
Insert file paths / URLs into the queue at position.
position is a Rockbox.InsertPosition atom (or its integer code); index
is only used when position is :index (7).
Replace the queue with an .m3u/.m3u8 playlist file.
Returns {:ok, [path, ...]} with the loaded entries, or {:error, reason}.
@spec new() :: t() | nil
Create a player on the default device with default settings.
Create a player with configuration overrides (see @default_config keys).
sample_rate: 0 means the device default.
Pass resume_file: "/path/to/state.m3u8" (optionally with
resume_save_interval_ms:) to enable automatic queue+position persistence;
restore it later with resume/1.
@spec next(t()) :: :ok
@spec pause(t()) :: :ok
@spec play(t()) :: :ok
@spec previous(t()) :: :ok
The current queue as a list of path/URL strings.
Restore the queue + exact position from the player's resume file (does NOT
auto-play). Returns {:ok, %{tracks: [...], index: i, elapsed_ms: ms}} or
{:error, :absent} when there is nothing to resume.
@spec sample_rate(t()) :: non_neg_integer()
@spec save_resume(t()) :: :ok
Persist the queue + exact position to the resume file now.
@spec seek_ms(t(), non_neg_integer()) :: :ok
Replace the queue with a list of file paths.
@spec skip_to(t(), non_neg_integer()) :: :ok
A snapshot of the player's status as an atom-keyed map.
@spec stop(t()) :: :ok
@spec toggle(t()) :: :ok