Compás Developers

Create plugins

Start with a small Lua script, then add screens, playback tools and music services.

Plugins add features to the player with plain Lua: new screens, settings, themes, streaming sources, automations. No compiler, rebuild or firmware flash is needed.

Ready-made plugins live in the compas-plugins repository. The in-app Plugin Store (Settings > System > Plugin Manager > Plugin Store) installs from it. Browse it for real examples, or contribute your own. Browse published plugins and standalone examples.

Tools that install plugins on a card from a computer should also write the store record and the disabled list; their formats are in the Compás Tools sources (record.rs for .plugins/.store_installed and disabled.rs for .plugins/.disabled).

Contents

Quick start

  1. Create a .lua file.
  2. Give the plugin an identity with plugin.define().
  3. Add a way to open it, for example a row in Settings.
  4. Copy the file to <SD card>/.plugins/.
  5. Open Settings > System > Plugin Manager and tap Refresh Plugins, or restart the player.
plugin.define({
    id = "org.example.hello",
    name = "Hello Player",
    version = "1.0.0",
    api_min = 1,
})

plugin.register_list_item("settings", "Hello Player", function()
    plugin.show_list("Hello Player", { "The plugin is working!" }, function(index)
        plugin.show_toast("Selected row " .. index)
    end)
end)

Save it as <SD card>/.plugins/HelloPlayer.lua. The row appears under Settings > System > Additional Tools.

Tip: start from the example closest to what you want to build. Audiobooks.lua, NetRadio.lua, LastFmScrobblerV2.lua, or the historical Themes.lua reference cover common shapes.

How plugins run

Loading

  • Every *.lua file directly inside <SD card>/.plugins/ is a plugin (/data/mnt/sd_0/.plugins/ on the device, ./music/.plugins/ on the simulator). Subfolders are not scanned, but plugins can keep their own files there.
  • Plugins load at startup, and again on Refresh Plugins or plugin.reload_ui(). Each one runs its file from top to bottom once; this is where it registers rows, tiles and events.
  • Files load in alphabetical order (byte-wise, case-sensitive). Up to 32 enabled plugins load; Plugin Manager marks the rest "not loaded: plugin limit reached".
  • Some settings are global and the last plugin to set them wins, for example colors, icons and the Home layout. Because the order is alphabetical, the winner is always the same.
  • Each plugin has its own Lua state, kept alive for as long as it is loaded, so callbacks can run at any time later.
  • A plugin that fails to load is skipped and logged; the others are not affected. A callback that raises an error is logged and the player keeps running.

Sandbox

Plugins come from the SD card, so they don't get the full Lua standard library:

  • Removed: load, loadstring, loadfile, dofile, require, package, debug, os.execute, os.getenv, os.exit, os.tmpname and io.popen. A plugin must be a single file; it cannot load other Lua files or run shell commands.
  • Kept: the rest of io (including io.open), and os.time, os.date, os.clock, os.difftime, os.remove and os.rename, so plugins can keep their own state files.
  • File access is otherwise unrestricted, with one exception: nothing can touch /usr/data/.compas/plugins/, where plugin.storage and plugin.secrets keep their data. Every plugin.* function that takes a path refuses paths inside it with an error; so do Lua's io and os functions (io.open, os.remove and os.rename return nil, error, the others raise).

Time limit

Each run of plugin code (the top-level code, a callback, an event, a timer tick) may use at most 2 seconds of Lua time. Time spent inside plugin.* functions (copying icons, a slow HTTP request) doesn't count, but a runaway loop is stopped. File reads through Lua's own file handles do count.

Where your plugin appears

Entry point Function Limit
A row in a native list register_list_item 16 in Playback & Controls or Sound; 8 in other lists, all plugins together
An action in the now-playing menu register_list_item 8 actions, all plugins together; requires ui.player_menu
A row in More register_list_item 4 rows, all plugins together; requires ui.more_menu
A tile in Stream Media register_stream_media_tile 5 tiles
A tile on Home register_home_tile 6 tiles, shown only when a Home layout lists them
An on/off tile in the quick drawer register_quick_toggle 4 tiles

The lists that accept rows:

list_id Where the row appears Good for
"player" Now Playing > three-dot menu, after Information Track tools and playback actions
"more" More, after the built-in entries (limit 4) Standalone tools and launchers
"books" Books Readers, audiobooks, reference tools
"music" Music Music services, libraries and tools
"settings" Settings > System > Additional Tools General plugin settings
"display" Settings > Display Themes and visual tools
"playback" Settings > Playback & Controls Resume and playback tools
"music_audio" Settings > Sound EQ, DSP, gain and volume tools
"music_controls" Settings > Playback & Controls > Buttons & Remote Button and remote behavior
"music_timers" Settings > Power Sleep and idle timers
"music_library" Settings > Library Scanning, tagging, scrobbling
"power" Settings > Power Battery and power tools
"system" Settings > System Device and maintenance tools

Rows from different plugins share a list, up to 16 in playback or music_audio and 8 in other lists, and the list scrolls. Any other list_id is an error.

Use plugin.has_capability("ui.player_menu") before registering a "player" row. Its callback runs when the action is tapped and may open a plugin screen or perform an action. The player menu scrolls when its built-in and plugin actions exceed the available height. This is additive and does not require a newer API version.

Use plugin.has_capability("ui.more_menu") before registering a "more" row. It is shown after Emulators with the same look as the built-in entries; the icon option is resolved like for other rows (absolute path, or relative to .plugins/) and drawn at the native 44 px size. At most 4 "more" rows are shown in total. This is additive and does not require a newer API version.

Identity and compatibility

plugin.define(info)

Declare who the plugin is, once, at the top of the file:

plugin.define({
    id = "org.example.my_plugin",  -- letters, digits, ".", "_", "-"; must be unique
    name = "My Plugin",
    version = "1.0.0",
    api_min = 2,                   -- refuse to load on an older player
})
  • The id names the plugin's private storage, so keep it stable across versions. Two plugins with the same id are an error.
  • api_min stops the plugin from loading on a player whose API is older.
  • Plugins without define() still work. They get an id from their file name, made unique with a short hash of the path if needed.

Checking what the player supports

  • plugin.api_version() returns the API version, 19 on player builds that include API 19 (check it; older firmware reports less).
  • plugin.has_capability(name) returns whether one feature exists. Prefer it over api_min when you only need one feature. Tokens:
Area Tokens
UI ui.list, ui.settings, ui.row_width, ui.text_input, ui.confirmation, ui.toast, ui.progress, ui.screenshot, ui.theme, ui.theme_refresh, ui.reload, ui.home_layout, ui.home_tiles, ui.launcher_layout, ui.home_background, ui.lock_screen, ui.button_lock, ui.quick_toggle, ui.text_view, ui.text_view_images, ui.list_grid, ui.list_showing, ui.list_update, ui.list_scroll_reset, ui.list_wrap, ui.settings_list_wrap, ui.settings_list_10_sliders, ui.order_editor, ui.player_layout_xml, ui.now_playing.set_image, ui.now_playing.set_text, ui.file_manager, ui.file_picker, ui.color_picker, ui.list_hold, ui.menu, ui.text_view_style, ui.text_view_replace, ui.startup_image
Playback and audio playback.control, playback.state, playback.events, playback.lyrics_refresh, playback.progress, playback.remote, playback.remote_resolve, playback.transport_skip, playback.speed, playback.format, playback.output_info, playback.silent_volume, playback.transient_volume, playback.output_events, playback.settings, playback.ab_loop, playback.ab_switch, playback.http_seek, audio.loop, audio.peq, audio.peq.transient, audio.peq.state, audio.stereo_width, audio.crossfeed, audio.crossfeed.angle, audio.hw_volume_curve, audio.mseb.stock, audio.soundstage
Files filesystem.sd, filesystem.realpath, filesystem.mkdir, filesystem.playlists, filesystem.file_ops
Language i18n.tr
Storage storage.namespaced, storage.secrets, storage.secrets_get
Network network.http.sync, network.http.async, network.http.download, network.http.download_progress, network.status
Data data.json, crypto.md5, data.zip, data.zip_image, data.image_thumbnail, data.wallpaper, data.html
Library library.album_cover, library.artist_albums, library.paged, library.refresh, library.track_metadata
Apps apps.list, apps.launch
  • LEDs depend on the model: check plugin.led_available() instead.
  • plugin.get_app_info() returns { version, build, platform, plugin_api }.

API versions

Version Added
2 storage, secrets, json_decode/json_encode, media_capabilities, download_file_async, mkdir, and the full http_request (headers, all methods, timeouts, redirects, response headers, real cancel). The sandbox also removed require, dofile and friends in this release.
3 play_remote, queue_remote_list, and provider/track_id on track_started
4 set_home_layout
5 reload_ui
6 refresh_theme
7 register_home_tile and order in set_home_layout
8 set_launcher_layout
10 background_image in set_home_layout
11 set_hw_volume_curve
12 register_quick_toggle, set_quick_toggle
13 LED control, get_volume, get_battery, and the volume_changed, battery_changed, suspending and system_resumed events
14 zip_read, zip_list, zip_image_async, html_to_blocks, show_text_view with pictures, grid lists, is_list_showing, and one long (4095-byte) HTTP header per request
15 Full XML Player-layout support (ui.player_layout_xml), including plugin-bundle discovery, current named-widget features, companion PNG previews, and resolution-specific XML variants using @WIDTHxHEIGHT or _WIDTHxHEIGHT filenames
16 Playback speed/stereo width/progress plus format/output snapshots, silent volume, transient EQ, output events, playback settings, native A–B loops/comparison, and finite HTTP seeking. Modeless progress bars and download byte snapshots are also available, as are File Manager operations and the native file picker.
17 Consolidated additions after API 16: player-layout actions and owner-scoped background layout restoration; native hardware button lock and its event; top-level Music submenu plugin actions and native confirmation dialogs; current-track lyrics refresh; and the instrument dashboard layout. Plugins using these features require API 17, and the store rejects installation on older firmware.
18 Player builds from the next release after 17: plugin.network_status() and the network_changed event (capability network.status). Also plugin.realpath() (capability filesystem.realpath) and plugin.now_playing.set_image() / plugin.now_playing.set_text() for custom widgets in plugin XML Now Playing layouts (capabilities ui.now_playing.set_image, ui.now_playing.set_text). Prefer feature detection with has_capability("network.status") over raising api_min.
19 show_list on_hold (capability ui.list_hold), plugin.show_menu() (ui.menu), and the show_text_view options text_size and colors (ui.text_view_style) and on_end and replace (ui.text_view_replace), and plugin.language() / plugin.tr() (i18n.tr).

All of these are additions; older plugins keep working.

Headphone crossfeed is the capability audio.crossfeed (plugin.eq_get_crossfeed / plugin.eq_set_crossfeed). It does not raise PLUGIN_API_VERSION. Check the capability; do not require a newer api_min. The additive capability audio.crossfeed.angle indicates the optional angle field in get_eq_state() / eq_apply_state(); it does not raise the API version.

Stock MSEB is available through the additive API 16 capability audio.mseb.stock. plugin.mseb_apply_state(state) atomically applies a configuration with enabled (boolean), the integer controls temperature, bass_ext, bass_texture, thickness, vocal_pos, female_vocal, sibilance_lf, sibilance_hf, impulse_tone, and air (each -100..100), and width (finite number 0..2, with 1 neutral). Invalid state raises a Lua argument error before any field changes. plugin.get_mseb_state() returns the same fields. This native configuration is transient and is reset when the plugin manager deinitializes; plugins must retain their own saved settings. When enabled, stock MSEB overrides the manual PEQ bands, preamp and stereo width while retaining independent crossfeed. The manual EQ configuration is kept intact and becomes audible again when MSEB is disabled.

The native Soundstage stage is the additive capability audio.soundstage; it does not raise PLUGIN_API_VERSION, so check the capability instead of raising api_min. It creates a sense of space on headphones from three parts, in this order: a side EQ, early reflections, and a binaural virtual-speaker head model. plugin.soundstage_apply_state(state) atomically applies a configuration in which every field is required: enabled (boolean) and the numbers speaker_angle_deg (10..60, default 30), binaural_amount (0..1, default 0), side_db (-12..6, default 0), side_low_db (-12..6, default 0), side_low_hz (50..500, default 150), side_high_db (-12..6, default 0), side_high_hz (2000..12000, default 5000), reflections (0..1, default 0), room_size (0..1, default 0.5) and damping (0..1, default 0.5). Any missing, mistyped, non-finite or out-of-range field raises a Lua argument error before anything changes. It returns true once the state is applied. plugin.get_soundstage_state() returns the same fields.

  • The side EQ (side_db and the two shelves) changes only the side (left minus right) signal. The mid (left plus right) is left exactly as it is. Boosts are capped at 2x (6 dB) in combination; any resulting peaks are handled by the output limiter.
  • The binaural part is normalised so it does not add level: its side path is scaled so that its largest gain, checked on a frequency grid, is at most about 1 (the unscaled path would peak about 4 to 7 dB near 1 to 2 kHz, depending on the angle). A mono source passes through it unchanged.
  • The stage is bit-identical to bypass while disabled, and also while enabled with binaural_amount, reflections, side_db, side_low_db and side_high_db all 0. Enabling, disabling and changing values ramp smoothly.
  • It works on stereo streams only. It sits after the PEQ, MSEB, crossfeed and stereo width stages and before the output limiter. It is independent of PEQ bypass and of MSEB, and works alongside them.
  • Like MSEB, the native configuration is transient: it is reset when the plugin manager deinitializes or the plugin that enabled it fails to load, and plugins must retain their own saved settings.

Screens

plugin.register_list_item(list_id, label, on_open [, options])

Adds a row to a native list (see Where your plugin appears). on_open() runs when the row is tapped; open your first screen from there.

options may contain the row options icon, height, width and text_size, plus group (up to 32 bytes) to place the row in a submenu:

  • In music_audio: "effects" (under Sound Effects) or "profiles" (under Equalizer > Profiles > Download profiles).
  • In display: "appearance" or "player_layout" (under those submenus).
  • Other values leave the row directly in its list. Older players ignore group.

A plugin may register several rows. Playback and Music Audio accept 16 rows each; other lists, including Music, accept 8. The limit includes all plugins together. Exceeding it is an error.

plugin.register_stream_media_tile(label, on_open [, icon])

Adds a tile to Stream Media, after Subsonic. Good for streaming and radio plugins. icon is a theme image path, default "stream_media/radio.png". Up to 5 plugin tiles; the grid doesn't scroll.

Builds with ui.breeze_stream_icons (additive within API 17) also ship "stream_media/jellyfin_row.png", a Breeze server icon in Jellyfin colors, and show Breeze art in place of "stream_media/podcasts_row.png" and "stream_media/radio_row.png" unless the active theme supplies that image.

plugin.register_home_tile(id, label, on_open, icon)

Registers a tile that a Home layout can show (see set_home_layout). Registering alone doesn't show it: it appears once a layout's order lists its id.

  • id: 1 to 39 letters, digits, ., _ or -, unique among all Home tiles, and not a native key (music, stream_media, wireless, books, settings, dac, subsonic).
  • icon: required, a theme image path of at most 79 characters.
  • Up to 6 plugin tiles.

plugin.register_quick_toggle(id, label, on_change, options)

Adds an on/off tile to the quick drawer's expanded area (pull the drawer down, then drag the handle below the first row). Use it for a simple switch; use a list row for anything that needs a screen.

  • id: 1 to 39 letters, digits, ., _ or -, unique.
  • label: short caption, about 8 characters fit.
  • on_change(new_value): called with the new boolean when tapped.
  • options.icon (required, under 80 characters): the off-state image. Like settings row icons it may be a path under the plugin folder, for example "MyPlugin/icon.png" (looked up at <sd>/.plugins/MyPlugin/icon.png), or a theme path such as "pull_down/x.png". A file found under .plugins wins; otherwise the theme path is used. An absolute path is used as given.
  • options.icon_selected: the on-state image. Default: icon with _s.png in place of its extension. It is recolored to the accent color. It follows the same lookup as icon.
  • options.value: initial state, default false.
  • options.on_text, options.off_text: state captions, default "On" and "Off".
  • options.on_hold(): called when the tile is held, for example to open the plugin's settings.

Up to 4 tiles from all plugins; they fill the drawer's third row in registration order.

if plugin.has_capability("ui.quick_toggle") then
    plugin.register_quick_toggle("mseb", "MSEB", function(on) set_enabled(on) end,
        { icon = "pull_down/mseb.png", value = enabled })
end

plugin.set_quick_toggle(id, value)

Updates the tile's state without calling on_change. Use it when the plugin changes the setting elsewhere, such as its own settings screen.

plugin.show_list(title, items, on_select [, options])

Opens a list screen and returns a handle (nil on players older than API 14).

  • items: one entry per row. Either a string, or a table { label = "...", icon = "...", text_size = "...", wrap = true }.
  • Labels are up to 159 bytes, or 511 with wrap = true, which wraps the label onto several lines and grows the row instead of scrolling it (check ui.list_wrap).
  • Up to 500 rows; the rest are dropped.
  • on_select(index): called with the 1-based index of the tapped row. Not called if the user goes back.
  • options:
  • height, width: size of every row (see row options).
  • replace = handle: API 16, ui.list_update. Replaces this plugin's currently visible list in place without pushing navigation. Returns a new handle; the old handle expires. Returns nil without changing the screen for a closed, covered, foreign, or superseded handle. Keep the returned handle for later pages and guard asynchronous completions with it.
  • reset_scroll = true: API 17, ui.list_scroll_reset. With replace, rebuilds the current list at the top. Omit it to preserve the existing scroll position during refreshes. New list screens already start at the top.
  • selected: 1-based row drawn with an accent outline. The outline follows later taps.
  • layout = "grid": shows cards instead of rows. Each card shows its icon in a 2:3 portrait area (fitted, not cropped, like a book cover) with the label below in up to two lines; without an icon, the label fills the card. height and width don't apply. Check ui.list_grid.
  • columns: cards per row in a grid, 2 to 4, default 3.
  • on_hold(index): called with the 1-based index of a row or card that was long-pressed, in any layout. The release that follows does not select the row. Must be a function. It lives and is replaced exactly like on_select, so a replace call without on_hold removes it. API 19, ui.list_hold.

Calling show_list again (for example from on_select) opens a new screen on top, and Back returns to the previous one with its own callback. Up to 4 lists can be stacked; going deeper breaks Back navigation.

plugin.is_list_showing(handle) returns true while that list is the screen in front. Check it before opening a screen from a late callback (an HTTP response, a finished image job), so you don't open it over whatever the user moved on to. Check ui.list_showing.

Rows with icons use the native submenu look (44 px icons, 96 px rows, a blue gradient that a custom list_row color replaces). Text-only lists stay compact.

plugin.show_settings_list(title, items [, options])

Opens a screen that looks like a native Settings submenu, with real switches and sliders. Each item is a table with type and label:

plugin.show_settings_list("My Plugin", {
    { type = "row",    label = "About",  on_select = function() ... end },
    { type = "toggle", label = "Enable", value = true, on_change = function(on) ... end },
    { type = "slider", label = "Boost",  min = 0, max = 12, value = 3,
      on_change = function(v) ... end },
})

API 17 adds options.layout = "dashboard" (ui.settings_dashboard) for an instrument-style control panel. Supply exactly seven items: a primary action, an integer slider, a secondary action, and four settings actions. The slider becomes a large numeric dial with direct −/+ controls; actions retain their existing callbacks. Its range must fit signed 16-bit integers and its value must be inside that range. Native surfaces and fonts follow the player theme; dashboard accents use the player's accent color and icons follow the foreground color. The six action buttons share one equal-cell grid; per-row sizes are reserved for the ordinary list layout.

Dashboard options also accept markers (0–12 static rhythm markers), accent_first (boolean, default true), active (boolean), and detail (a short caption on the second settings tile). Markers describe the configured pattern; they are not an audio-synchronized beat animation. update = true uses the same stable-title update behavior as lists. A dashboard cannot include a lock screen preview. Require api_min = 17 when using this layout.

  • row: on_select() runs on tap. Open another show_settings_list from it for a nested submenu.
  • toggle: on_change(new_value) runs on every tap.
  • slider: integer range min to max. on_change(new_value) runs once, when the finger is lifted.
  • Every type accepts the row options icon, width and text_size; height works on rows and toggles but not sliders. Rows and toggles also accept wrap = true for labels up to 511 bytes (95 without it). Check ui.settings_list_wrap.
  • Up to 24 items and 10 sliders per screen on builds with ui.settings_list_10_sliders; older builds allow 4 sliders. Extra rows or sliders beyond these limits are dropped. This additive capability does not raise the plugin API version; check it before showing a flat list that needs more than 4 sliders. A missing type, an unknown text_size, or a missing callback is an error.
  • Up to 2 settings screens can be stacked.
  • Optional third argument options supports update = true, which refreshes the deepest live settings screen with the same title in place, without adding a navigation entry. If no live screen has that title, it opens a new screen normally. Use this when a child chooser changes a value shown by its covered parent.
  • options.preview accepts the same mode, image_path, image_fit, and clock_24h fields as plugin.show_lock_screen(). It embeds a live lock screen preview above the settings rows.

plugin.show_order_editor(title, items, on_change)

Opens the native drag-and-toggle editor for an ordered set of plugin settings. Hold the leading grip to drag an item; use the trailing switch to change its visibility. Each item is { key, label, visible }, where key is a unique stable string and visible is a boolean. The list must contain 1–24 entries.

plugin.show_order_editor("Music Menus", {
    { key = "albums", label = "Albums", visible = true },
    { key = "artists", label = "Artists", visible = true },
    { key = "genres", label = "Genres", visible = false },
}, function(items)
    -- Save the complete ordered list, including hidden entries.
end)

on_change(items) runs after each switch change and after a completed drag. It receives a fresh, dense array in the current order, with each entry keeping its key, label and visible fields. Changes are delivered immediately so the plugin can save or apply them; Back does not send another callback. Only one order editor can be open at a time. Check ui.order_editor before using this API.

Row options

These optional fields work in register_list_item options, show_list items and show_settings_list items. In show_list, height and width go in the call's options so every row matches.

Field Meaning
icon An image shown left of the label, scaled to a fixed size. An absolute path, or a path relative to <SD card>/.plugins/. A missing image is skipped, not an error.
height Row height in px, clamped to 100 to 220. Default: 124 for list rows added with register_list_item, 84 for plain show_list rows.
width Row width in px, clamped to 240 to 464, kept centered.
text_size "small", "medium", "large" (with fallback fonts for Cyrillic, CJK, Korean and Thai) or "mono" (an ASCII-only pixel font). Any other value is an error.

When text_size is omitted on show_list items and show_settings_list rows, text uses the native body font at the current user font tier, including any selected custom font. An explicit size uses its fixed built-in font instead.

plugin.show_text_input(title, initial_text, is_password, on_submit)

Opens the app's keypad text entry (the one used for Wi-Fi passwords). on_submit(text) runs when the user presses Enter; it doesn't run if they go back. Returns true, or false, "text input busy" if another request is open. You can open the next input from inside on_submit (for example a username, then a password).

plugin.show_confirmation(title, confirm_label, on_confirm)

Opens a native confirmation popup with the given title, a confirm action, and a Cancel action. on_confirm() runs only after the confirm action is tapped; Cancel, the backdrop, and plugin reload dismiss the popup without calling it. Returns true, false, "confirmation busy" if another confirmation is open, or false, "unable to show confirmation" if the popup cannot be created. Only one confirmation can be open at a time. The pending callback is released when the popup is cancelled or its plugin unloads.

plugin.show_menu(title, items, on_select [, options])

Opens a native popup menu, styled like show_confirmation, with one tappable row per item and a Cancel row at the end. API 19, ui.menu.

  • items: 1 to 64 strings of up to 159 bytes each. Any other type or count is an error.
  • options.selected: optional 1-based index drawn in the accent color as the current choice.
  • on_select(index): runs with the 1-based index after a row is tapped and the popup has closed, so it may open another menu or screen. Cancel, the backdrop, leaving the screen underneath, and plugin unload dismiss the menu without calling it.
  • Returns true, false, "busy" if a menu is already open, or false, "unavailable" if it cannot be shown (for example during a screen transition). One menu is open at a time across all plugins, as with show_confirmation; a menu is never replaced or answered for another plugin. If the rows do not fit the screen, the popup scrolls.
plugin.show_menu("Text size", { "Small", "Medium", "Large" }, function(index)
    -- index is 1, 2 or 3
end, { selected = 2 })

plugin.show_text_view(title, text [, options])

Opens a paged reader for long text. Returns true, or false, "busy" if one is already open, or false, "unavailable" during a screen transition.

  • text: up to 256 KB; longer text is cut.
  • options.page (1-based) or options.offset (byte offset): where to start. page wins. A page past the last one opens the last page (once pagination reaches it), so a large number opens a text at its end.
  • options.images: up to 64 picture files (usually made by zip_image_async). The text shows picture n (0-based) where it contains "\27" .. n .. "\27". Each picture gets its own page. Check ui.text_view_images.
  • options.on_turn(page, pages, byte_offset): runs shortly after the view opens (never inside the show_text_view call), after each page turn, and when the final page count is known. Use it to save the reading position. While the view is still finding the requested page or offset, it isn't called, so a saved position is never overwritten by a temporary one.
  • options.on_close(page, byte_offset): runs after the view closes, however it was closed. If it closes before reaching the requested offset, it reports that offset. Not called on a plugin reload.
  • options.font_px is accepted but ignored; the text uses the Font Size setting unless text_size is given.

Style options (API 19, ui.text_view_style):

  • options.text_size: "small", "medium" or "large", the same fonts as show_list rows. The page length follows the font. Omit it for the Font Size setting. Any other value is an error.
  • options.colors = { background = 0xRRGGBB, text = 0xRRGGBB }, each optional. background colors the whole view screen. text colors the page text, the title and the footer (the footer is dimmed). Omitted colors use the theme, and a later view shown without colors goes back to the theme.

Continuation options (API 19, ui.text_view_replace), for content split into parts such as the chapters of a book or the pages of a feed:

  • options.on_end(direction): when set, turning back from page 1 (tap the left third or swipe right) calls on_end(-1) instead of closing the view, and turning forward on the last page, once pagination is complete, calls on_end(1). The Back button still closes the view. on_end may call show_text_view with replace = true to continue with the next or previous part.
  • options.replace = true: swaps the content of the open view in place when it belongs to this plugin: title, text, images, page or offset, text_size, colors and callbacks are all replaced, with no navigation animation, and the replaced content's on_close is not called. Pagination restarts as for a fresh view. Returns true, or false, "not open" if no view is open or it belongs to another plugin. Without replace, an open view still gives false, "busy".

Tap the right third or swipe left for the next page; tap the left third or swipe right for the previous page. Swiping right on the first page, or the Back button, closes the view (unless on_end is set; Back always closes). The footer shows page / pages. Pagination runs in the background, so very long texts open immediately; past 8192 pages the rest isn't shown.

API 16 progress UI

Check ui.progress before using these functions. They run on the UI thread and leave navigation and playback available while work continues.

Function Result
plugin.show_progress(title, message [, fraction]) A new opaque handle, or nil, error if the UI is unavailable.
plugin.update_progress(handle, message [, fraction]) true if that plugin still owns the visible card; otherwise false.
plugin.close_progress(handle) Closes the owned card; returns whether it was visible.

Omit fraction (or pass nil) for an animated indeterminate bar during searches, connection setup, or transfers with unknown size. A finite fraction from 0 to 1 displays a percentage. Title and message are bounded to 128 and 512 bytes respectively; NUL bytes are rejected. Do not invent percentages for work without a measured total.

There is one modeless card. A new show_progress replaces it and invalidates its previous handle, even if another plugin owned it. The user can dismiss the card without cancelling the task. Updates never reopen a dismissed card; only a fresh user action should call show_progress again. Handles belong to the calling plugin, including its coroutines, and are invalidated on plugin unload, failed loading, or UI reload. Close the card on every completion and failure path; use a toast for the result. Keep automatic background work quiet.

local progress = plugin.show_progress("Cover Art Fetcher", "Searching for cover…")
-- Later, on the UI thread:
if progress then plugin.update_progress(progress, "Downloading cover…", 0.4) end
if progress then plugin.close_progress(progress) end
plugin.show_toast("Cover saved")

The native regressions use real Lua and LVGL:

python3 scripts/test_plugin_progress_api.py
make host
python3 scripts/test_plugin_progress_ui.py

For a reproducible device transfer, scripts/tests/progress_http_fixture.c is a loopback-only fixture serving /known (Content-Length) and /unknown (chunked), each with 262144 payload bytes over roughly 32 seconds. Compile for the device, stage and run it only from persistent SD storage, then stop its listener and child handlers and remove all fixture files after testing.

plugin.show_toast(message [, duration_ms])

Shows a short message at the bottom of the screen. Duration 100 to 30000 ms, default 5000.

plugin.screenshot()

Starts a screenshot. Returns true, or false, reason with one of screen_off, no_card, usb_storage, busy, framebuffer_unavailable, worker_start_failed or unavailable. The screen flashes and a toast confirms it. Files go to <SD card>/Screenshots/. Listen to the screenshot_saved and screenshot_failed events for the result.

plugin.show_lock_screen(options)

Shows a full-screen lock screen over everything, dismissed by swiping up. Returns true, or false, message.

  • mode (required): "album_art" (the current cover, or the default cover when there is none), "image" or "clock".
  • image_path: the image file, required for "image".
  • image_fit: "contain" keeps the whole image over a blurred fill; "cover" fills the screen with centered cropping. Applies to photos and album art. Omitted fit preserves native-size photos and fills the screen for album art.
  • clock_24h: optional override; otherwise follows the device clock setting.

The screen_woke event runs while the panel is still dark, allowing this call to prepare the lock screen before the first visible frame. Artwork decoding and blur generation run in the background.

plugin.configure_button_lock(enabled)

Arms the native Power + Volume Up chord that toggles hardware button lock (API 17, capability ui.button_lock). Pass true to enable the chord, false to disarm it. Returns the board-specific shortcut text for use in settings. On R3II 2025, hold Power first and turn the volume knob up; knob-first remains an ordinary volume adjustment. The enabled preference is the plugin's to persist; the locked flag itself is transient and starts unlocked.

When a visual lock screen is shown with this option enabled, it arms the hardware lock automatically and replaces swipe unlock with the button shortcut. The shortcut dismisses the visual lock screen; from a dark display it wakes directly to the unlocked page. Disarming restores swipe dismissal.

Recognition and enforcement are native. Unlock still works if Lua fails. While locked, mapped actions including repeats are blocked. Short Power still wakes and sleeps the display. Long Power still opens the emergency power-off menu. The chord waits until both keys are released, suppresses the incidental Power and Volume Up actions in either press order on button-based boards, and does not use the screenshot chord (Power + Volume Down, or Power + Previous on R3II 2025). Disabling the plugin or calling configure_button_lock(false) unlocks and clears queued gestures. Configuration belongs to the calling plugin; a failed load or plugin teardown releases it, and a different plugin cannot disarm or take over an existing owner.

Theming

Themes are natively built into Compás and managed via the built-in system theme picker (More → Themes), loading .theme key-value files directly from SD/Themes/ without requiring a Lua theme plugin. Active themes resolve icons via an in-memory native icon overlay layer without performing NAND bulk copies. When other plugins call plugin.set_icon, their explicitly copied overrides continue to be supported and take priority over theme layer lookups.

Theme packs distributed via the Plugin Store keep companion .theme files alongside a legacy Themes.lua stub for backward compatibility with older player versions and store catalog classification. On current versions of the player, Themes.lua is recognized as a legacy theme loader and suppressed at load time, as native theme management handles .theme files directly.

The Themes plugin source shows the historical reference format for custom theme application and programmatic UI styling.

To apply... Call
colors nothing, they apply immediately
icons, Home and launcher layouts plugin.refresh_theme()
anything, the heavy way plugin.reload_ui()

Music menu and Quick Drawer customization

Additive API 16 capabilities: ui.music_layout and ui.quick_drawer_layout. Check these capabilities before calling the new functions on an older player. Declare layouts after plugin.define() during startup; use plugin.reload_ui() after saving a change in your plugin's own settings. These declarations do not write the user's preferences to storage.

if plugin.has_capability("ui.music_layout") then
    plugin.set_music_layout({
        order = { "albums", "artists", "files", "playlists" },
        toolbar = { "library" },
    })
end
if plugin.has_capability("ui.quick_drawer_layout") then
    plugin.set_quick_drawer_layout({
        enabled = true,
        order = { "sleep", "bluetooth", "wifi", "plugins" },
        eq_visible = false,
        volume_visible = true,
    })
end

Native Music menu choices are saved under Settings → Display → Appearance. Plugin declarations remain session overrides: disabling Kids Mode restores the saved native choices. Music toolbar customization remains available to plugins and themes. Quick Drawer preferences remain independent.

plugin.set_music_layout(options) accepts order and toolbar arrays. Music keys are files, artists, albums, album_artist, genres, all_songs, and playlists. Toolbar keys are sound, playback, and library, ordered left to right. Existing plugin.set_icon() overrides still apply to their native icons. Native library browsing, artwork, and paging are preserved.

plugin.set_quick_drawer_layout(options) accepts enabled, order, eq_visible, and volume_visible. Drawer keys are wifi, bluetooth, sleep, crossfade, airplay, dlna, gapless, remote_control, car_mode, and plugins. The plugins key places all registered quick toggles as a block in their registration order. The first four visible toggles appear collapsed; the remaining toggles appear in the expanded area. Brightness and the now-playing card retain their native layout. Hiding a control does not turn off its feature or cancel an active sleep timer.

Omitted Music options use the standard native layout; omitted Drawer options inherit saved preferences. Within an explicit array, omitted keys are hidden; an empty array hides all entries in that section. Unknown, duplicate, sparse, or incorrectly typed entries raise an error before changing the previous declaration. Passing nil releases that plugin's declaration for the corresponding function.

The latest declaration for each option determines its order or value; an omitted option leaves other plugins' declarations intact. Visibility restrictions combine: an item hidden by any plugin stays hidden, and a false request for drawer enablement, EQ visibility, or volume visibility wins over true. This keeps a later theme from undoing Kids Mode restrictions. Failed or unloaded plugins lose their declarations, restoring another plugin's declaration or the saved preferences. Users can configure Music menu and Quick Drawer under Settings > Display > Appearance. Music toolbar customization is available to plugins and themes. Plugin overrides can take precedence over these choices. These controls simplify navigation; they are not a device security boundary. Customized saved Drawer orders are explicit selections: new entries added in future releases remain hidden until selected. Unchanged default orders follow the defaults of the installed release.

plugin.set_icon(theme_path, source_file)

Replaces a built-in icon. theme_path is the icon's path in the theme (for example "launcher/book.png"); source_file is the replacement image, which is copied into the theme override folder. Raises an error if it can't be copied.

  • Call it from top-level code. The app caches icons, and screens built before the override existed keep using the old file until refresh_theme() or reload_ui().
  • Keep the replacement close to the original's size and shape: the layout was measured for the original.

plugin.set_background_color(slot, rgb) / plugin.set_text_color(slot, rgb)

Change colors app-wide, immediately, from anywhere. rgb is 0xRRGGBB.

  • Background slots: "screen" (every screen), "card" (popups and cards), "list_row" (every list row).
  • Text slots: "primary" (titles and labels) and "muted" (secondary text). Red warning text and accent-colored text are not affected.

Another slot name is an error.

plugin.set_home_layout(tiles, options)

Restyles Home, chooses which tiles it shows, or turns it into a scrolling list. Takes effect when Home is rebuilt (refresh_theme(), reload_ui() or a restart). Each call replaces the whole previous layout.

tiles restyles individual tiles, one table per tile:

{
    key = "music",          -- native key or a register_home_tile id (required)
    bg_color = 0x1e3524, text_color = 0xd8c9a3,
    radius = 24,            -- px, not negative
    -- list mode only:
    height = 92, width = 440,         -- Home reference sizing (see below)
    align = "center",                 -- "left" (default), "center" or "right"
    accessory = true,                 -- show a chevron
    text_size = "medium",             -- like row options
    icon = true,                      -- show the tile's icon in the row
}

Native keys: music, stream_media, wireless, books, settings, dac, and subsonic (opt-in, opens Subsonic directly).

Home measurements use the R1's 480×800 screen as a reference. Widths, radii and gaps scale to the active board. In list mode, heights express the relative row proportions: Home expands or shrinks them to fill the space between the status bar and gesture area, respecting font and touch minimums. If those minimums cannot fit, the list scrolls. This Home fitting does not change dimensions passed to submenu layouts or other plugin lists.

options:

  • mode: "tile" (the icon grid, default) or "list".
  • tile_gap (tile mode, 0 to 64 px) and row_gap (list mode, 0 to 84 px, 0 means the default 6).
  • order: which tiles to show, in order. Leave a tile out to hide it; add a plugin tile's id to show it. Without order, Home shows the six original tiles. Tile mode shows at most 6, since the grid doesn't scroll; use list mode for more.
  • background_image: a .png, .jpg or .jpeg behind Home only, drawn at its own size and centered. Make it the screen's size (480x800 on the R1). It is copied when you call the function.

Errors: a repeated order entry, more than 12 tile entries, an unknown align or text_size, a negative radius, an invalid background image, or options that isn't a table. A tile key that doesn't exist yet is not an error (its plugin may load later); if it still doesn't exist when Home is built, it is skipped. A repeated key replaces the earlier entry.

plugin.set_home_layout({
    { key = "music", bg_color = 0x1e3524, text_color = 0xd8c9a3, radius = 24 },
}, { mode = "list", row_gap = 10, order = { "music", "dac", "books" } })

plugin.set_launcher_layout(options)

Switches the Music, Stream Media and Wireless menus between their icon grid and a list, independently. Each of music, stream_media and wireless takes mode = "tile" or "list" plus the list styling fields of set_home_layout (row_gap, height, width, bg_color, text_color, radius, align, accessory, text_size, icon). Menus you leave out stay a grid; an empty call resets all three. Apply with refresh_theme().

plugin.set_launcher_layout({
    music = { mode = "list", height = 108, width = 480, row_gap = 10,
              bg_color = 0x000000, text_color = 0x33FF33, text_size = "mono" },
})

plugin.register_player_action(name, callback)

Requires plugin.define and capability ui.player_actions. Registers a named click action for XML Player layouts registered by this plugin with plugin.set_player_layout. Names are 1–63 ASCII letters, digits, _, - or .; library and none are reserved. The callback receives the action name and can use the normal UI APIs to open custom menus. Re-registering the same name replaces the callback; the shared registry holds at most 32 actions. Callbacks are removed when their plugin unloads or fails to load.

Use compas_artist_action/compas_album_action XML constants or <event_cb trigger="clicked" callback="compas_action" user_data="name" />. Layout-local lyrics and click options, complete XML and Lua examples, and the lifetime rules are documented in Player layouts. No LVGL patches, Lua evaluation from XML, or custom widget types are required.

plugin.restore_player_layout()

Requires plugin.define and capability ui.player_layout_restore. Clears only this plugin's session layout selection and returns to the layout saved in Settings. Another plugin's selection is preserved. Returns whether the effective layout ID changed, not whether an override existed. This does not restore global background options or maintain a stack of plugin selections.

plugin.set_player_layout(options)

Changes the look of the Player (Now Playing) screen. Every field is optional.

Background

Field Type Meaning
flat boolean true replaces the blurred cover background with a solid color.
bg_color 0xRRGGBB The solid color for flat. Without it, the theme background is used.
blur_radius integer Blur strength, 0 to 64. Default 5.
blur_passes integer Blur passes, 0 to 16. Default 3.
darken_num, darken_den integers Darkens the blurred cover by darken_num / darken_den. Set both. Default 1/2.

Each call replaces all of these, so pass every option you want in the same call. They are global: they apply to every layout, including Default, and not only to one you ship. A layout that wants its own background should paint it (an opaque root) instead of relying on flat.

Whole layout

Field Type Meaning
xml string An XML layout file, relative to <SD card>/.plugins/.
name string Name shown in Settings. Default: the file name without .xml.
id string Internal id, 1 to 63 letters, digits, _, - or .; not default. Default: plugin.<file name without .xml>, other characters replaced by _. Longer ids are cut short.

How to write the XML file, and which widget names the app needs, is explained in Player layouts.

  • The file must be inside the .plugins folder. Absolute paths, .., links leading outside the folder, or a missing file raise a Lua error.
  • If the file can't be used (invalid XML or a required widget missing), the default layout is shown instead.
  • Called from top-level code, it only adds the layout to **Settings > Display

    Player Layout > Layout**. Users pick it there like any other layout, and the choice is remembered while the plugin stays installed and enabled. If the plugin is disabled or removed, the default layout is shown instead.

  • Called from a callback (a button, for example), the layout is selected right away for this session. If that changes the active layout, the app queues a Player-only rebuild on the UI loop. It preserves plugin Lua state, audio/DSP, queue, navigation history, and any other screen currently in front. When Player is visible, a retained frame covers it while its widgets are replaced. A rebuild delayed by an interaction stays queued and uses the latest request. The selection stays until the player restarts or the user picks another layout in Settings.
  • The native layout picker and plugin.restore_player_layout() use this same deferred Player-only rebuild path. They do not restart plugins or recreate other screens.
  • Check ui.player_layout_xml first if the plugin should also run on older firmware.
-- Solid dark background instead of the blurred cover
plugin.set_player_layout({ flat = true, bg_color = 0x101010 })

-- Offer a layout shipped with the plugin, with the same background
if plugin.has_capability("ui.player_layout_xml") then
    plugin.set_player_layout({
        xml = "player_layouts/clean.xml", name = "Clean",
        flat = true, bg_color = 0x101010,
    })
end

plugin.now_playing.set_image(name, path) / plugin.now_playing.set_text(name, text)

Updates a custom named widget in an XML Now Playing layout owned by this plugin. Requires plugin.define() and a layout registered with plugin.set_player_layout(). Check capabilities ui.now_playing.set_image and ui.now_playing.set_text; these are new in API 18.

Use an lv_image for images and an lv_label for text. Names must start with plugin_, contain only ASCII letters, digits, _, -, or ., and fit in 63 bytes. Native roles such as cover_img, title, and play_btn cannot be changed through these setters.

<lv_image name="plugin_artist_image" width="300" height="300" inner_align="contain" />
<lv_label name="plugin_caption" text="" />
plugin.now_playing.set_image("plugin_artist_image", "/Album/Artist/artist.png")
plugin.now_playing.set_text("plugin_caption", "Chapter 2")
  • Image paths are absolute filesystem paths or relative to <SD card>/.plugins/, like list icons. Pass a local image supported by the player's LVGL decoder, not a URL, XML image identifier, or an S:-prefixed LVGL path. Missing or unsupported images raise an error without replacing the previous value. The resolved filesystem path is limited to 511 bytes. Files are referenced, not copied: keep them available while the image is in use.
  • Text is literal UTF-8, up to 4095 bytes. Values and names cannot contain NUL.
  • Both functions return true when the value is accepted. Invalid arguments, a wrong widget type in the active owned layout, exhausted storage, or an inactive/undefined plugin raise a Lua error.
  • Updates are retained per plugin and widget name, even if its layout is not active or Now Playing has not been created. Matching widgets receive the latest value when the layout is created again. Missing widgets are skipped; widgets of the wrong type are skipped during creation. Different plugins' values never modify each other's layouts.
  • Up to 32 named values per plugin and 128 across all plugins are retained. Passing nil clears the current image or text and removes its retained value. On the next rebuild, the XML default applies again. Unloading the plugin clears its values.
  • This updates only the custom widget, not native cover art, its blurred background, or quick drawer artwork. To show a custom picture instead of the cover, hide the required native cover_img in your XML and place a custom image in the desired position.

plugin.refresh_theme()

Applies icon changes and the Home and launcher layouts, without disturbing anything else: other screens, navigation, playback and connections stay as they are. It runs after your callback returns. Use it after a batch of theme calls.

plugin.reload_ui()

Rebuilds every screen and restarts all plugins, without restarting the app or interrupting playback and connections. It runs after your callback returns, and the user lands on Home. Call it only in response to a user action, never unconditionally from top-level code (that would reload on every load; a second request during a reload is ignored).

plugin.register_list_item("display", "Theme", function()
    plugin.show_list("Theme", { "Dark", "White" }, function(index)
        apply_theme(index == 2 and "white" or "dark")  -- your own theme calls
        plugin.refresh_theme()
    end)
end)

Writing a .theme file

A theme is a plain text file that you can write without a plugin. Put it in SD/Themes/ (subfolders up to two levels deep are scanned), name it with a lowercase .theme extension, and pick it under More → Themes. Files whose names start with a dot are ignored.

Each line is key=value. Blank lines, lines starting with #, and lines with no = are skipped. Unknown keys are ignored, so a theme written for a newer version still loads on an older one.

Colors are 0xRRGGBB (decimal also works).

The six required keys are:

Key Used for
name The name shown in the Themes list
screen Screen background
card Card background
list_row List row background
text_primary Main text color
text_muted Secondary text color

A file missing any of them, or with a malformed value, is rejected and not shown in the list.

Optional keys:

Key Values Effect
icon_root theme1, theme2, or a folder under SD/Themes/ Folder the icons are taken from. theme1 and theme2 are the firmware's built-in icon sets.
drawer_root Same as icon_root Icon folder for the drawer
icon.<path> Source file, relative to SD/Themes/ Replaces one icon, for example icon.launcher/book.png=MyTheme/book.png
home_mode tile or list Home screen style
home_tile_gap, home_row_gap Pixels Spacing on Home
home_order Comma-separated tile ids Home tile order. In tile mode, at most 6 tiles.
submenu_mode tile or list Style of the Music, streaming and wireless launcher menus
tile.<id>.<property> See below Styles one Home tile. Ids such as music and stream_media.

Tile properties: bg_color, text_color, radius, height, width, align (left, center, right), text_size (small, medium, large, mono), accessory and icon (true or false).

Paths must be relative. They may not contain .., a backslash, or a leading slash, and the icon_root and drawer_root paths are checked the same way.

A minimal theme:

name=Night Blue
screen=0x0B1B2B
card=0x14304A
list_row=0x102638
text_primary=0xF2F6FA
text_muted=0x9FB3C8
icon_root=theme2

The published theme packages include complete examples such as White and Mountain Sunset.

Playback

Playing files

  • plugin.play_file(path [, options]): plays one file (absolute path) or stream URL as a new queue, replacing Up Next like tapping a song does.
  • plugin.play_list(paths [, start_index [, options]]): plays a list of paths or URLs as a new queue, starting at the 1-based start_index (default 1, out-of-range values are clamped). Up to 500 entries.
  • options.open_player = false starts playback without opening Now Playing, for a plugin that plays audio from its own screen. Check plugin.has_capability("playback.stay_on_screen") first; older players ignore the table and open Now Playing.

Stream URLs (http:// or https://) support live streams and finite files:

  • Format is chosen in this order. A #.ext fragment is first (#.flac, #.aac, #.aacp, #.m4a, #.m4b, #.mp4; the fragment is never sent to the server). Then the URL path's extension, ignoring the query string and fragment, for those same extensions. Then the response Content-Type: audio/flac or audio/x-flac for FLAC, audio/aac or audio/aacp for ADTS AAC/AAC+, and audio/mp4, video/mp4 or application/mp4 for AAC in MP4. Anything else stays MP3, including a .mp3 URL and playlist URLs such as .m3u, so an unrecognized or ambiguous type does not change today's default. Other formats fail to open.
  • Live streams remain forward-only. Finite FLAC, MP3 and AAC-in-MP4 sources can seek when the server supports validated byte ranges; check get_playback_format().seekable. Raw ADTS AAC remains forward-only. Duration is shown when the decoder or remote-track metadata provides it.
  • No reconnect: if the connection drops, playback stops.
  • An endless stream (radio) never auto-advances. Finite tracks can.
  • Stream titles (ID3 or ICY metadata) are not shown.

plugin.play_remote(track) / plugin.queue_remote_list(tracks [, start_index])

For streaming-service plugins (Qobuz, Tidal and the like): plays one track, or a new queue of up to 500, with full metadata.

plugin.play_remote({
    provider = "qobuz",           -- required
    track_id = "12345",           -- required, stable for this track
    stream_url = "https://...",   -- optional with playback.remote_resolve
    verify_tls = true,            -- default true
    title = "Song", artist = "Artist", album = "Album",
    duration_ms = 214000,
    artwork_url = "https://...",
    codec = "flac",               -- "mp3" (default), "flac" or "aac"
    sample_rate = 44100, bit_depth = 16, channels = 2, bitrate_kbps = 0,  -- display only
    replaygain_db = -3.5,
})
  • Favorites and play counts use remote://<provider>/<track_id>, not the URL, so they add up even when the URL changes on every play. They don't appear in the Favorites and Most Played screens yet.
  • Remote tracks are not resumed after a restart.
  • Playback follows the stream rules above: finite sources can seek when get_playback_format().seekable is true; live sources remain forward-only. There is no reconnect.

Queue up to 500 metadata entries without fetching every signed link up front. Require API 17 in plugin.define and check playback.remote_resolve before registering the resolver: older API 17 players reject the event name. Without it, resolve a short queue up front as before (Qobuz and Tidal use 12 tracks). Register one resolver before queueing, then omit stream_url:

if plugin.has_capability("playback.remote_resolve") then
    plugin.on("remote_stream_needed", function(provider, track_id, request_id)
        if provider ~= "my_service" then return end
        -- Your service-specific asynchronous helper, not a built-in API:
        get_stream_link_async(track_id, function(link, err)
            if not link then
                plugin.provide_remote_stream(request_id, {error=err, reason="unavailable"})
                return
            end
            plugin.provide_remote_stream(request_id, {
                stream_url=link.url, codec=link.codec,
                sample_rate=link.sample_rate, bit_depth=link.bit_depth,
                url_ttl_s=60,
            })
        end)
    end)
    plugin.queue_remote_list({
        {provider="my_service", track_id="123", title="First song", duration_ms=180000},
        {provider="my_service", track_id="456", title="Second song", duration_ms=210000},
    }, 1)
end
  • The event receives (provider, track_id, request_id) on the UI/Lua thread, only in the plugin that submitted the entry. Register at most one handler per plugin. Return promptly and resolve with asynchronous HTTP.
  • plugin.provide_remote_stream(request_id, result) accepts stream_url and optional codec (mp3, flac, aac), sample_rate, bit_depth, channels, bitrate_kbps and url_ttl_s. Omitted format fields retain queue values. All descriptive metadata and ReplayGain remain; verify_tls is the queue entry's value (default true). The native table updates under its lock and decoders receive owned copies.
  • Return {error="English detail", reason="..."} on failure. A known reason shows the player's translated message: subscription, unavailable, quality, protected, network or auth. Without one, the English error is shown only when the player language is English, and a generic translated message otherwise. Errors and timeouts use the existing unplayable-track skip policy and error toast, including the consecutive-failure stop limit. A missing resolver is also a failure.
  • The call returns true if accepted, or false for stale, timed-out, cancelled, already-answered or other-plugin IDs. A response cannot redirect the request to another provider/track. Do not save request IDs across reloads.
  • url_ttl_s can also be supplied on a queue entry: an integer from 1 to 86400 seconds, default 60 seconds. Age starts when the URL is submitted to the player; a safety margin of up to 2 seconds avoids opening a nearly expired link. Supply the remaining usable lifetime, not the service's maximum.
  • Qobuz and Tidal require API 17. With playback.remote_resolve they queue up to 500 tracks on demand; without it they resolve a 12-track queue up front. The capability check distinguishes API 17 builds that include this additive feature; no new API version is needed.
  • Current-track startup waits off the UI thread for at most 15 seconds. Stop, another selection, queue replacement and plugin unloading cancel obsolete requests. Late answers never start an old track. After a plugin reload, the queue it built passes to the reloaded instance (matched by plugin.define id) once it registers its resolver, so the resolver must handle track ids it did not queue in this session.
  • During active playback with known duration, the next link is requested at about 30 seconds remaining. Gapless preparation uses only fresh links. If the matching answer is still pending at the transition, normal startup waits for it; a failed prefetch can be retried on selection. Unknown-duration tracks resolve at startup. None of this changes stable queue identities.

Controls

Function Does
plugin.toggle_pause() Play/pause, like the button (blocked in Bluetooth DAC and AirPlay modes, like the button).
plugin.stop() Stops playback.
plugin.next_track(), plugin.prev_track() Next and previous, respecting shuffle.
plugin.seek(seconds) Requests a position in the current track. Finite HTTP sources can seek when get_playback_format().seekable is true; live streams remain forward-only.
plugin.set_volume(percent, opts) Sets volume clamped to 0–100. Shows the popup by default; { silent = true } suppresses it (playback.silent_volume). { persist = false } updates live audio/UI without changing remembered volume or saving settings (playback.transient_volume); persistence defaults to true.
plugin.set_playback_speed(dir, speed) API 16, playback.speed: requests pitch-preserving speed from 0.5 to 2.0 for local tracks beneath an absolute directory. Returns acceptance, not completion of the asynchronous transition. nil, 1.0 resets the scope. Scoped to path components; last call wins, cleared on plugin shutdown.
plugin.get_playback_speed() Returns the actual committed speed; 1.0 while idle or for unsupported formats.
plugin.set_transport_skip(dir, seconds) Makes Next and Previous skip seconds (1 to 300) within files under dir instead of changing track; 0 turns it off. Applies to every Next/Previous control, not to automatic track changes. Not saved; the last call wins. Check playback.transport_skip.

Playback speed uses speech time stretching for local mono/stereo PCM sources from 8–96 kHz, with 16-bit output while active. DSD and network streams keep normal speed. Crossfade is disabled across tracks with active stretching. Seek, chapter, bookmark and progress times stay in source seconds; during stretching the delivered source position is nominal, with fractional frame accounting and an exact source endpoint once the final output is delivered. Speed preferences should be saved by the plugin, and scoped to its content directory.

Current state

Function Returns
plugin.is_playing(), plugin.is_paused() booleans
plugin.get_position(), plugin.get_duration() seconds
plugin.get_playback_progress(expected_path) A coherent { position, duration, playing, paused, terminal } snapshot, or nil unless the absolute path exactly matches the current playback generation or its retained terminal state. Check playback.progress before using it. terminal is "active", "natural_eof", or "manual_stop". active can include decoder recovery after a premature EOF; only natural_eof confirms natural completion. Use this for checkpoints that must distinguish completion from a manual stop; the legacy getters above are independent snapshots.
plugin.get_volume() 0 to 100
plugin.get_now_playing() title, artist, album, duration_seconds, or nil if nothing has played yet
plugin.get_current_track_path() absolute path, or nil when nothing is loaded
plugin.get_play_mode() "sequential", "repeat_all", "repeat_one", "shuffle" or "shuffle_once"

plugin.refresh_lyrics(track_path)

API 17, capability playback.lyrics_refresh. After saving lyrics, pass the exact path returned by get_current_track_path(). Returns true when an asynchronous lyrics reload is requested, or false, "track_changed" if another track is current. Playback and position are preserved; a UI reload or track restart is unnecessary. Plugins requiring this behavior should set api_min = 17.

API 16 audio additions

These additions keep API version 16. Check each capability with plugin.has_capability(token) when supporting older builds.

Functions Capability and behavior
get_playback_format() playback.format: nil while idle, otherwise a snapshot with path, codec, source sample_rate/bit_depth, output_sample_rate/output_bit_depth, channels, bitrate_kbps, duration_seconds, is_stream, seekable, is_dsd, dop, replaygain_applied/replaygain_applied_db, generation, and live software_volume_gain, playback_speed, crossfade_enabled. dop reports unconverted DSD passthrough (including USB native DSD); use get_output_info() to distinguish native from DoP transport. Unknown source depth/bitrate is 0; MP3 has no encoded PCM bit depth. Software gain is a linear PCM multiplier, distinct from hardware/UI volume. Crossfade reports the setting, not whether two tracks are currently mixing.
get_output_info() playback.output_info: route (wired, bluetooth, or usb_dac), active, PCM sample_rate/bit_depth, hardware_sample_rate/hardware_bit_depth when known, cached bluetooth_codec when available, resampling, resampling_known, dop, and native_dsd. Native DSD reports the ALSA word rate/width (for example, 88.2 kHz × 32 bits for DSD64); packing is not resampling. USB native/DoP hardware formats are known. Bluetooth uses a stable 24-bit PCM pipe, widening 16-bit sources without adding precision. Bluetooth and USB PCM conversion/final hardware formats remain unknown; matching PCM fields alone cannot prove bit-perfect output.
eq_apply_profile(path, { persist = false }) audio.peq.transient: applies an SD profile to runtime EQ without saving it. Default persistence remains enabled. Later explicit EQ save/edit operations may save the active profile.
get_eq_state() audio.peq.state: detached runtime snapshot with bypass, preamp_db, stereo_width, crossfeed, crossfeed_angle, and ten ordered bands (index, freq_hz, gain_db, q, type, enabled). This observes active settings, including transient profiles, rather than reading a possibly stale saved profile.
eq_apply_state(state, { persist = false }) audio.peq.state: validates the complete snapshot before applying it. Persistence defaults to true. Plugins can restore a saved runtime snapshot without writing flash; compare the current state with the last state they applied before restoring, to preserve subsequent user changes. Numerical limits: preamp/gain −300 to 300 dB, frequency 1–24000 Hz, Q 0.01–100, width 0–2, crossfeed 0–1; all must be finite. crossfeed may be omitted; a missing field applies as off so older snapshots still load. Optional crossfeed_angle is 0 (no delay), 30, 45, 60, or 90 degrees; omission applies no delay. Check audio.crossfeed.angle before relying on that field.
get_track_metadata(path) library.track_metadata: exact local SD-path lookup in the scanned database, returning id, path, title, artist, album, album_artist, and genre. Returns nil for unindexed/remote/invalid paths; absent tags are empty strings. Does not parse files or iterate the library on each track.
get_crossfade(), set_crossfade(enabled) playback.settings: boolean; retains native coupling with gapless.
get_gapless(), set_gapless(enabled) playback.settings: boolean; disabling gapless also disables crossfade.
get_replaygain_mode(), set_replaygain_mode(mode) playback.settings: off, track, or album. Applies at the next track transition; it does not recompute current decoder gain.
get_play_mode(), set_play_mode(mode) playback.settings: sequential, repeat_all, repeat_one, shuffle, or shuffle_once. Setters follow native settings persistence.
set_ab_loop(start, finish), get_ab_loop(), clear_ab_loop() playback.ab_loop: seconds converted to decoder frames; end is exclusive. Setter returns acceptance. Getter returns { start, finish } or nil. Supports finite local FLAC/WAV/AIFF/CAF at up to 16-bit PCM; unsupported sources, pause, speed changes, crossfade, seek, stop, and track changes clear/reject loops. Wrap runs in the audio thread without reopening/flushing output.
audio_loop_start(path), audio_loop_stop(), audio_loop_active() audio.loop: repeats a short local clip (decoded to memory, up to 4 MiB of 16-bit mono or stereo PCM) from its first frame, sample exact, while no track produces audio. Start pauses a playing track and returns acceptance; calling it again replaces the clip. The clip never becomes the current track, so the queue, Now Playing and track events are untouched. Resuming or starting a track, or a plugin reload, ends the loop; audio_loop_active() then returns false. Additive within API 17.
prepare_ab_switch(path) playback.ab_switch: asynchronously prepares an alternate SD file against the currently playing primary. Returns acceptance, not readiness. Both must be finite local 16-bit FLAC/WAV/AIFF/CAF or MP3 with identical rate, channels and playable frame count. MP3 delay/padding follows the native decoder's trimming; unmatched lengths are rejected. Preparation/adoption can involve I/O and one alignment seek; long MP3 preparation builds its seek index off-thread. The practice looper retains its lossless-only restriction.
get_ab_switch(), select_ab_source(source), clear_ab_switch() playback.ab_switch: snapshot { preparing, ready, source }; source is a or b. Select returns false until ready. Both decoders advance together; selection switches raw PCM at a chunk boundary before one shared DSP pass, with the primary's ReplayGain, EQ and volume. Selection does not seek, reopen, or flush output. Pause, seek, stop, track/speed/crossfade changes or decode/output errors clear it. Loops and comparison are mutually exclusive.

plugin.on("output_changed", function(current, previous) ... end) (playback.output_events) reports deduplicated output snapshots on the UI thread. Each contains route, requested_route, active, bluetooth_connected, bluetooth_codec, and headphone_state (native jack state). The first observed state establishes a baseline. Bluetooth information comes from the player's cached/debounced radio state.

playback.http_seek indicates finite HTTP Range support. Servers must honor validated byte ranges. FLAC, MP3 and AAC in MP4/M4A use byte seeking; raw ADTS AAC and live/chunked radio remain forward-only. MP3 without a seek table can decode forward from an earlier byte position during a seek, so acceptance is not a promise of instantaneous seeking. Provider URL expiry, server policy and container format can still make an individual source non-seekable.

plugin.media_capabilities()

Describes what the player can play, for streaming plugins choosing a quality:

-- codecs = {"mp3", "aac", "flac"}, containers = {"mp3", "adts", "flac"}
-- max_bit_depth = 16, max_channels = 2
-- max_sample_rate = 0 (unknown), direct_http_streaming = true
-- range_seeking = false, hls = false, dash = false
-- encryption_modes = {}, drm_systems = {}

Music library

The library functions read the on-device database. Matching is case-insensitive.

  • plugin.get_artist_albums(artist): the artist's album names, sorted, or nil.
  • plugin.get_album_tracks(artist, album): the album's track paths in album order, or nil.
  • plugin.get_next_album_tracks(artist, album): the tracks of the artist's next album, or nil if there is none (it doesn't wrap). Useful to keep playing through a discography.

Paged access

For browsing the whole library without loading it all. limit defaults to, and is capped at, 200; use offset to page. Check library.paged.

  • plugin.library_song_count(): number of songs.
  • plugin.library_get_songs([offset], [limit], [filters]): returns songs, total. filters may contain query (part of the title or artist), artist, album_artist and album (exact matches). total counts all matches, for "page N of M".
  • plugin.library_search(query, [limit]): songs whose title or artist contains query.
  • plugin.library_get_song(id): one song, or nil if it no longer exists.
  • plugin.library_get_artists([offset], [limit]): artist groups.
  • plugin.library_get_albums([offset], [limit], [artist]): album groups, optionally only those whose artist or album artist is artist.
  • plugin.library_album_cover_async(song_id, size, callback) (check library.album_cover): the album cover of a song, at size 480 or the thumbnail size, which is 80 px (40 px on the TempoTec V1). 72, the thumbnail size of earlier releases, is still accepted and serves the current thumbnail, so pass 72 if one script must run on every release and board; any other size is an error currently. Use a group's first_song_id. callback(path) is called on a later player tick with the absolute path of a BMP, which show_list accepts as an icon. If the library has not generated that cover yet, callback(nil, "not_generated") is called instead. This call never creates a cover: covers come from Settings > Update Music Database. Returns true, or nil, "busy" while 32 requests are pending. Unloading the plugin drops its pending callbacks.

A song is { id, path, title, artist, album, album_artist }. Its id survives rescans: keep it to look the song up later with library_get_song(id). A group is { name, count, first_song_id, album_artist }; album_artist tells apart same-named albums by different artists.

local songs, total = plugin.library_get_songs(0, 50, { artist = "Boards of Canada" })
plugin.show_toast(("Found %d songs"):format(total))

plugin.refresh_library()

Rescans the music library, like Settings > Library > Update Music Database, with the same progress screen. Needed after a plugin adds music files, since the library doesn't watch for changes. Returns true, "started", or false, "already_running" or false, "rate_limited" (one scan per minute per plugin). Check library.refresh.

Files and playlists

  • plugin.sd_root(): the SD card's path (/data/mnt/sd_0 on the device, ./music on the simulator). Build every path from it so the plugin works in both.
  • plugin.list_dir(path): the entries of a folder (absolute path), as { name, dir, size, modified } tables (size and modified, in Unix seconds, when available). Hidden entries are skipped, the order isn't sorted, and a missing folder gives an empty table.
  • plugin.mkdir(path): creates a folder and any missing parents. Returns true, or nil, error. An existing folder is fine.

plugin.realpath(path)

Returns the canonical absolute filesystem path of an existing file or directory, resolving ., .., and symbolic links. Relative paths resolve against the application's working directory, not .plugins/. The result is a plain filesystem path without LVGL's S: prefix.

Check plugin.has_capability("filesystem.realpath") first; this is new in API 18. Missing paths, dangling links, and other filesystem failures return nil, error. Invalid arguments, embedded NUL bytes, and paths into reserved plugin storage raise a Lua error. Both the input and the resolved path are checked against reserved storage.

local path, err = plugin.realpath(plugin.sd_root() .. "/Artist/Album/Track.png")
if path then
    plugin.now_playing.set_image("plugin_track_image", path)
else
    plugin.show_toast(err)
end

File Manager (API 16)

Check plugin.has_capability("filesystem.file_ops") before the file operations, and "ui.file_manager" before open_file_manager.

  • plugin.open_file_manager([folder]): opens More > File Manager, at folder when given (an existing folder on the SD card; a path elsewhere raises a Lua error). Returns true, or nil, error when the folder does not exist or the File Manager is already open under another screen.
  • plugin.pick_file(folder, callback): opens the native SD card browser at folder (pass nil for the SD root) and calls callback(path) with the selected file, or callback(nil) if the user backs out or returns Home. The callback runs after the picker leaves the navigation stack. Directories can be browsed; audio files, playlists, cue sheets, and other files are returned as one raw path without playback. Only one picker may be pending; another request returns nil, error; a successful open returns true. An invalid starting folder raises a Lua error. Plugin unload or UI reload silently cancels a pending callback. Check plugin.has_capability("ui.file_picker").
  • plugin.pick_color(default, presets, callback): opens the native color picker (the Accent Color picker: saturation/brightness square, hue bar, and a Hex code row that opens the keyboard) and calls callback(color) with the chosen integer 0xRRGGBB when the user taps Done, or callback(nil) if the user backs out or returns Home. The callback runs after the picker leaves the navigation stack. default is the starting color as an integer 0xRRGGBB or a "#RRGGBB" / "RRGGBB" string (nil for white). presets is an array of up to 12 colors in the same forms shown as swatches (nil hides the preset section). An invalid default, an invalid preset or more than 12 presets raises a Lua error. Only one color picker may be pending; another request returns nil, error; a successful open returns true. Plugin unload or UI reload silently cancels a pending callback. Check plugin.has_capability("ui.color_picker").
  • plugin.file_copy(paths, dest_dir [, callback]), plugin.file_move(paths, dest_dir [, callback]), plugin.file_delete(paths [, callback]): copy, move or delete files and whole folders in the background, with the File Manager's own engine. paths is one absolute path or a list of them (up to 4096). Returns true once the operation starts, or nil, error.
  • Every path, and dest_dir, must be on the SD card (under plugin.sd_root()), written plainly: no trailing / and no ., .. or empty parts. Any other path raises a Lua error.
  • Nothing is overwritten: a name already taken in dest_dir gets a " (2)" style suffix. A folder cannot be copied or moved into itself, and moving an item into the folder it is already in does nothing.
  • The player's own folders, sd_root() .. "/.compas" and sd_root() .. "/.plugins", cannot be deleted or moved this way: the call returns nil, "the player's own folders cannot be deleted or moved".
  • Only one operation runs at a time, shared with the File Manager: starting another gives nil, "another file operation is running". While a computer has the card mounted over USB storage it gives nil, "USB storage is connected".
  • callback(result) runs when the operation ends, with { done, total, failed, stopped, running, current }: failed counts items not fully done, and stopped is true when cancel_file_operation() left items undone. It gets nil in the rare case a newer operation replaced the result first. If the plugin is unloaded the operation still finishes, without the callback.
  • plugin.file_operation_status(): the running or last operation, whoever started it, as the same table as callback's.
  • plugin.cancel_file_operation(): stops this plugin's operation after its current file (a partly copied file is removed). Returns whether there was one; an operation the user started is left alone.
local music = plugin.sd_root() .. "/Music"
plugin.file_copy({ music .. "/a.flac", music .. "/Album" }, plugin.sd_root() .. "/Backup",
    function(result)
        if result and result.failed == 0 then plugin.show_toast("Backup done") end
    end)

File changes do not update the music library by themselves; call plugin.refresh_library() afterwards when music moved.

Playlists

These work on the .m3u playlists the Playlists screen shows, and changes appear there immediately.

Function Returns
plugin.playlist_list() paths of all playlists, or nil if there are none
plugin.playlist_read(m3u_path) song paths in order, or nil
plugin.playlist_create(name, song_path) the new playlist's path (with song_path as its first song), or nil
plugin.playlist_add(m3u_path, song_path) true, or nil, error
plugin.playlist_remove(m3u_path, song_path) true, or nil, error; removes every copy of the song
plugin.playlist_delete(m3u_path) whether it was deleted, or nil, error for an invalid path

Sound

Equalizer

These control the player's 10-band parametric EQ. Every change applies and is saved immediately, and the EQ screen shows it.

Function Does
plugin.eq_load_profile(path) Loads a .peq profile. Returns false if it can't be read.
plugin.eq_save_profile(path) Saves the current EQ as a .peq profile, the same format as the EQ screen. Returns false if it can't be written.
plugin.eq_reset() Restores the defaults.
plugin.eq_set_bypass(on) true turns off the EQ bands, preamp and stereo width. Crossfeed remains independent; with Crossfeed also off and its ramp settled, the PCM stage leaves samples unchanged. DoP output never reaches it.
plugin.eq_set_preamp(db) Sets the preamp gain.
plugin.eq_get_stereo_width() Gets the configured width (API 16, capability audio.stereo_width).
plugin.eq_set_stereo_width(width) Sets width from 0 (mono fold) through 1 (neutral) to 2 (wider). Rejects nonfinite/out-of-range values.
plugin.eq_get_crossfeed() Gets headphone crossfeed strength (capability audio.crossfeed). 0 is off.
plugin.eq_set_crossfeed(strength) Sets strength from 0 (off) to 1 (full effect). Rejects nonfinite or out-of-range values. 0.65 is a conservative strength when a plugin turns crossfeed on itself.
plugin.eq_set_band(index, freq_hz, gain_db, q) Sets one band. index is 1 to 10.
plugin.eq_set_band_type(index, type) "peaking", "low_shelf" or "high_shelf".
plugin.eq_set_band_enabled(index, on) Turns one band on or off.

Stereo width is saved as stereo_width in .peq profiles, included in backups, restored to 1 when loading older profiles, and reset by eq_reset(). EQ bypass also bypasses width. Slider changes ramp over at most 20 ms; mono input is unchanged. Widening applies headroom compensation, reducing the center level. Native DSD over PCM (DoP) bypasses all PEQ processing, including width. This is stereo width, not crossfeed or a room simulation. The EQ frequency graph shows the band/preamp response and excludes this channel-dependent matrix.

Crossfeed is saved as crossfeed in the same .peq current file and named profiles, so eq_save_profile / eq_load_profile and get_eq_state / eq_apply_state round-trip it. Profiles and snapshots that omit the field load as off. eq_reset() turns it off; the PEQ screen's Flat / Reset actions preserve Crossfeed strength and angle. New installs start off. Settings → Sound → Crossfeed has a strength slider (0 is off) and an angle selector. There is no separate enable switch. Crossfeed runs independently of the PEQ On/Off switch.

Crossfeed is a filtered-difference headphone blend. It is not a stereo-width matrix, a room model, or a head-related transfer function. In No delay mode it retains the original response: a one-pole low-pass at 700 Hz tracks each channel. At strength s the cross coefficient is k = 0.30 * s: yL = xL + k * (lpR - lpL) and the mirror for the right channel. Once the low-pass has settled, that is direct 1 - k and cross k. A centered steady signal stays at unity gain. A steady full-scale hard-panned tone stays inside full scale. High frequencies are left almost untouched.

The optional crossfeed_angle is persisted with the profile. Values 30, 45, 60, and 90 degrees select approximately 261, 381, 488, and 655 microseconds, rounded to the nearest sample at the PCM stage's rate. Only the opposite-channel low-pass contribution is delayed; the direct output is not buffered. No delay (0) is the default for new installs, resets, older profiles, and snapshots without this field. A fixed 512-frame stereo ring caps the tap at 511 frames. Unlike No delay mode, delayed identical-channel stereo can change phase and frequency response; steady DC remains at unity. Single-channel PCM is unchanged.

A polarity reversal can still overshoot while the low-pass holds the previous sample, by about 1 + 2k (1.6 at full strength). The PCM stage's 1 ms limiter attack does not cover those first samples and is not what prevents that clip. While crossfeed is active, the same sample applies a stereo-linked gain so the frame peak does not exceed the limiter ceiling (32760 in 16-bit, 8386560 in 24-bit) unless the peak before crossfeed was already above that ceiling. That gain is not a constant attenuation: in-range audio, including steady mono and a steady hard-pan, is unchanged. Strength 0 does not apply it. Preamp boosts that already exceed the ceiling still go to the existing limiter.

Strength and delay-tap changes blend over 20 ms. Rapid angle changes coalesce to the latest selection after the current blend finishes. The audio thread restarts the low-pass and delay history from the next sample after a stop/restart, seek, A-B loop jump, A-B source switch, or a DoP stretch followed by PCM, including when the rate and PCM format are unchanged. Continuous gapless PCM and ordinary block boundaries keep the low-pass. A sample-rate or 16/24-bit format change does the same restart, so the previous stream is not replayed and a steady tone does not step. Mono input is unchanged. Any non-zero strength runs the PCM processor even when every EQ band is flat, preamp is 0 dB, and stereo width is 1, so the PCM stage rewrites samples. With the other processors inactive, strength 0 and a settled ramp leave samples unchanged and do no per-sample work. EQ bypass disables preamp, bands and stereo width while preserving Crossfeed. Native DoP never enters this stage. ReplayGain and volume stay outside this stage, in their existing order around it. Bluetooth and USB conversion can still change the signal after this stage; a matching PCM format alone does not prove bit-perfect output.

The EQ frequency graph does not include crossfeed. Order inside the PCM stage is preamp, EQ bands, crossfeed (with the immediate peak gain above), stereo width, then the limiter.

A bad index or type is an error. Since every call writes to storage, change only the bands that changed.

plugin.set_hw_volume_curve(curve)

Replaces how the volume slider maps to the internal DAC, for example to recreate the stock firmware's Low and High Gain modes. curve is a table of exactly 101 integers (volume 0% to 100%), each a raw register value from 0 (loudest) to 255 (quietest). nil restores the built-in curve. It applies immediately but isn't saved, so set it again on every load. It affects only the headphone and line output, not Bluetooth or USB. See the Gain Mode plugin.

Device

LEDs

Plugins can drive the red and blue charge LEDs while the player is awake. First check plugin.led_available().

Function Does
plugin.led_set(color, on_or_level) color is "red" or "blue". true (full), false (off) or a level 0 to 100. Works even when the LED Indicator setting is off.
plugin.led_blink(color, on_ms, off_ms [, level]) Blinks. Each phase is clamped to 50 to 60000 ms.
plugin.led_breathe(color, rate [, level]) Pulses. rate up to 600 means breaths per minute; above 600, a period in ms (up to 120000). level is the peak, default 100.
plugin.led_get(color) { mode, level }, mode being off, on, blink, breathe or status.
plugin.led_status([color]) Returns one LED (or both) to showing the charge status.
plugin.led_release() Gives both LEDs back to the player.

Levels are clamped to 0 to 100 and default to 100 for effects. The last plugin to use the LEDs owns them until it releases them, fails, or the plugins reload. Effects pause during suspend and resume afterwards.

if plugin.led_available() then
    plugin.led_blink("red", 300, 700, 80)
    -- later:
    plugin.led_release()
end

Battery

plugin.get_battery() returns { level, charging, full, external_power }, level being 0 to 100 (0 without a battery). See also the battery_changed event.

External apps

Native programs on the SD card that the player lists under More > External Apps. Check plugin.has_capability("apps.list") and plugin.has_capability("apps.launch") first.

  • plugin.list_apps(): the installed apps that run on this board, sorted by name, as { id, name, version, opens } tables. opens is an array of the lower-case file extensions the app opens (empty when none).
  • plugin.launch_app(id [, path]): starts an app, optionally opening a file. Returns true when the launch is accepted, or nil, reason. It only works from a user action of your plugin (a list row or menu tap, a confirmation callback), once per action; the action is used up even when the call returns nil. path is an absolute path under plugin.sd_root() with no ., .. or empty parts, to an existing file with an extension from the app's opens. The app starts after your function returns, and the player asks the user first when the app's program is new or has changed. If the SD card, USB storage, DAC mode, the emulator store or playback prevents the launch, the player shows a message and nothing starts.
if plugin.has_capability("apps.list") then
    for _, app in ipairs(plugin.list_apps()) do
        print(app.id, app.name, app.version, table.concat(app.opens, ","))
    end
end

For the app side, see the External apps guide.

Network

plugin.language() (API 19)

Returns the player language code: "en", "de", "es", "fi", "fr", "it", "ja", "nl", "pt_BR", "pt_PT", "ru", "uk", "vi" or "zh_CN". Capability i18n.tr.

plugin.tr(text [, translations]) (API 19)

Returns text translated into the player language. Capability i18n.tr. translations is an optional table of translations[code][text] strings, for example { es = { ["Chapters"] = "Capítulos" } }. The lookup order is:

  1. translations[code][text] for the exact language code ("pt_BR").
  2. For a regional code, translations[base][text] of the base language (translations.pt for pt_BR and pt_PT).
  3. The player's own catalog entry for that exact English text.
  4. text unchanged.

In English text is returned unchanged. Keep the English text as the key and route every user-visible string through it:

local T = { es = { ["Chapters"] = "Capítulos" } }
local function tr(s) return plugin.tr(s, T) end
plugin.show_toast(tr("End of book"))

plugin.network_status() (API 18)

Returns { connected = bool, wifi_enabled = bool } from the player's cached Wi-Fi state (updated about every 5 seconds with the screen on, about every 45 seconds with it off while a plugin listens for network_changed). Before the first query it reports { connected = false, wifi_enabled = false }, then { false, true } if Wi-Fi is on. It never queries the radio, so it is cheap to call. connected means associated with an access point; it does not prove the internet is reachable. Check plugin.has_capability("network.status") first when you also support older players. Subscribe to the network_changed event instead of polling.

plugin.http_request(options, callback)

The way to make HTTP requests. It returns a handle immediately, the request runs in the background, and callback(status, body, error, headers) runs when it finishes. On success error is nil and headers is a table of response headers; on failure status and body are nil and error says why.

If the request can't start, it returns nil, error instead (for example "too many active HTTP requests"), and the callback never runs.

local handle = plugin.http_request({
    url = "https://example.com/api",       -- the only required field
    method = "POST",                       -- GET (default), POST, PUT, PATCH, DELETE, HEAD
    headers = { Authorization = "Bearer " .. token },
    body = '{"hello":"world"}',            -- sent only with POST, PUT and PATCH
    content_type = "application/json",
    verify_tls = true,                     -- default true
    max_response_bytes = 262144,           -- default 512 KB, at most 2 MB
    connect_timeout_ms = 10000,            -- timeouts: none by default, at most 5 minutes
    read_timeout_ms = 15000,
    total_timeout_ms = 30000,
    redirect_limit = 5,                    -- default 0, at most 10
}, function(status, body, err, headers)
    if err then plugin.show_toast(err) return end
    plugin.show_toast("HTTP " .. status .. ", " .. #body .. " bytes")
end)

Limits and rules:

  • Up to 4 requests at a time, from all plugins together.
  • Request body up to 1 MB. Up to 32 headers, names up to 63 bytes, values up to 767 bytes, plus one value per request up to 4095 bytes (for long tokens; not for Host, User-Agent, Content-Type, Content-Length or Connection). Going over a limit, or a value out of range, raises an error instead of being cut.
  • Without redirect_limit, a 3xx response is returned as a normal result. Redirects follow browser rules (303, and 301/302 after a POST, become a GET without body), and credentials (Authorization, Cookie, Cookie2, Proxy-Authorization) are never sent to a different origin (scheme, host or port). A redirect from HTTPS to HTTP is refused while verify_tls is on.
  • If a response repeats a header, the last one wins.

Error values: invalid_url, invalid_request (a line break in the URL or a header), dns_failure, connect_failed, connect_timeout, tls_failure, timeout, cancelled, too_many_redirects, response_too_large, malformed_response, io_error, insecure_redirect. They are stable, so you can compare against them.

plugin.cancel(handle) stops a request (or download) and returns whether it was still running. Its callback is then not called. The connection closes at once, except while the host name is being looked up, which finishes first.

plugin.get_download_progress(handle) — API 16

Check network.http.download_progress. Poll the handle returned by download_file_async from an existing interval while the request is active. Returns { downloaded = bytes, total = bytes }, or nil, error for a stale, cancelled, foreign, or non-download handle. total = 0 means unknown size (for example a chunked transfer); keep the bar indeterminate. For a positive total, clamp downloaded / total to 0..1. Bytes describe the network transfer, not completion of the final rename, validation, or plugin storage work. The completion callback remains the authority for success. Snapshots are coherent and no Lua or UI code runs on the download worker. API 15 download signatures and callbacks are unchanged.

plugin.download_file_async(url, dest_path [, verify_tls], callback)

Downloads a file straight to disk in the background, without loading it into memory. verify_tls defaults to true. It returns a handle, or nil, error if it can't start. callback(saved_path, error) runs when it ends; on failure it gets nil, "download failed". The file only appears at dest_path after a complete HTTP 2xx response, so a failed download never leaves a broken file or replaces an existing one. It shares the 4 request slots and can be cancelled with plugin.cancel().

local dir = plugin.sd_root() .. "/Talks"
if plugin.mkdir(dir) then
    plugin.download_file_async("https://example.com/talk.mp3", dir .. "/talk.mp3",
        function(path, err) plugin.show_toast(err or ("Saved " .. path)) end)
end

plugin.http_get(url [, verify_tls]) / plugin.http_post(url, body [, content_type] [, verify_tls])

Older, blocking requests: the whole player freezes until they finish. Use http_request instead. They return status, body (HTTP error codes such as 404 included), or nil, "network error". http_post sends body as is, with content_type defaulting to application/x-www-form-urlencoded.

Data and storage

plugin.storage and plugin.secrets

Private key-value storage for your plugin (keyed by its id, so call plugin.define() first), kept on the player's internal memory, not the SD card.

plugin.storage.set("last_sync", tostring(os.time()))
local last = plugin.storage.get("last_sync", "never")   -- with a default
local keys = plugin.storage.list("cache_")              -- keys starting with "cache_"
plugin.storage.delete("last_sync")

plugin.secrets.set("access_token", token)
local token = plugin.secrets.get("access_token")         -- nil if missing
if plugin.secrets.exists("access_token") then ... end
plugin.secrets.delete("access_token")
  • get(key [, default]) returns default (or nil) for a missing key. list([prefix]) lists all keys when the prefix is omitted or empty.
  • Values are strings (binary is fine), up to 256 KB each. Setting the same value again doesn't write to storage again.
  • set and delete return true on success. false can mean a limit was reached, or that the change was made but couldn't be confirmed as safe from a sudden power loss, so don't retry in a loop.
  • Limits: 2 MB and 500 keys per plugin (storage and secrets together), 8 MB for all plugins.
  • secrets is for tokens and passwords. It has get, set, exists and delete but no list, so secret names can't be enumerated. get returns nil for a missing secret (it was added later: check storage.secrets_get). Only your plugin can read its secrets, but they are not encrypted: anyone with root access to the device can. Don't describe them as encrypted to your users.

plugin.json_decode(text [, limits]) / plugin.json_encode(value [, limits])

Convert between JSON and Lua. They return value or nil, error.

Limit Default and maximum
max_input_bytes (decode) / max_output_bytes (encode) 512 KB
max_nesting 32, at most 64
max_entries 10000

Larger values are lowered to the maximum. Keep in mind:

  • JSON null becomes nil, so it looks like a missing key.
  • Numbers are exact only up to 2^53: treat large ids as strings.
  • A table with items 1..n becomes a JSON array; any other table, even an empty one, an object. Object keys must be strings.
  • Invalid UTF-8 is an error.

plugin.md5(text)

Returns the MD5 hash of text in lowercase hex, for APIs that sign requests this way (like Last.fm).

ZIP files and EPUBs

  • plugin.zip_list(path): the names of all entries, folders included.
  • plugin.zip_read(path, entry): one entry's contents (entry is the exact, case-sensitive name), as bytes, info with info.method (0 stored, 8 deflate), info.compressed and info.uncompressed. Both the compressed and the uncompressed size must be at most 256 KB.

Both return nil, reason on failure: not_found, encrypted, zip64_unsupported, unsupported_method, corrupt, crc_mismatch, entry_too_large, io_error or nomem. Archives with more than 2000 entries or a directory larger than 256 KB count as corrupt.

Image thumbnails

  • plugin.zip_image_async(path, entry, dest, max_w, max_h, callback) makes a thumbnail from a JPEG, PNG or BMP inside a ZIP (an EPUB cover, for example), up to 3 MB.
  • plugin.image_thumbnail_async(source, dest, max_w, max_h, callback) does the same from an image file, up to 3 MB. Check data.image_thumbnail.

Both scale the image to fit max_w x max_h (16 to 800), never enlarging or cropping it, and write it to dest, which must end in .bin. The result can be used as a show_list icon or a show_text_view picture. They run in the background and call callback(dest) or callback(nil, reason).

  • They return true, or nil, "busy" while another thumbnail job (from any plugin) runs: try again a bit later.
  • Failure reasons include the ZIP reasons, "unsupported image", "could not decode image", "could not write image", "could not open image", "not a regular file", "image too large" and "could not read image". "busy" and "nomem" are temporary (the player was decoding artwork), so don't treat the image as broken.
  • dest is replaced only on success. Jobs are cancelled, without callback, when the plugins reload.
  • The player caches decoded image files by path. A finished job (and a finished download_file_async) refreshes that path, so the new image shows. A file you rewrite yourself (io, os.rename) can still show the old image until it leaves the cache: write changed images to a new path, and spell each path the same way everywhere.

  • plugin.image_wallpaper_async(source, dest, callback) (API 16, data.wallpaper) prepares a JPEG, PNG or BMP file up to 3 MB as a wallpaper. It center-crops and resizes to the active display's exact pixel dimensions, then writes an LVGL RGB565 .bin image. It uses the same background worker, callback, cancellation, and failure behavior as image_thumbnail_async. Pass that .bin to plugin.set_home_layout({}, {background_image = dest}); this accepts only a valid RGB565 LVGL image whose dimensions and byte layout fit the current display.

Startup splash image

plugin.set_startup_image_async(prepared_bin_path_or_nil, callback) selects the image shown while the player starts. Use plugin.image_startup_async(source, dest, callback) to prepare a JPEG, PNG or BMP (up to 3 MB) as a board-sized RGB565 .bin first. It center-crops to the firmware's native screen width and height; the image is not tinted. The callback receives dest or nil, reason, with the same shared worker, busy result, cancellation and failure behavior as image_wallpaper_async. The destination must end in .bin.

Check plugin.has_capability("ui.startup_image") before preparing, installing or restoring a splash. This additive capability does not change API version 16. Startup image selection requires firmware whose loader supports the override. With the early-splash firmware support, the same selection also appears at the Linux boot screen, immediately after internal storage mounts. This requires a full firmware update; a player-only update cannot install the init scripts and helper. The early renderer does not mount storage itself or write a NAND marker.

set_startup_image_async returns true when the job starts, or nil, "busy" if another image job is running. Its callback receives (true, nil) after install or restore succeeds, or (false, reason) on failure. Passing nil removes the custom override and restores the built-in splash. Validation and preparation failures keep the previous selection intact. Changes are used on the next boot; they do not redraw the current screen or restart the player.

plugin.has_startup_image() returns whether a valid custom image is installed for this board. The native Accent Color setting can tint the built-in splash; it does not recolor custom images.

plugin.html_to_blocks(bytes [, options])

Turns an HTML or XHTML chapter into a list of blocks for show_text_view. Returns a list of { kind, level, text } with a truncated flag, or nil, reason (input_too_large over 512 KB, bad_args, nomem).

  • kind is "p" (paragraphs, div, li, blockquote), "h" (headings, with level 1 to 6), "img" (<img>, or an SVG <image> with href or xlink:href; text is the image source, alt its alt text) or "hr".
  • Scripts, styles, head and comments are dropped. Common entities are decoded, whitespace is collapsed, and <br> becomes a line break.
  • Output stops at 2000 blocks or 256 KB of text, with truncated set.
  • options is reserved; if given, it must be a table.

Events and timers

plugin.on(event, callback)

Runs callback whenever something happens. Every subscribed plugin is called. Up to 16 subscribers per event; an unknown event name is an error.

Event Arguments When
track_started title, artist, album, duration_seconds, provider, track_id A new track starts, for any reason. provider and track_id are "" except for play_remote tracks.
paused, resumed none Playback pauses or resumes.
stopped none Playback stops (not when a queue simply ends; see queue_exhausted).
queue_exhausted direction (1 next, -1 previous) Next or Previous is pressed with no track left in that direction.
screen_woke none The screen turns back on.
volume_changed percent The volume changes, at most twice a second.
battery_changed same table as get_battery() A battery value changes.
network_changed { connected, wifi_enabled } (same table as network_status()) The cached Wi-Fi state changes: connected or disconnected, Wi-Fi switched on or off. API 18. connected means associated with the access point (wpa COMPLETED), which can be just before DHCP finishes, so a send made right on the event may fail once. The first reading after boot is only a baseline; if the first query finds the player connected, you get a normal change event.
screenshot_saved path A screenshot was saved.
screenshot_failed reason A screenshot couldn't be saved.
button_lock_changed locked Native hardware button lock toggled.
suspending none The player is about to sleep (it can't be stopped).
system_resumed none The player woke from sleep.

plugin.set_interval(seconds, callback) / plugin.clear_interval(handle)

Runs callback every seconds (at least 1) until cleared. Returns a handle; clearing an unknown or already cleared handle does nothing. Up to 16 timers from all plugins together. Callbacks run on the interface thread, so keep them quick.

Examples

Plugin links point to the canonical compas-plugins repository. The separate examples are in its examples/ directory.

Example Shows
Audiobooks Books row, folder scanning, resume, bookmarks, chapters, sleep timer
Podcasts RSS and OPML, episode downloads, resume
NetRadio Stream Media tile and radio streams from Radio.txt
HiByStockPlayer A Player layout in the style of the stock HiBy OS player, with its own lyrics area, offered in Settings and applied from a row
Themes Historical reference format: icons, colors, Home layout, saved choice, refresh_theme
SoundProfiles Switching EQ profiles
MSEB Chained settings screens, sliders sharing EQ bands, backup and restore
GainMode Low/High Gain volume curves
PlaybackExtras Toggles, sliders, nested settings, row icons
PlayThrough Continuing into the next folder or album when a queue ends
ExtendedSleepTimer A longer sleep timer with stop()
LastFmScrobblerV2 Events, timers, text input, MD5, async HTTP
AsyncHttp http_request and cancel
PluginApiInfo Version and capability checks
NestedLists Stacked lists and busy text input
EpubReader ZIP and HTML helpers, paged reading, saved position
LyricsFetcher LRCLIB synced .lrc sidecar for the current local track
CoverArtFetcher MusicBrainz + Cover Art Archive cover.jpg for the current album folder
AlbumShuffle Random albums with in-album track order, continued on queue_exhausted
ListenBrainzScrobbler ListenBrainz user-token scrobble and offline queue (plugin store)
RadioBrowser Radio Browser search and Radio.txt favorites (plugin store)

Example plugins: lyrics, covers, album shuffle

The plugin packages are in the compas-plugins repository; standalone snippets are in its examples. After copying a plugin package's Lua file to <SD card>/.plugins/, tap Refresh Plugins.

Lyrics Fetcher

Settings > Library > Lyrics Fetcher. Requires Plugin API 17.

  • Fetch lyrics for current track queues a lookup on LRCLIB using title, artist, album and duration. Automatic fetch, off by default, adds missing lyrics when a local track starts.
  • Pending requests are saved on the SD card before network work starts. They survive track changes and player restarts, and resume when Wi-Fi reconnects. Existing pending requests continue even if automatic fetching is subsequently turned off.
  • Each plugin queue holds up to 500 unique requests; duplicates do not consume another slot. A full queue refuses new requests without removing older ones.
  • Pending downloads can be retried or cleared from the plugin's settings. Clearing the queue prevents an outstanding response from installing lyrics. Dismissing a progress card only hides the card.
  • A synchronized .lrc sidecar is left alone. Unsynchronized lyrics are backed up to .compas-backup before a synchronized sidecar replaces them. The audio filename's extension is replaced with .lrc; the API JSON is never saved as lyrics.
  • Network failures and temporary server errors stay queued with a retry delay. A definitive no-match or instrumental result ends that request. Downloads are saved as they complete, so completed work survives interruptions.
  • Streams, remote tracks and unsafe paths are skipped. Embedded tag lyrics are not exposed to plugins and cannot be used to decide whether a sidecar is missing.

Cover Art Fetcher

Settings > Library > Cover Art Fetcher. Requires Plugin API 17.

  • Fetch cover for current album queues a MusicBrainz lookup and a 500px (or 250px) front JPEG from the Cover Art Archive. Automatic fetch, off by default, adds missing covers when a local track starts.
  • Pending album requests are saved on the SD card, deduplicated and resumed when Wi-Fi reconnects, including after player restarts. Pending downloads can be retried or cleared from settings. Turning automatic fetching off prevents new automatic requests; it does not discard existing requests.
  • The queue holds up to 500 unique album destinations; duplicates do not consume another slot.
  • Saves use <album title>.jpg beside the track. Existing artwork is preserved, and matching remains conservative: album identity and neighboring filename collisions are checked before saving. Embedded pictures are not exposed to plugins, so an album with embedded artwork may still receive a sidecar.
  • Each completed download has a persistent receipt. Downloaded covers lists them, and confirmed reverts move unchanged downloaded files to backups. Automatic queued downloads do not undo intentional reverts; a new manual fetch can request that cover again.
  • Network failures and temporary server errors remain queued with a retry delay. Definitive no-art or no-match results end that request. Completed covers and their history are saved as each download finishes.
  • MusicBrainz lookups remain limited to one per second. Image responses are bounded to 2 MiB, and only a front thumbnail is accepted. Completed saves request a coalesced library refresh.
  • Repair shared folder artwork remains a separate, confirmed action: it lists generic artwork that affects several albums and renames selected files to .compas-backup.

Album Shuffle

Settings > Playback & Controls > Album Shuffle.

  • Start album shuffle picks a random album through paged plugin.library_get_albums, resolves identity with plugin.library_get_song(first_song_id) (preferring album_artist so compilations keep every track), loads plugin.get_album_tracks(artist, album) in album order, and plays them with plugin.play_list(paths, 1). Requires plugin API 15.
  • When the queue is exhausted forward (queue_exhausted with direction == 1), or the last track ends naturally, another album is chosen. Immediate repeats are avoided when more than one album exists. An empty library is reported with a toast.
  • Native shuffle would reorder tracks inside the album, so start this while the player is already in sequential mode (or select it with plugin.set_play_mode("sequential") on builds advertising playback.settings). Explicit Stop, picking a different track/queue, or Stop album shuffle ends the session so the plugin does not take over playback.

Testing and debugging

  1. Write the plugin in any text editor. luac -p MyPlugin.lua catches syntax errors before copying.
  2. Copy it to <SD card>/.plugins/.
  3. Tap Refresh Plugins in Settings > System > Plugin Manager (this reloads every plugin and returns to Home), or restart.
  4. Watch the player's output through ADB.

Errors look like this:

Message Meaning
[plugins] failed to load <path>: <error> A syntax error or an error in the top-level code.
[plugins] <context> error: <error> A callback failed; <context> names which one.

Plugin Manager can switch each plugin off. Switching one off stops it from loading; it doesn't undo what it already changed. Copied icons and EQ settings, for example, stay until changed again.

Extending the API (C developers)

To add a function plugins can call, follow the existing l_plugin_* functions in src/plugins/manager/plugin_manager.c: read the arguments with luaL_check*/luaL_opt*, do the work, push the results, return their count, and add the function to plugin_funcs[].

  • If it touches screens, widgets or other UI state, go through a gui_plugin_* function in gui.c (declared in gui.h), like show_list, play_file and the playback controls do.
  • If it uses a self-contained module with no UI (peq.c, http_client.c), call it directly, like the eq_* and HTTP functions do.

When unsure, look at what the native UI does around the same call. If it also updates icons, saves state or checks a condition, that belongs in the gui.c bridge too, so a plugin can't skip it.

Add a capability token to plugin_capabilities[] so plugins can detect the new feature, and document it here.

Playback and audio APIs

Playback settings

  • plugin.get_crossfade() returns true when crossfade is enabled and false otherwise.
  • plugin.set_crossfade(enabled) sets crossfade using Lua truthiness. It returns nothing.
  • plugin.get_gapless() returns true when gapless playback is enabled and false otherwise.
  • plugin.set_gapless(enabled) sets gapless playback using Lua truthiness. It returns nothing.
  • plugin.get_replaygain_mode() returns "off", "track", or "album". An invalid saved value is reported as "off".
  • plugin.set_replaygain_mode(mode) accepts "off", "track", or "album". An unsupported mode raises a Lua error. It returns nothing.

A–B comparison and clip looping

  • plugin.set_ab_loop(start_seconds, end_seconds) sets loop points in seconds and returns whether the player accepted them.
  • plugin.get_ab_loop() returns {start, finish} in seconds, or nil when no loop is set.
  • plugin.clear_ab_loop() clears the loop and returns nothing.
  • plugin.prepare_ab_switch(path) prepares a local file as source B and returns whether the player accepted it.
  • plugin.select_ab_source(source) selects source "a" or "b" and returns whether the selection succeeded. Any other value raises a Lua error.
  • plugin.get_ab_switch() returns {preparing, ready, source}. source is "a" or "b".
  • plugin.clear_ab_switch() clears the A–B comparison and returns nothing.
  • plugin.audio_loop_start(path) starts a short loop from a local file, pausing current playback first. It returns whether the loop started; an invalid path raises a Lua error.
  • plugin.audio_loop_active() returns true when the short loop is active and false otherwise.
  • plugin.audio_loop_stop() stops the short loop and returns nothing.

Equalizer

  • plugin.eq_apply_profile(path [, options]) loads a profile from a checked external path and returns whether it loaded. The profile is saved by default; set options.persist = false to apply it without saving.
  • plugin.get_eq_state() returns a detached table containing bypass, preamp_db, stereo_width, crossfeed, crossfeed_angle, and ten bands. Each band has index, freq_hz, gain_db, q, type, and enabled fields.
  • plugin.eq_apply_state(state [, options]) validates and applies the supplied EQ state, then returns true. Invalid fields raise a Lua error. options.persist defaults to true; crossfeed and crossfeed_angle may be omitted.

Track and output information

  • plugin.get_track_metadata(path) looks up a local SD card path in the metadata cache; it does not scan the file or read its tags. It returns a table with id, path, title, artist, album, album_artist, and genre, or nil for an invalid path or cache miss.
  • plugin.get_playback_format() returns the current source and output format, or nil if there is no valid format. The table has path, codec, source/output sample rate and bit depth, channels, bitrate_kbps, duration_seconds, is_stream, seekable, is_dsd, dop, ReplayGain fields, software_volume_gain, playback_speed, crossfade_enabled, and generation.
  • plugin.get_output_info() returns the current output route and format. Its table has route, active, dop, native_dsd, resampling, resampling_known, sample_rate, bit_depth, hardware_sample_rate, hardware_bit_depth, and bluetooth_codec. Numeric fields or bluetooth_codec may be nil when unavailable.

API index

Looking for a particular function, setting or widget? Choose a name to see how to use it.

Functions

Capabilities

Events

Menus you can add to

Ways to open your plugin

API reference

This guide covers API 17. Older minimum versions are listed where known. For names you choose yourself, such as actions or image files, check the naming rules below.

Functions

plugin.api_version
Signature
plugin.api_version()
Returns
- plugin.api_version() returns the API version, 19 on player builds that include API 19 (check it; older firmware reports less).
Required capability
None required.
API
API 19

View source

plugin.audio_loop_active

Reports whether a short-clip audio loop is active.

Signature
plugin.audio_loop_active()
Returns
Boolean indicating whether the native short-clip loop is active.
Required capability
audio.loop
Capability checks
audio.loop: required
API
API 19; available since API 16

View source

plugin.audio_loop_start

Starts a short local clip loop; it pauses a playing track first. A path validation failure raises a Lua error.

Signature
plugin.audio_loop_start(path)
Returns
Boolean indicating whether the local clip loop started.
Required capability
audio.loop
Capability checks
audio.loop: required
API
API 19; available since API 16

View source

plugin.audio_loop_stop

Stops the native short-clip audio loop.

Signature
plugin.audio_loop_stop()
Returns
No return value.
Required capability
audio.loop
Capability checks
audio.loop: required
API
API 19; available since API 16

View source

plugin.cancel

No API heading or table row was found; native return type is grounded in handler pushes.

Signature
plugin.cancel(handle)
Returns
Boolean indicating whether the matching cancellable HTTP request or download was found and cancelled.
Required capability
None required.
API
API 19

View source

plugin.cancel_file_operation

- plugin.cancel_file_operation(): stops this plugin's operation after its current file (a partly copied file is removed). Returns whether there was one; an operation the user started is left alone.

Signature
plugin.cancel_file_operation()
Returns
Returns whether there was one; an operation the user started is left alone.
Required capability
None required.
Capability checks
filesystem.file_ops: check before file operations
API
API 19

View source

plugin.clear_ab_loop

Clears the native A–B loop.

Signature
plugin.clear_ab_loop()
Returns
No return value.
Required capability
playback.ab_loop
Capability checks
playback.ab_loop: required
API
API 19; available since API 16

View source

plugin.clear_ab_switch

Clears the native A–B comparison state.

Signature
plugin.clear_ab_switch()
Returns
No return value.
Required capability
playback.ab_switch
Capability checks
playback.ab_switch: required
API
API 19; available since API 16

View source

plugin.clear_interval

Clears a timer. Unknown or already-cleared handles have no effect.

Signature
plugin.clear_interval(handle)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.close_progress
Signature
plugin.close_progress(handle)
Returns
Closes the owned card; returns whether it was visible.
Required capability
None required.
API
API 19

View source

plugin.configure_button_lock

### plugin.configure_button_lock(enabled) Arms the native Power + Volume Up chord that toggles hardware button lock (API 17, capability ui.button_lock). Pass true to enable the chord, false to disarm it. Returns the board-specific shortcut text for use in settings. On R3II 2025, hold Power first and turn the volume knob up; knob-first remains an ordinary volume adjustment. The enabled preference is the plugin's to persist; the locked flag itself is transient and starts unlocked.

Signature
plugin.configure_button_lock(enabled)
Returns
Returns the board-specific shortcut text for use in settings.
Required capability
ui.button_lock
Capability checks
ui.button_lock: required
API
API 19; available since API 17

View source

plugin.define

### plugin.define(info) Declare who the plugin is, once, at the top of the file:

Signature
plugin.define(info)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.download_file_async

### plugin.download_file_async(url, dest_path [, verify_tls], callback) Downloads a file straight to disk in the background, without loading it into memory. verify_tls defaults to true. It returns a handle, or nil, error if it can't start. callback(saved_path, error) runs when it ends; on failure it gets nil, "download failed". The file only appears at dest_path after a complete HTTP 2xx response, so a failed download never leaves a broken file or replaces an existing one. It shares the 4 request slots and can be cancelled with plugin.cancel().

Signature
plugin.download_file_async(url, dest_path [, verify_tls], callback)
Returns
It returns a handle, or nil, error if it can't start.
Required capability
None required.
API
API 19

View source

plugin.eq_apply_profile

Loads an EQ profile from a checked external path and saves it unless options.persist is false.

Signature
plugin.eq_apply_profile(path [, options])
Returns
Boolean indicating whether the profile loaded; options.persist defaults to true and controls saving the loaded settings.
Required capability
None required.
Capability checks
audio.peq.transient: check before using persist = false
API
API 19

View source

plugin.eq_apply_state

Validates a complete EQ snapshot before applying it. Optional options.persist defaults to true; crossfeed and crossfeed_angle may be omitted.

Signature
plugin.eq_apply_state(state [, options])
Returns
true after all fields validate and the state is applied; malformed fields raise a Lua error.
Required capability
audio.peq.state
Capability checks
audio.peq.state: check before applying an EQ state snapshot, audio.crossfeed.angle: check before relying on the optional crossfeed_angle field
API
API 19

View source

plugin.eq_get_crossfeed

Gets headphone crossfeed strength (capability audio.crossfeed). 0 is off.

Signature
plugin.eq_get_crossfeed()
Returns
Number in the native crossfeed range 0 (off) to 1 (full effect).
Required capability
audio.crossfeed
Capability checks
audio.crossfeed: required
API
API 19

View source

plugin.eq_get_stereo_width

Gets the configured width (API 16, capability audio.stereo_width).

Signature
plugin.eq_get_stereo_width()
Returns
Number in the native stereo-width range 0 (mono fold) to 2 (wider), with 1 neutral.
Required capability
audio.stereo_width
Capability checks
audio.stereo_width: required
API
API 19; available since API 16

View source

plugin.eq_load_profile
Signature
plugin.eq_load_profile(path)
Returns
Loads a .peq profile. Returns false if it can't be read.
Required capability
None required.
API
API 19

View source

plugin.eq_reset

Restores the defaults.

Signature
plugin.eq_reset()
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.eq_save_profile
Signature
plugin.eq_save_profile(path)
Returns
Saves the current EQ as a .peq profile, the same format as the EQ screen. Returns false if it can't be written.
Required capability
None required.
API
API 19

View source

plugin.eq_set_band

Sets one band. index is 1 to 10.

Signature
plugin.eq_set_band(index, freq_hz, gain_db, q)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.eq_set_band_enabled

Turns one band on or off.

Signature
plugin.eq_set_band_enabled(index, on)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.eq_set_band_type

"peaking", "low_shelf" or "high_shelf".

Signature
plugin.eq_set_band_type(index, type)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.eq_set_bypass

true turns off the EQ bands, preamp and stereo width. Crossfeed remains independent; with Crossfeed also off and its ramp settled, the PCM stage leaves samples unchanged. DoP output never reaches it.

Signature
plugin.eq_set_bypass(on)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.eq_set_crossfeed

Sets strength from 0 (off) to 1 (full effect). Rejects nonfinite or out-of-range values. 0.65 is a conservative strength when a plugin turns crossfeed on itself.

Signature
plugin.eq_set_crossfeed(strength)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.eq_set_preamp

Sets the preamp gain.

Signature
plugin.eq_set_preamp(db)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.eq_set_stereo_width

Sets width from 0 (mono fold) through 1 (neutral) to 2 (wider). Rejects nonfinite/out-of-range values.

Signature
plugin.eq_set_stereo_width(width)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.file_copy

Copies SD-card paths in the background. Paths must use the required plain SD path form; existing destination names receive a suffix and protected player directories cannot be moved or deleted.

Signature
plugin.file_copy(paths, dest_dir [, callback])
Returns
true when the operation starts; nil, error_text if it cannot start. The optional callback receives a final status table or nil if a newer operation replaced the result.
Required capability
None required.
Capability checks
filesystem.file_ops: check before file operations
API
API 19

View source

plugin.file_delete

Deletes SD-card paths in the background. Paths must use the required plain SD path form; protected player directories cannot be moved or deleted.

Signature
plugin.file_delete(paths [, callback])
Returns
true when the operation starts; nil, error_text if it cannot start. The optional callback receives a final status table or nil if a newer operation replaced the result.
Required capability
None required.
Capability checks
filesystem.file_ops: check before file operations
API
API 19

View source

plugin.file_move

Moves SD-card paths in the background. Paths must use the required plain SD path form; existing destination names receive a suffix and protected player directories cannot be moved or deleted.

Signature
plugin.file_move(paths, dest_dir [, callback])
Returns
true when the operation starts; nil, error_text if it cannot start. The optional callback receives a final status table or nil if a newer operation replaced the result.
Required capability
None required.
Capability checks
filesystem.file_ops: check before file operations
API
API 19

View source

plugin.file_operation_status

Reads file-operation progress and terminal status.

Signature
plugin.file_operation_status()
Returns
Status table {running, done, total, failed, stopped, current} for the running or most recent file operation.
Required capability
None required.
Capability checks
filesystem.file_ops: check before file operations
API
API 19

View source

plugin.get_ab_loop

Reads the native A–B loop points.

Signature
plugin.get_ab_loop()
Returns
Table {start, finish} in seconds when set; nil when no loop is active.
Required capability
playback.ab_loop
Capability checks
playback.ab_loop: required
API
API 19; available since API 16

View source

plugin.get_ab_switch

Returns the native A–B comparison preparation and selected-source state.

Signature
plugin.get_ab_switch()
Returns
Table {preparing, ready, source}, where source is a or b.
Required capability
playback.ab_switch
Capability checks
playback.ab_switch: required
API
API 19; available since API 16

View source

plugin.get_album_tracks

- plugin.get_album_tracks(artist, album): the album's track paths in album order, or nil.

Signature
plugin.get_album_tracks(artist, album)
Returns
Array-like table of track-path strings in album order, or nil when no tracks are available.
Required capability
None required.
API
API 19; available since API 15

View source

plugin.get_app_info
Signature
plugin.get_app_info()
Returns
- plugin.get_app_info() returns { version, build, platform, plugin_api }.
Required capability
None required.
API
API 19

View source

plugin.get_artist_albums

- plugin.get_artist_albums(artist): the artist's album names, sorted, or nil.

Signature
plugin.get_artist_albums(artist)
Returns
Array-like table of album-name strings, or nil when no albums are available.
Required capability
None required.
API
API 19

View source

plugin.get_battery

Returns the current battery and external-power snapshot.

Signature
plugin.get_battery()
Returns
Battery table {level, charging, full, external_power}; level is the displayed battery percentage.
Required capability
None required.
API
API 19

View source

plugin.get_crossfade

Reads the crossfade setting.

Signature
plugin.get_crossfade()
Returns
Boolean indicating whether crossfade is enabled.
Required capability
playback.settings
Capability checks
playback.settings: required
API
API 19; available since API 16

View source

plugin.get_current_track_path
Signature
plugin.get_current_track_path()
Returns
absolute path, or nil when nothing is loaded
Required capability
None required.
API
API 19

View source

plugin.get_download_progress

Returns a coherent snapshot of an active asynchronous download's network transfer progress.

Signature
plugin.get_download_progress(handle)
Returns
Progress table {downloaded, total} in bytes, or nil, error_text for a stale, cancelled, foreign, or non-download handle. total = 0 means the size is unknown.
Required capability
network.http.download_progress
Capability checks
network.http.download_progress: conditional/check before using documented feature
API
API 19; available since API 16

View source

plugin.get_duration

seconds

Signature
plugin.get_duration()
Returns
Number of seconds for the current track duration.
Required capability
None required.
API
API 19

View source

plugin.get_eq_state

Returns a snapshot of the current EQ configuration.

Signature
plugin.get_eq_state()
Returns
Detached table with bypass, preamp_db, stereo_width, crossfeed, crossfeed_angle, and ten bands containing index, freq_hz, gain_db, q, type, and enabled.
Required capability
audio.peq.state
Capability checks
audio.peq.state: check before using the EQ state snapshot, audio.crossfeed.angle: check before relying on the optional crossfeed_angle field
API
API 19; available since API 16

View source

plugin.get_gapless

Reads the gapless playback setting.

Signature
plugin.get_gapless()
Returns
Boolean indicating whether gapless playback is enabled.
Required capability
playback.settings
Capability checks
playback.settings: required
API
API 19; available since API 16

View source

plugin.get_mseb_state

No API heading or table row was found; native return type is grounded in handler pushes.

Signature
plugin.get_mseb_state()
Returns
Table with enabled, ten integer controls (temperature, bass_ext, bass_texture, thickness, vocal_pos, female_vocal, sibilance_lf, sibilance_hf, impulse_tone, air), and width.
Required capability
None required.
API
API 19

View source

plugin.get_next_album_tracks

- plugin.get_next_album_tracks(artist, album): the tracks of the artist's next album, or nil if there is none (it doesn't wrap). Useful to keep playing through a discography.

Signature
plugin.get_next_album_tracks(artist, album)
Returns
Array-like table of next-album track paths, or nil when there is no next album.
Required capability
None required.
API
API 19

View source

plugin.get_now_playing
Signature
plugin.get_now_playing()
Returns
title, artist, album, duration_seconds, or nil if nothing has played yet
Required capability
None required.
API
API 19

View source

plugin.get_output_info

Returns the current hardware output route and format snapshot.

Signature
plugin.get_output_info()
Returns
Output table with route, active, dop, native_dsd, resampling, resampling_known, sample_rate, bit_depth, hardware_sample_rate, hardware_bit_depth, and bluetooth_codec; unavailable numeric fields or codec are nil.
Required capability
playback.output_info
Capability checks
playback.output_info: required
API
API 19; available since API 16

View source

plugin.get_play_mode

"sequential", "repeat_all", "repeat_one" or "shuffle"

Signature
plugin.get_play_mode()
Returns
String enum: sequential, repeat_all, repeat_one, shuffle, or shuffle_once.
Required capability
None required.
API
API 19

View source

plugin.get_playback_format

Returns a snapshot of the current source and output audio format.

Signature
plugin.get_playback_format()
Returns
Format table with path, codec, source/output sample rate and bit depth, channels, bitrate_kbps, duration_seconds, is_stream, seekable, is_dsd, dop, ReplayGain fields, software_volume_gain, playback_speed, crossfade_enabled, and generation; nil when no valid current format exists.
Required capability
playback.format
Capability checks
playback.format: required
API
API 19; available since API 16

View source

plugin.get_playback_progress
Signature
plugin.get_playback_progress(expected_path)
Returns
A coherent { position, duration, playing, paused, terminal } snapshot, or nil unless the absolute path exactly matches the current playback generation or its retained terminal state. Check playback.progress before using it. terminal is "active", "natural_eof", or "manual_stop". active can include decoder recovery after a premature EOF; only natural_eof confirms natural completion. Use this for checkpoints that must distinguish completion from a manual stop; the legacy getters above are independent snapshots.
Required capability
None required.
Capability checks
playback.progress: conditional/check before using documented feature
API
API 19

View source

plugin.get_playback_speed
Signature
plugin.get_playback_speed()
Returns
Returns the actual committed speed; 1.0 while idle or for unsupported formats.
Required capability
None required.
API
API 19

View source

plugin.get_position

seconds

Signature
plugin.get_position()
Returns
Number of seconds at the current playback position.
Required capability
None required.
API
API 19

View source

plugin.get_replaygain_mode

Reads the ReplayGain mode; an invalid stored native value is reported as off.

Signature
plugin.get_replaygain_mode()
Returns
String: off, track, or album.
Required capability
playback.settings
Capability checks
playback.settings: required
API
API 19; available since API 16

View source

plugin.get_soundstage_state

No API heading or table row was found; native return type is grounded in handler pushes.

Signature
plugin.get_soundstage_state()
Returns
One Lua value: table.
Required capability
None required.
API
API 19

View source

plugin.get_track_metadata

Looks up one validated local SD song path in the metadata cache; it does not scan files or tags.

Signature
plugin.get_track_metadata(path)
Returns
Metadata table with id, path, title, artist, album, album_artist, and genre; nil for an invalid path or cache miss.
Required capability
library.track_metadata
Capability checks
library.track_metadata: check before using the scanned metadata lookup
API
API 19; available since API 16

View source

plugin.get_volume

0 to 100

Signature
plugin.get_volume()
Returns
Integer volume percentage, clamped to 0–100.
Required capability
None required.
API
API 19

View source

plugin.has_capability

- plugin.has_capability(name) returns whether one feature exists. Prefer it over api_min when you only need one feature. Tokens:

Signature
plugin.has_capability(name)
Returns
- plugin.has_capability(name) returns whether one feature exists.
Required capability
None required.
API
API 19

View source

plugin.has_startup_image

No API heading or table row was found; native return type is grounded in handler pushes.

Signature
plugin.has_startup_image()
Returns
Boolean: true when a startup image override is configured; false when the built-in splash is selected.
Required capability
None required.
Capability checks
ui.startup_image: check before querying the startup-image override
API
API 19

View source

plugin.html_to_blocks

### plugin.html_to_blocks(bytes [, options]) Turns an HTML or XHTML chapter into a list of blocks for show_text_view. Returns a list of { kind, level, text } with a truncated flag, or nil, reason (input_too_large over 512 KB, bad_args, nomem).

Signature
plugin.html_to_blocks(bytes [, options])
Returns
Returns a list of { kind, level, text } with a truncated flag, or nil, reason (input_too_large over 512 KB, bad_args, nomem).
Required capability
None required.
API
API 19

View source

plugin.http_get

### plugin.http_get(url [, verify_tls]) / plugin.http_post(url, body [, content_type] [, verify_tls]) Older, blocking requests: the whole player freezes until they finish. Use http_request instead. They return status, body (HTTP error codes such as 404 included), or nil, "network error". http_post sends body as is, with content_type defaulting to application/x-www-form-urlencoded.

Signature
plugin.http_get(url [, verify_tls])
Returns
They return status, body (HTTP error codes such as 404 included), or nil, "network error".
Required capability
None required.
API
API 19

View source

plugin.http_post

### plugin.http_get(url [, verify_tls]) / plugin.http_post(url, body [, content_type] [, verify_tls]) Older, blocking requests: the whole player freezes until they finish. Use http_request instead. They return status, body (HTTP error codes such as 404 included), or nil, "network error". http_post sends body as is, with content_type defaulting to application/x-www-form-urlencoded.

Signature
plugin.http_post(url, body [, content_type] [, verify_tls])
Returns
They return status, body (HTTP error codes such as 404 included), or nil, "network error".
Required capability
None required.
API
API 19

View source

plugin.http_request

### plugin.http_request(options, callback) The way to make HTTP requests. It returns a handle immediately, the request runs in the background, and callback(status, body, error, headers) runs when it finishes. On success error is nil and headers is a table of response headers; on failure status and body are nil and error says why.

Signature
plugin.http_request(options, callback)
Returns
It returns a handle immediately, the request runs in the background, and callback(status, body, error, headers) runs when it finishes.
Required capability
None required.
API
API 19

View source

plugin.image_startup_async

Prepares a JPEG, PNG, or BMP as a board-sized RGB565 startup image at a destination ending in .bin.

Signature
plugin.image_startup_async(source, dest, callback)
Returns
true when the image worker starts; nil, error_text if busy or the worker cannot start. The callback receives dest, nil on success or nil, reason on failure.
Required capability
ui.startup_image
Capability checks
ui.startup_image: check before preparing a startup image
API
API 19

View source

plugin.image_thumbnail_async

Creates a fitted RGB565 thumbnail from an image file.

Signature
plugin.image_thumbnail_async(source, dest, max_w, max_h, callback)
Returns
true when the worker starts; nil and an error string if busy or it cannot start. The callback receives dest, nil on success or nil, reason on failure.
Required capability
data.image_thumbnail
API
API 19

View source

plugin.image_wallpaper_async

Crops and resizes an image to the active display dimensions as RGB565.

Signature
plugin.image_wallpaper_async(source, dest, callback)
Returns
true when the worker starts; nil and an error string if busy or it cannot start. The callback receives dest, nil on success or nil, reason on failure.
Required capability
data.wallpaper
API
API 19; available since API 16

View source

plugin.is_list_showing

No API heading or table row was found; native return type is grounded in handler pushes.

Signature
plugin.is_list_showing(handle)
Returns
Boolean: true only while the list handle's screen is the top screen.
Required capability
None required.
API
API 19

View source

plugin.is_paused

booleans

Signature
plugin.is_paused()
Returns
Boolean indicating whether playback is paused.
Required capability
None required.
API
API 19

View source

plugin.is_playing

booleans

Signature
plugin.is_playing()
Returns
Boolean indicating whether playback is active.
Required capability
None required.
API
API 19

View source

plugin.json_decode

### plugin.json_decode(text [, limits]) / plugin.json_encode(value [, limits]) Convert between JSON and Lua. They return value or nil, error.

Signature
plugin.json_decode(text [, limits])
Returns
They return value or nil, error.
Required capability
None required.
API
API 19

View source

plugin.json_encode

### plugin.json_decode(text [, limits]) / plugin.json_encode(value [, limits]) Convert between JSON and Lua. They return value or nil, error.

Signature
plugin.json_encode(value [, limits])
Returns
They return value or nil, error.
Required capability
None required.
API
API 19

View source

plugin.language

### plugin.language() (API 19) Returns the player language code: "en", "de", "es", "fi", "fr", "it", "ja", "nl", "pt_BR", "pt_PT", "ru", "uk", "vi" or "zh_CN". Capability i18n.tr.

Signature
plugin.language()
Returns
### plugin.language() (API 19) Returns the player language code: "en", "de", "es", "fi", "fr", "it", "ja", "nl", "pt_BR", "pt_PT", "ru", "uk", "vi" or "zh_CN".
Required capability
i18n.tr, ui.list_hold
Capability checks
i18n.tr: required, ui.list_hold: required, ui.menu: conditional/check before using documented feature, ui.text_view_replace: conditional/check before using documented feature, ui.text_view_style: conditional/check before using documented feature
API
API 19

View source

plugin.launch_app

- plugin.launch_app(id [, path]): starts an app, optionally opening a file. Returns true when the launch is accepted, or nil, reason. It only works from a user action of your plugin (a list row or menu tap, a confirmation callback), once per action; the action is used up even when the call returns nil. path is an absolute path under plugin.sd_root() with no ., .. or empty parts, to an existing file with an extension from the app's opens. The app starts after your function returns, and the player asks the user first when the app's program is new or has changed. If the SD card, USB storage, DAC mode, the emulator store or playback prevents the launch, the player shows a message and nothing starts.

Signature
plugin.launch_app(id [, path])
Returns
Returns true when the launch is accepted, or nil, reason. It only works from a user action of your plugin (a list row or menu tap, a confirmation callback), once per action; the action is used up even when the call returns nil. The app starts after your function returns, and the player asks the user first when the app's program is new or has changed.
Required capability
None required.
API
API 19

View source

plugin.led_available

- LEDs depend on the model: check plugin.led_available() instead.

Signature
plugin.led_available()
Returns
Boolean: true when this board has charge-status LEDs.
Required capability
None required.
API
API 19

View source

plugin.led_blink

Blinks. Each phase is clamped to 50 to 60000 ms.

Signature
plugin.led_blink(color, on_ms, off_ms [, level])
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.led_breathe

Pulses. rate up to 600 means breaths per minute; above 600, a period in ms (up to 120000). level is the peak, default 100.

Signature
plugin.led_breathe(color, rate [, level])
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.led_get

{ mode, level }, mode being off, on, blink, breathe or status.

Signature
plugin.led_get(color)
Returns
Table {mode, level}; mode is off, on, blink, breathe, or status; level is 0–100.
Required capability
None required.
API
API 19

View source

plugin.led_release

Gives both LEDs back to the player.

Signature
plugin.led_release()
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.led_set

color is "red" or "blue". true (full), false (off) or a level 0 to 100. Works even when the LED Indicator setting is off.

Signature
plugin.led_set(color, on_or_level)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.led_status

Sets one LED, or both when color is omitted, to show charge status.

Signature
plugin.led_status([color])
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.library_album_cover_async

Generates an album cover thumbnail at one of the supported native sizes.

Signature
plugin.library_album_cover_async(song_id, size_px, callback)
Returns
true when the request is queued; nil and an error string if the queue is busy. The callback receives the generated path, nil; on a cache miss it receives nil, not_generated.
Required capability
library.album_cover
API
API 19

View source

plugin.library_get_albums

- plugin.library_get_albums([offset], [limit], [artist]): album groups, optionally only those whose artist or album artist is artist.

Signature
plugin.library_get_albums([offset], [limit], [artist])
Returns
Array-like table of album groups {name, count, first_song_id, album_artist}.
Required capability
None required.
API
API 19; available since API 15

View source

plugin.library_get_artists

- plugin.library_get_artists([offset], [limit]): artist groups.

Signature
plugin.library_get_artists([offset], [limit])
Returns
Array-like table of artist groups {name, count, first_song_id, album_artist}; album_artist is empty for these groups.
Required capability
None required.
API
API 19

View source

plugin.library_get_song

- plugin.library_get_song(id): one song, or nil if it no longer exists.

Signature
plugin.library_get_song(id)
Returns
Song table {id, path, title, artist, album, album_artist}, or nil if the song ID no longer exists.
Required capability
None required.
API
API 19; available since API 15

View source

plugin.library_get_songs

- plugin.library_get_songs([offset], [limit], [filters]): returns songs, total. filters may contain query (part of the title or artist), artist, album_artist and album (exact matches). total counts all matches, for "page N of M".

Signature
plugin.library_get_songs([offset], [limit], [filters])
Returns
- plugin.library_get_songs([offset], [limit], [filters]): returns songs, total.
Required capability
None required.
API
API 19

View source

plugin.library_search

- plugin.library_search(query, [limit]): songs whose title or artist contains query.

Signature
plugin.library_search(query, [limit])
Returns
Array-like table of matching song rows {id, path, title, artist, album, album_artist}; empty table when there are no matches or the result allocation fails.
Required capability
None required.
API
API 19

View source

plugin.library_song_count

- plugin.library_song_count(): number of songs.

Signature
plugin.library_song_count()
Returns
Integer count of songs currently in the metadata library.
Required capability
None required.
API
API 19

View source

plugin.list_apps

- plugin.list_apps(): the installed apps that run on this board, sorted by name, as { id, name, version, opens } tables. opens is an array of the lower-case file extensions the app opens (empty when none).

Signature
plugin.list_apps()
Returns
One Lua value: table.
Required capability
None required.
API
API 19

View source

plugin.list_dir

- plugin.list_dir(path): the entries of a folder (absolute path), as { name, dir, size, modified } tables (size and modified, in Unix seconds, when available). Hidden entries are skipped, the order isn't sorted, and a missing folder gives an empty table.

Signature
plugin.list_dir(path)
Returns
Array-like table of entries {name, dir, size?, modified?}; hidden names are skipped and a missing/unopenable directory returns an empty table.
Required capability
None required.
API
API 19

View source

plugin.md5
Signature
plugin.md5(text)
Returns
### plugin.md5(text) Returns the MD5 hash of text in lowercase hex, for APIs that sign requests this way (like Last.fm).
Required capability
None required.
API
API 19

View source

plugin.media_capabilities

### plugin.media_capabilities() Describes what the player can play, for streaming plugins choosing a quality:

Signature
plugin.media_capabilities()
Returns
Table with codecs, containers, max_sample_rate, max_bit_depth, max_channels, direct_http_streaming, range_seeking, hls, dash, encryption_modes, and drm_systems.
Required capability
None required.
API
API 19

View source

plugin.mkdir

- plugin.mkdir(path): creates a folder and any missing parents. Returns true, or nil, error. An existing folder is fine.

Signature
plugin.mkdir(path)
Returns
Returns true, or nil, error.
Required capability
None required.
API
API 19

View source

plugin.mseb_apply_state

No API heading or table row was found; native return type is grounded in handler pushes.

Signature
plugin.mseb_apply_state(state)
Returns
Boolean: true when the configuration is accepted; false when the native state setter rejects it. Invalid fields raise a Lua error.
Required capability
None required.
API
API 19

View source

plugin.network_status

### plugin.network_status() (API 18) Returns { connected = bool, wifi_enabled = bool } from the player's cached Wi-Fi state (updated about every 5 seconds with the screen on, about every 45 seconds with it off while a plugin listens for network_changed). Before the first query it reports { connected = false, wifi_enabled = false }, then { false, true } if Wi-Fi is on. It never queries the radio, so it is cheap to call. connected means associated with an access point; it does not prove the internet is reachable. Check plugin.has_capability("network.status") first when you also support older players. Subscribe to the network_changed event instead of polling.

Signature
plugin.network_status()
Returns
### plugin.network_status() (API 18) Returns { connected = bool, wifi_enabled = bool } from the player's cached Wi-Fi state (updated about every 5 seconds with the screen on, about every 45 seconds with it off while a plugin listens for network_changed).
Required capability
filesystem.realpath, network.status
Capability checks
filesystem.realpath: required, network.status: conditional/check before using documented feature, ui.now_playing.set_image: conditional/check before using documented feature, ui.now_playing.set_text: conditional/check before using documented feature
API
API 19; available since API 18

View source

plugin.next_track

Next and previous, respecting shuffle.

Signature
plugin.next_track()
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.now_playing.set_image

### plugin.now_playing.set_image(name, path) / plugin.now_playing.set_text(name, text) Updates a custom named widget in an XML Now Playing layout owned by this plugin. Requires plugin.define() and a layout registered with plugin.set_player_layout(). Check capabilities ui.now_playing.set_image and ui.now_playing.set_text; these are new in API 18.

Signature
plugin.now_playing.set_image(name, path)
Returns
One Lua value: boolean or string.
Required capability
filesystem.realpath, network.status
Capability checks
filesystem.realpath: required, network.status: conditional/check before using documented feature, ui.now_playing.set_image: conditional/check before using documented feature, ui.now_playing.set_text: conditional/check before using documented feature
API
API 19; available since API 18

View source

plugin.now_playing.set_text

### plugin.now_playing.set_image(name, path) / plugin.now_playing.set_text(name, text) Updates a custom named widget in an XML Now Playing layout owned by this plugin. Requires plugin.define() and a layout registered with plugin.set_player_layout(). Check capabilities ui.now_playing.set_image and ui.now_playing.set_text; these are new in API 18.

Signature
plugin.now_playing.set_text(name, text)
Returns
One Lua value: boolean or string.
Required capability
filesystem.realpath, network.status
Capability checks
filesystem.realpath: required, network.status: conditional/check before using documented feature, ui.now_playing.set_image: conditional/check before using documented feature, ui.now_playing.set_text: conditional/check before using documented feature
API
API 19; available since API 18

View source

plugin.on

- [Extending the API (C developers)](#extending-the-api-c-developers)

Signature
plugin.on(index)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.open_file_manager

- plugin.open_file_manager([folder]): opens More > File Manager, at folder when given (an existing folder on the SD card; a path elsewhere raises a Lua error). Returns true, or nil, error when the folder does not exist or the File Manager is already open under another screen.

Signature
plugin.open_file_manager([folder])
Returns
Returns true, or nil, error when the folder does not exist or the File Manager is already open under another screen.
Required capability
None required.
Capability checks
ui.file_manager: check before opening the native file manager
API
API 19

View source

plugin.pick_color

- plugin.pick_color(default, presets, callback): opens the native color picker (the Accent Color picker: saturation/brightness square, hue bar, and a Hex code row that opens the keyboard) and calls callback(color) with the chosen integer 0xRRGGBB when the user taps Done, or callback(nil) if the user backs out or returns Home. The callback runs after the picker leaves the navigation stack. default is the starting color as an integer 0xRRGGBB or a "#RRGGBB" / "RRGGBB" string (nil for white). presets is an array of up to 12 colors in the same forms shown as swatches (nil hides the preset section). An invalid default, an invalid preset or more than 12 presets raises a Lua error. Only one color picker may be pending; another request returns nil, error; a successful open returns true. Plugin unload or UI reload silently cancels a pending callback. Check plugin.has_capability("ui.color_picker").

Signature
plugin.pick_color(default, presets, callback)
Returns
- plugin.pick_color(default, presets, callback): opens the native color picker (the Accent Color picker: saturation/brightness square, hue bar, and a Hex code row that opens the keyboard) and calls callback(color) with the chosen integer 0xRRGGBB when the user taps Done, or callback(nil) if the user backs out or returns Home. Only one color picker may be pending; another request returns nil, error; a successful open returns true.
Required capability
None required.
API
API 19

View source

plugin.pick_file

Opens the SD card browser at a folder, or the SD root when folder is nil. Plugin unload or UI reload cancels the pending callback.

Signature
plugin.pick_file([folder], callback)
Returns
true when the picker opens; nil, error_text if another picker is pending or it cannot open. The callback receives the selected path or nil when cancelled.
Required capability
None required.
Capability checks
ui.file_picker: check before opening the native file picker
API
API 19

View source

plugin.play_file

- plugin.play_file(path [, options]): plays one file (absolute path) or stream URL as a new queue, replacing Up Next like tapping a song does.

Signature
plugin.play_file(path [, options])
Returns
No return value.
Required capability
None required.
Capability checks
playback.stay_on_screen: check before passing options.open_player = false
API
API 19

View source

plugin.play_list

- plugin.play_list(paths [, start_index [, options]]): plays a list of paths or URLs as a new queue, starting at the 1-based start_index (default 1, out-of-range values are clamped). Up to 500 entries.

Signature
plugin.play_list(paths [, start_index [, options]])
Returns
No return value.
Required capability
None required.
Capability checks
playback.stay_on_screen: check before passing options.open_player = false
API
API 19; available since API 15

View source

plugin.play_remote

### plugin.play_remote(track) / plugin.queue_remote_list(tracks [, start_index]) For streaming-service plugins (Qobuz, Tidal and the like): plays one track, or a new queue of up to 500, with full metadata.

Signature
plugin.play_remote(track)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.playlist_add
Signature
plugin.playlist_add(m3u_path, song_path)
Returns
true, or nil, error
Required capability
None required.
API
API 19

View source

plugin.playlist_create
Signature
plugin.playlist_create(name, song_path)
Returns
the new playlist's path (with song_path as its first song), or nil
Required capability
None required.
API
API 19

View source

plugin.playlist_delete
Signature
plugin.playlist_delete(m3u_path)
Returns
whether it was deleted, or nil, error for an invalid path
Required capability
None required.
API
API 19

View source

plugin.playlist_list
Signature
plugin.playlist_list()
Returns
paths of all playlists, or nil if there are none
Required capability
None required.
API
API 19

View source

plugin.playlist_read
Signature
plugin.playlist_read(m3u_path)
Returns
song paths in order, or nil
Required capability
None required.
API
API 19

View source

plugin.playlist_remove
Signature
plugin.playlist_remove(m3u_path, song_path)
Returns
true, or nil, error; removes every copy of the song
Required capability
None required.
API
API 19

View source

plugin.prepare_ab_switch

Prepares a checked local path as the B source for an A–B comparison.

Signature
plugin.prepare_ab_switch(path)
Returns
Boolean indicating whether the comparison source was accepted for preparation.
Required capability
playback.ab_switch
Capability checks
playback.ab_switch: required
API
API 19; available since API 16

View source

plugin.prev_track

Next and previous, respecting shuffle.

Signature
plugin.prev_track()
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.provide_remote_stream

- plugin.provide_remote_stream(request_id, result) accepts stream_url and optional codec (mp3, flac, aac), sample_rate, bit_depth, channels, bitrate_kbps and url_ttl_s. Omitted format fields retain queue values. All descriptive metadata and ReplayGain remain; verify_tls is the queue entry's value (default true). The native table updates under its lock and decoders receive owned copies.

Signature
plugin.provide_remote_stream(request_id, result)
Returns
Boolean indicating whether the remote stream request was accepted/provided.
Required capability
None required.
Capability checks
playback.remote_resolve: requires a registered remote resolver
API
API 19

View source

plugin.queue_remote_list

### plugin.play_remote(track) / plugin.queue_remote_list(tracks [, start_index]) For streaming-service plugins (Qobuz, Tidal and the like): plays one track, or a new queue of up to 500, with full metadata.

Signature
plugin.queue_remote_list(tracks [, start_index])
Returns
No return value.
Required capability
None required.
Capability checks
playback.remote_resolve: check before registering or using a remote resolver
API
API 19

View source

plugin.realpath

### plugin.realpath(path) Returns the canonical absolute filesystem path of an existing file or directory, resolving ., .., and symbolic links. Relative paths resolve against the application's working directory, **not** .plugins/. The result is a plain filesystem path without LVGL's S: prefix.

Signature
plugin.realpath(path)
Returns
### plugin.realpath(path) Returns the canonical absolute filesystem path of an existing file or directory, resolving ., .., and symbolic links.
Required capability
filesystem.realpath, network.status
Capability checks
filesystem.realpath: required, network.status: conditional/check before using documented feature, ui.now_playing.set_image: conditional/check before using documented feature, ui.now_playing.set_text: conditional/check before using documented feature
API
API 19

View source

plugin.refresh_library

### plugin.refresh_library() Rescans the music library, like Settings > Library > Update Music Database, with the same progress screen. Needed after a plugin adds music files, since the library doesn't watch for changes. Returns true, "started", or false, "already_running" or false, "rate_limited" (one scan per minute per plugin). Check library.refresh.

Signature
plugin.refresh_library()
Returns
Returns true, "started", or false, "already_running" or false, "rate_limited" (one scan per minute per plugin).
Required capability
None required.
Capability checks
library.refresh: conditional/check before using documented feature
API
API 19

View source

plugin.refresh_lyrics

### plugin.refresh_lyrics(track_path) API 17, capability playback.lyrics_refresh. After saving lyrics, pass the exact path returned by get_current_track_path(). Returns true when an asynchronous lyrics reload is requested, or false, "track_changed" if another track is current. Playback and position are preserved; a UI reload or track restart is unnecessary. Plugins requiring this behavior should set api_min = 17.

Signature
plugin.refresh_lyrics(track_path)
Returns
After saving lyrics, pass the exact path returned by get_current_track_path(). Returns true when an asynchronous lyrics reload is requested, or false, "track_changed" if another track is current.
Required capability
playback.lyrics_refresh
Capability checks
playback.lyrics_refresh: required
API
API 19; available since API 17

View source

plugin.refresh_theme

### plugin.refresh_theme() Applies icon changes and the Home and launcher layouts, without disturbing anything else: other screens, navigation, playback and connections stay as they are. It runs after your callback returns. Use it after a batch of theme calls.

Signature
plugin.refresh_theme()
Returns
It runs after your callback returns.
Required capability
None required.
API
API 19

View source

plugin.register_home_tile

### plugin.register_home_tile(id, label, on_open, icon) Registers a tile that a Home layout can show (see [set_home_layout](#pluginset_home_layouttiles-options)). Registering alone doesn't show it: it appears once a layout's order lists its id.

Signature
plugin.register_home_tile(id, label, on_open, icon)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.register_list_item

### plugin.register_list_item(list_id, label, on_open [, options]) Adds a row to a native list (see [Where your plugin appears](#where-your-plugin-appears)). on_open() runs when the row is tapped; open your first screen from there.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
No return value.
Required capability
None required.
Capability checks
ui.player_menu: required when list_id is player, ui.more_menu: required when list_id is more
API
API 19

View source

plugin.register_player_action

### plugin.register_player_action(name, callback) Requires plugin.define and capability ui.player_actions. Registers a named click action for XML Player layouts registered by this plugin with plugin.set_player_layout. Names are 1–63 ASCII letters, digits, _, - or .; library and none are reserved. The callback receives the action name and can use the normal UI APIs to open custom menus. Re-registering the same name replaces the callback; the shared registry holds at most 32 actions. Callbacks are removed when their plugin unloads or fails to load.

Signature
plugin.register_player_action(name, callback)
Returns
The callback receives the action name and can use the normal UI APIs to open custom menus.
Required capability
ui.player_actions
Capability checks
ui.player_actions: required with plugin.define before registering an action
API
API 19

View source

plugin.register_quick_toggle

### plugin.register_quick_toggle(id, label, on_change, options) Adds an on/off tile to the quick drawer's expanded area (pull the drawer down, then drag the handle below the first row). Use it for a simple switch; use a list row for anything that needs a screen.

Signature
plugin.register_quick_toggle(id, label, on_change, options)
Returns
No return value.
Required capability
None required.
Capability checks
ui.quick_toggle: check before registering toggles on older builds
API
API 19

View source

plugin.register_stream_media_tile

### plugin.register_stream_media_tile(label, on_open [, icon]) Adds a tile to Stream Media, after Subsonic. Good for streaming and radio plugins. icon is a theme image path, default "stream_media/radio.png". Up to 5 plugin tiles; the grid doesn't scroll.

Signature
plugin.register_stream_media_tile(label, on_open [, icon])
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.reload_ui

### plugin.reload_ui() Rebuilds every screen and restarts all plugins, without restarting the app or interrupting playback and connections. It runs after your callback returns, and the user lands on Home. Call it only in response to a user action, never unconditionally from top-level code (that would reload on every load; a second request during a reload is ignored).

Signature
plugin.reload_ui()
Returns
It runs after your callback returns, and the user lands on Home.
Required capability
None required.
API
API 19

View source

plugin.restore_player_layout

### plugin.restore_player_layout() Requires plugin.define and capability ui.player_layout_restore. Clears only this plugin's session layout selection and returns to the layout saved in Settings. Another plugin's selection is preserved. Returns whether the effective layout ID changed, not whether an override existed. This does not restore global background options or maintain a stack of plugin selections.

Signature
plugin.restore_player_layout()
Returns
Clears only this plugin's session layout selection and returns to the layout saved in Settings. Returns whether the effective layout ID changed, not whether an override existed.
Required capability
ui.player_layout_restore
Capability checks
ui.player_layout_restore: required with plugin.define before restoring layout
API
API 19

View source

plugin.screenshot

### plugin.screenshot() Starts a screenshot. Returns true, or false, reason with one of screen_off, no_card, usb_storage, busy, framebuffer_unavailable, worker_start_failed or unavailable. The screen flashes and a toast confirms it. Files go to <SD card>/Screenshots/. Listen to the screenshot_saved and screenshot_failed events for the result.

Signature
plugin.screenshot()
Returns
Returns true, or false, reason with one of screen_off, no_card, usb_storage, busy, framebuffer_unavailable, worker_start_failed or unavailable.
Required capability
None required.
API
API 19

View source

plugin.sd_root

- plugin.sd_root(): the SD card's path (/data/mnt/sd_0 on the device, ./music on the simulator). Build every path from it so the plugin works in both.

Signature
plugin.sd_root()
Returns
Absolute SD mount path on device; ./music in the simulator.
Required capability
None required.
API
API 19

View source

plugin.secrets.delete

Deletes one key from the calling plugin's private secret namespace.

Signature
plugin.secrets.delete(key)
Returns
Boolean indicating whether the secret was deleted.
Required capability
None required.
API
API 19

View source

plugin.secrets.exists

Checks one key in the calling plugin's private secret namespace.

Signature
plugin.secrets.exists(key)
Returns
Boolean indicating whether the key exists.
Required capability
None required.
API
API 19

View source

plugin.secrets.get

Reads one secret from the calling plugin's private secret namespace.

Signature
plugin.secrets.get(key)
Returns
Stored byte string, or nil when the key is absent.
Required capability
None required.
Capability checks
storage.secrets_get: check when supporting builds predating secret reads
API
API 19

View source

plugin.secrets.set

Writes a length-aware byte string to the calling plugin's private secret namespace.

Signature
plugin.secrets.set(key, value)
Returns
Boolean indicating whether the secret write succeeded.
Required capability
None required.
API
API 19

View source

plugin.seek

Requests a position in the current track. Finite HTTP sources can seek when get_playback_format().seekable is true; live streams remain forward-only.

Signature
plugin.seek(seconds)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.select_ab_source

Selects the active A–B comparison source; source must be the string a or b.

Signature
plugin.select_ab_source(source)
Returns
Boolean indicating whether source A or B was selected; any other source raises a Lua error.
Required capability
playback.ab_switch
Capability checks
playback.ab_switch: required
API
API 19; available since API 16

View source

plugin.set_ab_loop

Sets the native A–B loop points in seconds.

Signature
plugin.set_ab_loop(start_seconds, end_seconds)
Returns
Boolean indicating whether the native A–B loop was accepted.
Required capability
playback.ab_loop
Capability checks
playback.ab_loop: required
API
API 19; available since API 16

View source

plugin.set_background_color

### plugin.set_background_color(slot, rgb) / plugin.set_text_color(slot, rgb) Change colors app-wide, immediately, from anywhere. rgb is 0xRRGGBB.

Signature
plugin.set_background_color(slot, rgb)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.set_crossfade

Sets crossfade enabled state using Lua truthiness.

Signature
plugin.set_crossfade(enabled)
Returns
No return value.
Required capability
playback.settings
Capability checks
playback.settings: required
API
API 19; available since API 16

View source

plugin.set_gapless

Sets gapless playback enabled state using Lua truthiness.

Signature
plugin.set_gapless(enabled)
Returns
No return value.
Required capability
playback.settings
Capability checks
playback.settings: required
API
API 19; available since API 16

View source

plugin.set_home_layout

### plugin.set_home_layout(tiles, options) Restyles Home, chooses which tiles it shows, or turns it into a scrolling list. Takes effect when Home is rebuilt (refresh_theme(), reload_ui() or a restart). Each call replaces the whole previous layout.

Signature
plugin.set_home_layout(tiles, options)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.set_hw_volume_curve

### plugin.set_hw_volume_curve(curve) Replaces how the volume slider maps to the internal DAC, for example to recreate the stock firmware's Low and High Gain modes. curve is a table of exactly 101 integers (volume 0% to 100%), each a raw register value from 0 (loudest) to 255 (quietest). nil restores the built-in curve. It applies immediately but isn't saved, so set it again on every load. It affects only the headphone and line output, not Bluetooth or USB. See the [Gain Mode plugin](https://github.com/Starnished66/compas-plugins/tree/main/plugins/GainMode).

Signature
plugin.set_hw_volume_curve(curve)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.set_icon

### plugin.set_icon(theme_path, source_file) Replaces a built-in icon. theme_path is the icon's path in the theme (for example "launcher/book.png"); source_file is the replacement image, which is copied into the theme override folder. Raises an error if it can't be copied.

Signature
plugin.set_icon(theme_path, source_file)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.set_interval

Schedules the callback on the interface thread every at least one second until cleared.

Signature
plugin.set_interval(seconds, callback)
Returns
Positive integer handle for the timer; exceeding the shared timer limit raises a Lua error.
Required capability
None required.
API
API 19

View source

plugin.set_launcher_layout

### plugin.set_launcher_layout(options) Switches the Music, Stream Media and Wireless menus between their icon grid and a list, independently. Each of music, stream_media and wireless takes mode = "tile" or "list" plus the list styling fields of set_home_layout (row_gap, height, width, bg_color, text_color, radius, align, accessory, text_size, icon). Menus you leave out stay a grid; an empty call resets all three. Apply with refresh_theme().

Signature
plugin.set_launcher_layout(options)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.set_music_layout

No API heading or table row was found; native return type is grounded in handler pushes.

Signature
plugin.set_music_layout(options)
Returns
No return value.
Required capability
None required.
Capability checks
ui.music_layout: check before declaring this layout on older builds
API
API 19

View source

plugin.set_play_mode

playback.settings: sequential, repeat_all, repeat_one, or shuffle. Setters follow native settings persistence.

Signature
plugin.set_play_mode(mode)
Returns
No return value.
Required capability
playback.settings
Capability checks
playback.settings: required
API
API 19; available since API 16

View source

plugin.set_playback_speed
Signature
plugin.set_playback_speed(dir, speed)
Returns
API 16, playback.speed: requests pitch-preserving speed from 0.5 to 2.0 for local tracks beneath an absolute directory. Returns acceptance, not completion of the asynchronous transition. nil, 1.0 resets the scope. Scoped to path components; last call wins, cleared on plugin shutdown.
Required capability
None required.
Capability checks
playback.speed: conditional/check before using documented feature
API
API 19; available since API 16

View source

plugin.set_player_layout

### plugin.set_player_layout(options) Changes the look of the Player (Now Playing) screen. Every field is optional.

Signature
plugin.set_player_layout(options)
Returns
No return value.
Required capability
None required.
Capability checks
ui.player_layout_xml: check before using XML player layouts
API
API 19

View source

plugin.set_quick_drawer_layout

No API heading or table row was found; native return type is grounded in handler pushes.

Signature
plugin.set_quick_drawer_layout(options)
Returns
No return value.
Required capability
None required.
Capability checks
ui.quick_drawer_layout: check before declaring this layout on older builds
API
API 19

View source

plugin.set_quick_toggle

### plugin.set_quick_toggle(id, value) Updates the tile's state without calling on_change. Use it when the plugin changes the setting elsewhere, such as its own settings screen.

Signature
plugin.set_quick_toggle(id, value)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.set_replaygain_mode

Sets ReplayGain mode to off, track, or album.

Signature
plugin.set_replaygain_mode(mode)
Returns
No return value; an unsupported mode raises a Lua error.
Required capability
playback.settings
Capability checks
playback.settings: required
API
API 19; available since API 16

View source

plugin.set_startup_image_async

Selects a prepared startup image or restores the built-in splash when passed nil.

Signature
plugin.set_startup_image_async(prepared_bin_path_or_nil, callback)
Returns
true when the worker starts; nil and an error string if busy or it cannot start. The callback receives true, nil on success or false, reason on failure.
Required capability
ui.startup_image
Capability checks
ui.startup_image: check before selecting or restoring a startup image
API
API 19

View source

plugin.set_text_color

### plugin.set_background_color(slot, rgb) / plugin.set_text_color(slot, rgb) Change colors app-wide, immediately, from anywhere. rgb is 0xRRGGBB.

Signature
plugin.set_text_color(slot, rgb)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.set_transport_skip

Makes Next and Previous skip seconds (1 to 300) within files under dir instead of changing track; 0 turns it off. Applies to every Next/Previous control, not to automatic track changes. Not saved; the last call wins. Check playback.transport_skip.

Signature
plugin.set_transport_skip(dir, seconds)
Returns
No return value.
Required capability
None required.
Capability checks
playback.transport_skip: conditional/check before using documented feature
API
API 19

View source

plugin.set_volume

Sets volume clamped to 0–100. Shows the popup by default; { silent = true } suppresses it (playback.silent_volume). { persist = false } updates live audio/UI without changing remembered volume or saving settings (playback.transient_volume); persistence defaults to true.

Signature
plugin.set_volume(percent, opts)
Returns
No return value.
Required capability
None required.
Capability checks
playback.silent_volume: conditional/check before using documented feature, playback.transient_volume: conditional/check before using documented feature
API
API 19

View source

plugin.show_confirmation

### plugin.show_confirmation(title, confirm_label, on_confirm) Opens a native confirmation popup with the given title, a confirm action, and a Cancel action. on_confirm() runs only after the confirm action is tapped; Cancel, the backdrop, and plugin reload dismiss the popup without calling it. Returns true, false, "confirmation busy" if another confirmation is open, or false, "unable to show confirmation" if the popup cannot be created. Only one confirmation can be open at a time. The pending callback is released when the popup is cancelled or its plugin unloads.

Signature
plugin.show_confirmation(title, confirm_label, on_confirm)
Returns
Returns true, false, "confirmation busy" if another confirmation is open, or false, "unable to show confirmation" if the popup cannot be created.
Required capability
None required.
API
API 19

View source

plugin.show_list
Signature
plugin.show_list(title, items, on_select [, options])
Returns
### plugin.show_list(title, items, on_select [, options]) Opens a list screen and returns a handle (nil on players older than API 14).
Required capability
None required.
API
API 19; available since API 14

View source

plugin.show_lock_screen

### plugin.show_lock_screen(options) Shows a full-screen lock screen over everything, dismissed by swiping up. Returns true, or false, message.

Signature
plugin.show_lock_screen(options)
Returns
Returns true, or false, message.
Required capability
None required.
API
API 19

View source

plugin.show_menu

### plugin.show_menu(title, items, on_select [, options]) Opens a native popup menu, styled like show_confirmation, with one tappable row per item and a Cancel row at the end. API 19, ui.menu.

Signature
plugin.show_menu(title, items, on_select [, options])
Returns
On success, one boolean value; on failure, nil and an error string.
Required capability
ui.list_hold
Capability checks
i18n.tr: conditional/check before using documented feature, ui.list_hold: required, ui.menu: conditional/check before using documented feature, ui.text_view_replace: conditional/check before using documented feature, ui.text_view_style: conditional/check before using documented feature
API
API 19

View source

plugin.show_order_editor

### plugin.show_order_editor(title, items, on_change) Opens the native drag-and-toggle editor for an ordered set of plugin settings. Hold the leading grip to drag an item; use the trailing switch to change its visibility. Each item is { key, label, visible }, where key is a unique stable string and visible is a boolean. The list must contain 1–24 entries.

Signature
plugin.show_order_editor(title, items, on_change)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.show_progress
Signature
plugin.show_progress(title, message [, fraction])
Returns
A new opaque handle, or nil, error if the UI is unavailable.
Required capability
None required.
API
API 19

View source

plugin.show_settings_list

### plugin.show_settings_list(title, items [, options]) Opens a screen that looks like a native Settings submenu, with real switches and sliders. Each item is a table with type and label:

Signature
plugin.show_settings_list(title, items [, options])
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.show_text_input

### plugin.show_text_input(title, initial_text, is_password, on_submit) Opens the app's keypad text entry (the one used for Wi-Fi passwords). on_submit(text) runs when the user presses Enter; it doesn't run if they go back. Returns true, or false, "text input busy" if another request is open. You can open the next input from inside on_submit (for example a username, then a password).

Signature
plugin.show_text_input(title, initial_text, is_password, on_submit)
Returns
Returns true, or false, "text input busy" if another request is open.
Required capability
None required.
API
API 19

View source

plugin.show_text_view

### plugin.show_text_view(title, text [, options]) Opens a paged reader for long text. Returns true, or false, "busy" if one is already open, or false, "unavailable" during a screen transition.

Signature
plugin.show_text_view(title, text [, options])
Returns
Returns true, or false, "busy" if one is already open, or false, "unavailable" during a screen transition.
Required capability
None required.
API
API 19

View source

plugin.show_toast

### plugin.show_toast(message [, duration_ms]) Shows a short message at the bottom of the screen. Duration 100 to 30000 ms, default 5000.

Signature
plugin.show_toast(message [, duration_ms])
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.soundstage_apply_state

No API heading or table row was found; native return type is grounded in handler pushes.

Signature
plugin.soundstage_apply_state(state)
Returns
One Lua value: boolean.
Required capability
None required.
API
API 19

View source

plugin.stop

Stops playback.

Signature
plugin.stop()
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.storage.delete

Deletes one key from the calling plugin's private storage namespace.

Signature
plugin.storage.delete(key)
Returns
Boolean indicating whether the key was deleted.
Required capability
None required.
API
API 19

View source

plugin.storage.get

Reads a value from the calling plugin's private storage namespace. Values are length-aware byte strings.

Signature
plugin.storage.get(key [, default])
Returns
Stored byte string; otherwise the supplied default, or nil when no default is supplied.
Required capability
None required.
API
API 19

View source

plugin.storage.list

Lists keys in the calling plugin's private storage namespace, optionally filtered by prefix.

Signature
plugin.storage.list([prefix])
Returns
Array-like table of matching key strings; a storage failure raises a Lua error.
Required capability
None required.
API
API 19

View source

plugin.storage.set

Writes a length-aware byte string to the calling plugin's private storage namespace.

Signature
plugin.storage.set(key, value)
Returns
true on success; false, error_text if storage rejects the write.
Required capability
None required.
API
API 19

View source

plugin.toggle_pause

Play/pause, like the button (blocked in Bluetooth DAC and AirPlay modes, like the button).

Signature
plugin.toggle_pause()
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin.tr

### plugin.tr(text [, translations]) (API 19) Returns text translated into the player language. Capability i18n.tr. translations is an optional table of translations[code][text] strings, for example { es = { ["Chapters"] = "Capítulos" } }. The lookup order is:

Signature
plugin.tr(text [, translations])
Returns
### plugin.tr(text [, translations]) (API 19) Returns text translated into the player language.
Required capability
i18n.tr, ui.list_hold
Capability checks
i18n.tr: required, ui.list_hold: required, ui.menu: conditional/check before using documented feature, ui.text_view_replace: conditional/check before using documented feature, ui.text_view_style: conditional/check before using documented feature
API
API 19

View source

plugin.update_progress

true if that plugin still owns the visible card; otherwise false.

Signature
plugin.update_progress(handle, message [, fraction])
Returns
Boolean: true if this plugin still owns the visible progress card; false otherwise.
Required capability
None required.
API
API 19

View source

plugin.zip_image_async

Creates a fitted RGB565 thumbnail from an image entry in an archive.

Signature
plugin.zip_image_async(path, entry, dest, max_w, max_h, callback)
Returns
true when the worker starts; nil and an error string if busy or it cannot start. The callback receives dest, nil on success or nil, reason on failure.
Required capability
data.zip_image
API
API 19

View source

plugin.zip_list

Lists archive entry names, including folders.

Signature
plugin.zip_list(path)
Returns
On success, an array-like table of entry names; on failure, nil and a reason string.
Required capability
data.zip
API
API 19

View source

plugin.zip_read

Reads one exact, case-sensitive archive entry. Compressed and uncompressed sizes are limited to 256 KB.

Signature
plugin.zip_read(path, entry)
Returns
On success, bytes and an info table {method, compressed, uncompressed}; on failure, nil and a reason string.
Required capability
data.zip
API
API 19

View source

Capabilities

apps.launch

Check plugin.has_capability("apps.launch") before using this feature.

Required capability
apps.launch
API
API 19
Signature
plugin.has_capability("apps.launch") → boolean

View source

apps.list

Check plugin.has_capability("apps.list") before using this feature.

Required capability
apps.list
API
API 19
Signature
plugin.has_capability("apps.list") → boolean

View source

audio.crossfeed

Check plugin.has_capability("audio.crossfeed") before using this feature.

Required capability
audio.crossfeed
API
API 19
Signature
plugin.has_capability("audio.crossfeed") → boolean

View source

audio.crossfeed.angle

Check plugin.has_capability("audio.crossfeed.angle") before using this feature.

Required capability
audio.crossfeed.angle
API
API 19
Signature
plugin.has_capability("audio.crossfeed.angle") → boolean

View source

audio.hw_volume_curve

Check plugin.has_capability("audio.hw_volume_curve") before using this feature.

Required capability
audio.hw_volume_curve
API
API 19
Signature
plugin.has_capability("audio.hw_volume_curve") → boolean

View source

audio.loop

Check plugin.has_capability("audio.loop") before using this feature.

Required capability
audio.loop
API
API 19
Signature
plugin.has_capability("audio.loop") → boolean

View source

audio.mseb.stock

Check plugin.has_capability("audio.mseb.stock") before using this feature.

Required capability
audio.mseb.stock
API
API 19
Signature
plugin.has_capability("audio.mseb.stock") → boolean

View source

audio.peq

Check plugin.has_capability("audio.peq") before using this feature.

Required capability
audio.peq
API
API 19
Signature
plugin.has_capability("audio.peq") → boolean

View source

audio.peq.state

Check plugin.has_capability("audio.peq.state") before using this feature.

Required capability
audio.peq.state
API
API 19
Signature
plugin.has_capability("audio.peq.state") → boolean

View source

audio.peq.transient

Check plugin.has_capability("audio.peq.transient") before using this feature.

Required capability
audio.peq.transient
API
API 19
Signature
plugin.has_capability("audio.peq.transient") → boolean

View source

audio.soundstage

Check plugin.has_capability("audio.soundstage") before using this feature.

Required capability
audio.soundstage
API
API 19
Signature
plugin.has_capability("audio.soundstage") → boolean

View source

audio.stereo_width

Check plugin.has_capability("audio.stereo_width") before using this feature.

Required capability
audio.stereo_width
API
API 19
Signature
plugin.has_capability("audio.stereo_width") → boolean

View source

crypto.md5

Check plugin.has_capability("crypto.md5") before using this feature.

Required capability
crypto.md5
API
API 19
Signature
plugin.has_capability("crypto.md5") → boolean

View source

data.html

Check plugin.has_capability("data.html") before using this feature.

Required capability
data.html
API
API 19
Signature
plugin.has_capability("data.html") → boolean

View source

data.image_thumbnail

Check plugin.has_capability("data.image_thumbnail") before using this feature.

Required capability
data.image_thumbnail
API
API 19
Signature
plugin.has_capability("data.image_thumbnail") → boolean

View source

data.json

Check plugin.has_capability("data.json") before using this feature.

Required capability
data.json
API
API 19
Signature
plugin.has_capability("data.json") → boolean

View source

data.wallpaper

Check plugin.has_capability("data.wallpaper") before using this feature.

Required capability
data.wallpaper
API
API 19
Signature
plugin.has_capability("data.wallpaper") → boolean

View source

data.zip

Check plugin.has_capability("data.zip") before using this feature.

Required capability
data.zip
API
API 19
Signature
plugin.has_capability("data.zip") → boolean

View source

data.zip_image

Check plugin.has_capability("data.zip_image") before using this feature.

Required capability
data.zip_image
API
API 19
Signature
plugin.has_capability("data.zip_image") → boolean

View source

filesystem.file_ops

Check plugin.has_capability("filesystem.file_ops") before using this feature.

Required capability
filesystem.file_ops
API
API 19
Signature
plugin.has_capability("filesystem.file_ops") → boolean

View source

filesystem.mkdir

Check plugin.has_capability("filesystem.mkdir") before using this feature.

Required capability
filesystem.mkdir
API
API 19
Signature
plugin.has_capability("filesystem.mkdir") → boolean

View source

filesystem.playlists

Check plugin.has_capability("filesystem.playlists") before using this feature.

Required capability
filesystem.playlists
API
API 19
Signature
plugin.has_capability("filesystem.playlists") → boolean

View source

filesystem.realpath

Check plugin.has_capability("filesystem.realpath") before using this feature.

Required capability
filesystem.realpath
API
API 19
Signature
plugin.has_capability("filesystem.realpath") → boolean

View source

filesystem.sd

Check plugin.has_capability("filesystem.sd") before using this feature.

Required capability
filesystem.sd
API
API 19
Signature
plugin.has_capability("filesystem.sd") → boolean

View source

i18n.tr

Check plugin.has_capability("i18n.tr") before using this feature.

Required capability
i18n.tr
API
API 19
Signature
plugin.has_capability("i18n.tr") → boolean

View source

library.album_cover

Check plugin.has_capability("library.album_cover") before using this feature.

Required capability
library.album_cover
API
API 19
Signature
plugin.has_capability("library.album_cover") → boolean

View source

library.artist_albums

Check plugin.has_capability("library.artist_albums") before using this feature.

Required capability
library.artist_albums
API
API 19
Signature
plugin.has_capability("library.artist_albums") → boolean

View source

library.paged

Check plugin.has_capability("library.paged") before using this feature.

Required capability
library.paged
API
API 19
Signature
plugin.has_capability("library.paged") → boolean

View source

library.refresh

Check plugin.has_capability("library.refresh") before using this feature.

Required capability
library.refresh
API
API 19
Signature
plugin.has_capability("library.refresh") → boolean

View source

library.track_metadata

Check plugin.has_capability("library.track_metadata") before using this feature.

Required capability
library.track_metadata
API
API 19
Signature
plugin.has_capability("library.track_metadata") → boolean

View source

network.http.async

Check plugin.has_capability("network.http.async") before using this feature.

Required capability
network.http.async
API
API 19
Signature
plugin.has_capability("network.http.async") → boolean

View source

network.http.download

Check plugin.has_capability("network.http.download") before using this feature.

Required capability
network.http.download
API
API 19
Signature
plugin.has_capability("network.http.download") → boolean

View source

network.http.download_progress

Check plugin.has_capability("network.http.download_progress") before using this feature.

Required capability
network.http.download_progress
API
API 19
Signature
plugin.has_capability("network.http.download_progress") → boolean

View source

network.http.sync

Check plugin.has_capability("network.http.sync") before using this feature.

Required capability
network.http.sync
API
API 19
Signature
plugin.has_capability("network.http.sync") → boolean

View source

network.status

Check plugin.has_capability("network.status") before using this feature.

Required capability
network.status
API
API 19
Signature
plugin.has_capability("network.status") → boolean

View source

playback.ab_loop

Check plugin.has_capability("playback.ab_loop") before using this feature.

Required capability
playback.ab_loop
API
API 19
Signature
plugin.has_capability("playback.ab_loop") → boolean

View source

playback.ab_switch

Check plugin.has_capability("playback.ab_switch") before using this feature.

Required capability
playback.ab_switch
API
API 19
Signature
plugin.has_capability("playback.ab_switch") → boolean

View source

playback.control

Check plugin.has_capability("playback.control") before using this feature.

Required capability
playback.control
API
API 19
Signature
plugin.has_capability("playback.control") → boolean

View source

playback.events

Check plugin.has_capability("playback.events") before using this feature.

Required capability
playback.events
API
API 19
Signature
plugin.has_capability("playback.events") → boolean

View source

playback.format

Check plugin.has_capability("playback.format") before using this feature.

Required capability
playback.format
API
API 19
Signature
plugin.has_capability("playback.format") → boolean

View source

playback.http_seek

Check plugin.has_capability("playback.http_seek") before using this feature.

Required capability
playback.http_seek
API
API 19
Signature
plugin.has_capability("playback.http_seek") → boolean

View source

playback.lyrics_refresh

Check plugin.has_capability("playback.lyrics_refresh") before using this feature.

Required capability
playback.lyrics_refresh
API
API 19
Signature
plugin.has_capability("playback.lyrics_refresh") → boolean

View source

playback.output_events

Check plugin.has_capability("playback.output_events") before using this feature.

Required capability
playback.output_events
API
API 19
Signature
plugin.has_capability("playback.output_events") → boolean

View source

playback.output_info

Check plugin.has_capability("playback.output_info") before using this feature.

Required capability
playback.output_info
API
API 19
Signature
plugin.has_capability("playback.output_info") → boolean

View source

playback.progress

Check plugin.has_capability("playback.progress") before using this feature.

Required capability
playback.progress
API
API 19
Signature
plugin.has_capability("playback.progress") → boolean

View source

playback.remote

Check plugin.has_capability("playback.remote") before using this feature.

Required capability
playback.remote
API
API 19
Signature
plugin.has_capability("playback.remote") → boolean

View source

playback.remote_resolve

Check plugin.has_capability("playback.remote_resolve") before using this feature.

Required capability
playback.remote_resolve
API
API 19
Signature
plugin.has_capability("playback.remote_resolve") → boolean

View source

playback.settings

Check plugin.has_capability("playback.settings") before using this feature.

Required capability
playback.settings
API
API 19
Signature
plugin.has_capability("playback.settings") → boolean

View source

playback.silent_volume

Check plugin.has_capability("playback.silent_volume") before using this feature.

Required capability
playback.silent_volume
API
API 19
Signature
plugin.has_capability("playback.silent_volume") → boolean

View source

playback.speed

Check plugin.has_capability("playback.speed") before using this feature.

Required capability
playback.speed
API
API 19
Signature
plugin.has_capability("playback.speed") → boolean

View source

playback.state

Check plugin.has_capability("playback.state") before using this feature.

Required capability
playback.state
API
API 19
Signature
plugin.has_capability("playback.state") → boolean

View source

playback.stay_on_screen

Check plugin.has_capability("playback.stay_on_screen") before using this feature.

Required capability
playback.stay_on_screen
API
API 19
Signature
plugin.has_capability("playback.stay_on_screen") → boolean

View source

playback.transient_volume

Check plugin.has_capability("playback.transient_volume") before using this feature.

Required capability
playback.transient_volume
API
API 19
Signature
plugin.has_capability("playback.transient_volume") → boolean

View source

playback.transport_skip

Check plugin.has_capability("playback.transport_skip") before using this feature.

Required capability
playback.transport_skip
API
API 19
Signature
plugin.has_capability("playback.transport_skip") → boolean

View source

storage.namespaced

Check plugin.has_capability("storage.namespaced") before using this feature.

Required capability
storage.namespaced
API
API 19
Signature
plugin.has_capability("storage.namespaced") → boolean

View source

storage.secrets

Check plugin.has_capability("storage.secrets") before using this feature.

Required capability
storage.secrets
API
API 19
Signature
plugin.has_capability("storage.secrets") → boolean

View source

storage.secrets_get

Check plugin.has_capability("storage.secrets_get") before using this feature.

Required capability
storage.secrets_get
API
API 19
Signature
plugin.has_capability("storage.secrets_get") → boolean

View source

ui.breeze_stream_icons

Check plugin.has_capability("ui.breeze_stream_icons") before using this feature.

Required capability
ui.breeze_stream_icons
API
API 19
Signature
plugin.has_capability("ui.breeze_stream_icons") → boolean

View source

ui.button_lock

Check plugin.has_capability("ui.button_lock") before using this feature.

Required capability
ui.button_lock
API
API 19
Signature
plugin.has_capability("ui.button_lock") → boolean

View source

ui.color_picker

Check plugin.has_capability("ui.color_picker") before using this feature.

Required capability
ui.color_picker
API
API 19
Signature
plugin.has_capability("ui.color_picker") → boolean

View source

ui.confirmation

Check plugin.has_capability("ui.confirmation") before using this feature.

Required capability
ui.confirmation
API
API 19
Signature
plugin.has_capability("ui.confirmation") → boolean

View source

ui.file_manager

Check plugin.has_capability("ui.file_manager") before using this feature.

Required capability
ui.file_manager
API
API 19
Signature
plugin.has_capability("ui.file_manager") → boolean

View source

ui.file_picker

Check plugin.has_capability("ui.file_picker") before using this feature.

Required capability
ui.file_picker
API
API 19
Signature
plugin.has_capability("ui.file_picker") → boolean

View source

ui.home_background

Check plugin.has_capability("ui.home_background") before using this feature.

Required capability
ui.home_background
API
API 19
Signature
plugin.has_capability("ui.home_background") → boolean

View source

ui.home_layout

Check plugin.has_capability("ui.home_layout") before using this feature.

Required capability
ui.home_layout
API
API 19
Signature
plugin.has_capability("ui.home_layout") → boolean

View source

ui.home_tiles

Check plugin.has_capability("ui.home_tiles") before using this feature.

Required capability
ui.home_tiles
API
API 19
Signature
plugin.has_capability("ui.home_tiles") → boolean

View source

ui.launcher_layout

Check plugin.has_capability("ui.launcher_layout") before using this feature.

Required capability
ui.launcher_layout
API
API 19
Signature
plugin.has_capability("ui.launcher_layout") → boolean

View source

ui.list

Check plugin.has_capability("ui.list") before using this feature.

Required capability
ui.list
API
API 19
Signature
plugin.has_capability("ui.list") → boolean

View source

ui.list_grid

Check plugin.has_capability("ui.list_grid") before using this feature.

Required capability
ui.list_grid
API
API 19
Signature
plugin.has_capability("ui.list_grid") → boolean

View source

ui.list_hold

Check plugin.has_capability("ui.list_hold") before using this feature.

Required capability
ui.list_hold
API
API 19
Signature
plugin.has_capability("ui.list_hold") → boolean

View source

ui.list_scroll_reset

Check plugin.has_capability("ui.list_scroll_reset") before using this feature.

Required capability
ui.list_scroll_reset
API
API 19
Signature
plugin.has_capability("ui.list_scroll_reset") → boolean

View source

ui.list_showing

Check plugin.has_capability("ui.list_showing") before using this feature.

Required capability
ui.list_showing
API
API 19
Signature
plugin.has_capability("ui.list_showing") → boolean

View source

ui.list_update

Check plugin.has_capability("ui.list_update") before using this feature.

Required capability
ui.list_update
API
API 19
Signature
plugin.has_capability("ui.list_update") → boolean

View source

ui.list_wrap

Check plugin.has_capability("ui.list_wrap") before using this feature.

Required capability
ui.list_wrap
API
API 19
Signature
plugin.has_capability("ui.list_wrap") → boolean

View source

ui.lock_screen

Check plugin.has_capability("ui.lock_screen") before using this feature.

Required capability
ui.lock_screen
API
API 19
Signature
plugin.has_capability("ui.lock_screen") → boolean

View source

ui.menu

Check plugin.has_capability("ui.menu") before using this feature.

Required capability
ui.menu
API
API 19
Signature
plugin.has_capability("ui.menu") → boolean

View source

ui.more_menu

Check plugin.has_capability("ui.more_menu") before using this feature.

Required capability
ui.more_menu
API
API 19
Signature
plugin.has_capability("ui.more_menu") → boolean

View source

ui.music_layout

Check plugin.has_capability("ui.music_layout") before using this feature.

Required capability
ui.music_layout
API
API 19
Signature
plugin.has_capability("ui.music_layout") → boolean

View source

ui.now_playing.set_image

Check plugin.has_capability("ui.now_playing.set_image") before using this feature.

Required capability
ui.now_playing.set_image
API
API 19
Signature
plugin.has_capability("ui.now_playing.set_image") → boolean

View source

ui.now_playing.set_text

Check plugin.has_capability("ui.now_playing.set_text") before using this feature.

Required capability
ui.now_playing.set_text
API
API 19
Signature
plugin.has_capability("ui.now_playing.set_text") → boolean

View source

ui.order_editor

Check plugin.has_capability("ui.order_editor") before using this feature.

Required capability
ui.order_editor
API
API 19
Signature
plugin.has_capability("ui.order_editor") → boolean

View source

ui.player_actions

Check plugin.has_capability("ui.player_actions") before using this feature.

Required capability
ui.player_actions
API
API 19
Signature
plugin.has_capability("ui.player_actions") → boolean

View source

ui.player_layout_restore

Check plugin.has_capability("ui.player_layout_restore") before using this feature.

Required capability
ui.player_layout_restore
API
API 19
Signature
plugin.has_capability("ui.player_layout_restore") → boolean

View source

ui.player_layout_xml

Check plugin.has_capability("ui.player_layout_xml") before using this feature.

Required capability
ui.player_layout_xml
API
API 19
Signature
plugin.has_capability("ui.player_layout_xml") → boolean

View source

ui.player_menu

Check plugin.has_capability("ui.player_menu") before using this feature.

Required capability
ui.player_menu
API
API 19
Signature
plugin.has_capability("ui.player_menu") → boolean

View source

ui.progress

Check plugin.has_capability("ui.progress") before using this feature.

Required capability
ui.progress
API
API 19
Signature
plugin.has_capability("ui.progress") → boolean

View source

ui.quick_drawer_layout

Check plugin.has_capability("ui.quick_drawer_layout") before using this feature.

Required capability
ui.quick_drawer_layout
API
API 19
Signature
plugin.has_capability("ui.quick_drawer_layout") → boolean

View source

ui.quick_toggle

Check plugin.has_capability("ui.quick_toggle") before using this feature.

Required capability
ui.quick_toggle
API
API 19
Signature
plugin.has_capability("ui.quick_toggle") → boolean

View source

ui.reload

Check plugin.has_capability("ui.reload") before using this feature.

Required capability
ui.reload
API
API 19
Signature
plugin.has_capability("ui.reload") → boolean

View source

ui.row_width

Check plugin.has_capability("ui.row_width") before using this feature.

Required capability
ui.row_width
API
API 19
Signature
plugin.has_capability("ui.row_width") → boolean

View source

ui.screenshot

Check plugin.has_capability("ui.screenshot") before using this feature.

Required capability
ui.screenshot
API
API 19
Signature
plugin.has_capability("ui.screenshot") → boolean

View source

ui.settings

Check plugin.has_capability("ui.settings") before using this feature.

Required capability
ui.settings
API
API 19
Signature
plugin.has_capability("ui.settings") → boolean

View source

ui.settings_dashboard

Check plugin.has_capability("ui.settings_dashboard") before using this feature.

Required capability
ui.settings_dashboard
API
API 19
Signature
plugin.has_capability("ui.settings_dashboard") → boolean

View source

ui.settings_list_10_sliders

Check plugin.has_capability("ui.settings_list_10_sliders") before using this feature.

Required capability
ui.settings_list_10_sliders
API
API 19
Signature
plugin.has_capability("ui.settings_list_10_sliders") → boolean

View source

ui.settings_list_wrap

Check plugin.has_capability("ui.settings_list_wrap") before using this feature.

Required capability
ui.settings_list_wrap
API
API 19
Signature
plugin.has_capability("ui.settings_list_wrap") → boolean

View source

ui.startup_image

Check plugin.has_capability("ui.startup_image") before using this feature.

Required capability
ui.startup_image
API
API 19
Signature
plugin.has_capability("ui.startup_image") → boolean

View source

ui.text_input

Check plugin.has_capability("ui.text_input") before using this feature.

Required capability
ui.text_input
API
API 19
Signature
plugin.has_capability("ui.text_input") → boolean

View source

ui.text_view

Check plugin.has_capability("ui.text_view") before using this feature.

Required capability
ui.text_view
API
API 19
Signature
plugin.has_capability("ui.text_view") → boolean

View source

ui.text_view_images

Check plugin.has_capability("ui.text_view_images") before using this feature.

Required capability
ui.text_view_images
API
API 19
Signature
plugin.has_capability("ui.text_view_images") → boolean

View source

ui.text_view_replace

Check plugin.has_capability("ui.text_view_replace") before using this feature.

Required capability
ui.text_view_replace
API
API 19
Signature
plugin.has_capability("ui.text_view_replace") → boolean

View source

ui.text_view_style

Check plugin.has_capability("ui.text_view_style") before using this feature.

Required capability
ui.text_view_style
API
API 19
Signature
plugin.has_capability("ui.text_view_style") → boolean

View source

ui.theme

Check plugin.has_capability("ui.theme") before using this feature.

Required capability
ui.theme
API
API 19
Signature
plugin.has_capability("ui.theme") → boolean

View source

ui.theme_refresh

Check plugin.has_capability("ui.theme_refresh") before using this feature.

Required capability
ui.theme_refresh
API
API 19
Signature
plugin.has_capability("ui.theme_refresh") → boolean

View source

ui.toast

Check plugin.has_capability("ui.toast") before using this feature.

Required capability
ui.toast
API
API 19
Signature
plugin.has_capability("ui.toast") → boolean

View source

Events

battery_changed

Register a callback with plugin.on("battery_changed", callback). Its arguments are listed below.

Signature
plugin.on('battery_changed', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
info table {level, charging, full, external_power}
Required capability
None required.
API
API 19

View source

button_lock_changed

Register a callback with plugin.on("button_lock_changed", callback). Its arguments are listed below.

Signature
plugin.on('button_lock_changed', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
locked
Required capability
None required.
API
API 19

View source

network_changed

Register a callback with plugin.on("network_changed", callback). Its arguments are listed below.

Signature
plugin.on('network_changed', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
none
Required capability
None required.
API
API 19

View source

output_changed

Register a callback with plugin.on("output_changed", callback). Its arguments are listed below.

Signature
plugin.on('output_changed', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
current_snapshot {route, requested_route, active, bluetooth_connected, bluetooth_codec, headphone_state}; previous_snapshot with same fields
Required capability
None required.
API
API 19

View source

paused

Register a callback with plugin.on("paused", callback). Its arguments are listed below.

Signature
plugin.on('paused', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
none
Required capability
None required.
API
API 19

View source

queue_exhausted

Register a callback with plugin.on("queue_exhausted", callback). Its arguments are listed below.

Signature
plugin.on('queue_exhausted', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
direction
Required capability
None required.
API
API 19

View source

remote_stream_needed

Register a callback with plugin.on("remote_stream_needed", callback). Its arguments are listed below.

Signature
plugin.on('remote_stream_needed', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
provider, track_id, request_id
Required capability
None required.
API
API 19

View source

resumed

Register a callback with plugin.on("resumed", callback). Its arguments are listed below.

Signature
plugin.on('resumed', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
none
Required capability
None required.
API
API 19

View source

screen_woke

Register a callback with plugin.on("screen_woke", callback). Its arguments are listed below.

Signature
plugin.on('screen_woke', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
none
Required capability
None required.
API
API 19

View source

screenshot_failed

Register a callback with plugin.on("screenshot_failed", callback). Its arguments are listed below.

Signature
plugin.on('screenshot_failed', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
reason
Required capability
None required.
API
API 19

View source

screenshot_saved

Register a callback with plugin.on("screenshot_saved", callback). Its arguments are listed below.

Signature
plugin.on('screenshot_saved', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
path
Required capability
None required.
API
API 19

View source

stopped

Register a callback with plugin.on("stopped", callback). Its arguments are listed below.

Signature
plugin.on('stopped', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
none
Required capability
None required.
API
API 19

View source

suspending

Register a callback with plugin.on("suspending", callback). Its arguments are listed below.

Signature
plugin.on('suspending', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
none
Required capability
None required.
API
API 19

View source

system_resumed

Register a callback with plugin.on("system_resumed", callback). Its arguments are listed below.

Signature
plugin.on('system_resumed', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
none
Required capability
None required.
API
API 19

View source

track_started

Register a callback with plugin.on("track_started", callback). Its arguments are listed below.

Signature
plugin.on('track_started', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
title, artist, album, duration_seconds, provider, track_id
Required capability
None required.
API
API 19

View source

volume_changed

Register a callback with plugin.on("volume_changed", callback). Its arguments are listed below.

Signature
plugin.on('volume_changed', callback)
Returns
plugin.on returns no return value; callback return values are ignored
Callback arguments
percent
Required capability
None required.
API
API 19

View source

Menus you can add to

books

Use this list ID with plugin.register_list_item() to add a row to books list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

display

Use this list ID with plugin.register_list_item() to add a row to display list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

more

Use this list ID with plugin.register_list_item() to add a row to more list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

music

Use this list ID with plugin.register_list_item() to add a row to music list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

music_audio

Use this list ID with plugin.register_list_item() to add a row to music_audio list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

music_controls

Use this list ID with plugin.register_list_item() to add a row to music_controls list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

music_library

Use this list ID with plugin.register_list_item() to add a row to music_library list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

music_timers

Use this list ID with plugin.register_list_item() to add a row to music_timers list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

playback

Use this list ID with plugin.register_list_item() to add a row to playback list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

player

Use this list ID with plugin.register_list_item() to add a row to player menu item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

power

Use this list ID with plugin.register_list_item() to add a row to power list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

settings

Use this list ID with plugin.register_list_item() to add a row to settings list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

system

Use this list ID with plugin.register_list_item() to add a row to system list item.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
Not applicable to list ID descriptor
Required capability
None required.
API
API 19

View source

Ways to open your plugin

home_tile

Registers a plugin tile on the home screen.

Signature
plugin.register_home_tile(id, label, on_open, icon)
Returns
No return value.
Required capability
None required.
API
API 19

View source

music_layout

Sets the owner-scoped Music screen layout.

Signature
plugin.set_music_layout(options)
Returns
No return value.
Required capability
None required.
API
API 19

View source

player_action

Registers a player-layout action.

Signature
plugin.register_player_action(name, callback)
Returns
The callback receives the action name and can use the normal UI APIs to open custom menus.
Required capability
ui.player_actions
API
API 19

View source

player_layout

Sets the player screen layout.

Signature
plugin.set_player_layout(options)
Returns
No return value.
Required capability
None required.
API
API 19

View source

plugin_list_item

Registers a named item on one of the native list targets.

Signature
plugin.register_list_item(list_id, label, on_open [, options])
Returns
No return value.
Required capability
None required.
API
API 19

View source

quick_drawer_layout

Sets the owner-scoped quick drawer layout.

Signature
plugin.set_quick_drawer_layout(options)
Returns
No return value.
Required capability
None required.
API
API 19

View source

quick_toggle

Registers and updates a quick drawer toggle.

Signature
plugin.register_quick_toggle(id, label, on_change, options)
Returns
No return value.
Required capability
None required.
API
API 19

View source

stream_media_tile

Registers a tile in the stream media surface.

Signature
plugin.register_stream_media_tile(label, on_open [, icon])
Returns
No return value.
Required capability
None required.
API
API 19

View source

track_metadata

Reads cached metadata for a validated local song path.

Signature
plugin.get_track_metadata(path)
Returns
Metadata table with id, path, title, artist, album, album_artist, and genre; nil for an invalid path or cache miss.
Required capability
library.track_metadata
API
API 19; available since API 16

View source