DocumentationEnterDownload AudionEnterFeatures & SpecsEnterGithub RepositoryEnter

Build an Audion plugin.

Reference guide for creating, testing, and publishing Audion plugins and visual skins. JavaScript or WebAssembly, permission-gated APIs, and one-click installation.

Prerequisites

Before developing a plugin, make sure you have the basics ready:

  • Audion installed and running (version 1.2.0 or newer).
  • JavaScript (ES6+) or WebAssembly knowledge.
  • A code editor (e.g. Visual Studio Code, Zed, or Neovim).
  • Git for version control and registry publishing.
Single-file entry for marketplace installs: No build pipeline is required for simple plugins, but if you use multiple source modules, bundle them into a single entry file (e.g. index.js). Audion's installer fetches only plugin.json, entry, and a relative icon from raw GitHub.

Plugin Manifest: plugin.json

Every plugin begins with a plugin.json manifest file placed at the root of the plugin directory. This file declares identity, entry file, optional integrity hashes, and runtime permission scopes.

Required Manifest Fields

FieldTypeDescription
namestringHuman-readable plugin name (e.g. "Last.fm Scrobbler").
versionstringSemantic version string (e.g. "1.0.0").
authorstringDeveloper or organization name.
typestringMust be "js" or "wasm".
entrystringRelative path to the entry file (e.g. "index.js" or "index.wasm").
permissionsstring[]Array of declared permission scopes (e.g. ["player:read", "network:fetch"]).

Optional Manifest Fields

FieldTypeDescription
safe_namestringKebab-case identifier and folder name. Generated from name if omitted.
descriptionstringShort summary displayed on marketplace cards.
categorystringCanonical: streaming, metadata, lyrics, library, integration, appearance, utility (aliases: audio, ui, theme, social, sync, tool).
tagsstring[]Searchable keyword tags.
providesstring[]Provider roles: "stream", "metadata", and/or "lyrics".
ui_slotsstring[]Declared UI slot names the plugin injects into.
cross_plugin_accessobject[]Array of { plugin, methods[] } entries for api.request().
icon / icon_urlstringRelative path to a local icon (e.g. "icon.png") or remote icon URL.
repo / manifest_urlstringPublic GitHub repository URL and optional direct plugin.json URL.
homepage / licensestringProject homepage URL and SPDX license identifier (e.g. "MIT").
min_versionstringMinimum supported Audion version (e.g. "1.2.0").
sha256 / integritystringSHA-256 hash of entry bytes, verified by Audion on install and update.

Sample plugin.json

json
{
  "name": "Play Counter",
  "safe_name": "play-counter",
  "version": "1.0.0",
  "author": "Audion Contributors",
  "description": "Records playback frequency and total listening time per track",
  "type": "js",
  "entry": "index.js",
  "category": "utility",
  "tags": [
    "stats",
    "history"
  ],
  "permissions": [
    "player:read",
    "storage:local"
  ],
  "license": "MIT",
  "repo": "https://github.com/dupitydumb/audion-plugins"
}

Directory Structure

Audion plugins use a flat folder structure named in kebab-case:

plaintext
your-plugin-name/
├── plugin.json       # Manifest file (required)
├── index.js          # Single bundled entry file (required)
├── icon.png          # Optional relative icon
└── README.md         # Optional documentation

JavaScript Entry Pattern

Register your plugin using Audion.register(plugin) inside an IIFE with 'use strict'. CommonJS module.exports and window.AudionPlugin are supported as fallbacks.

javascript
(function () {
    'use strict';

    const PlayCounterPlugin = {
        name: 'Play Counter',
        api: null,
        onTrackChange: null,

        init(api) {
            this.api = api;
            this.onTrackChange = async ({ track }) => {
                if (!track) return;
                const key = 'count:' + track.id;
                const current = (await this.api.storage.get(key)) || 0;
                await this.api.storage.set(key, current + 1);
            };
        },

        start() {
            this.api.on('trackChange', this.onTrackChange);
        },

        stop() {
            this.api.off('trackChange', this.onTrackChange);
        },

        destroy() {
            if (this.api && this.onTrackChange) {
                this.api.off('trackChange', this.onTrackChange);
            }
            this.api = null;
        }
    };

    if (typeof Audion !== 'undefined' && Audion.register) {
        Audion.register(PlayCounterPlugin);
    } else if (typeof module !== 'undefined' && module.exports) {
        module.exports = PlayCounterPlugin;
    } else {
        window.AudionPlugin = PlayCounterPlugin;
    }
})();

Lifecycle Hooks & Events

Audion executes lifecycle methods on your plugin object sequentially as states change:

01

Discovery

Audion scans the local plugins directory for valid plugin.json manifest files.

02

Loading

The JS or WASM entry file is loaded into an isolated plugin scope.

03

init(api)

Audion passes the permission-gated PluginAPI instance to your plugin. Store the reference and initialize state.

04

start()

Fires when the user enables your plugin in Settings. Register slots, providers, and active timers.

05

stop()

Fires when the user disables your plugin. Pause polling, background fetch routines, or visualizers.

06

destroy()

Fires when the plugin is unloaded or removed. Unsubscribe event listeners with api.off(), unregister slots/providers, and clear timers.

Event Emitter (api.on / api.off / api.once)

Event listeners are always available without extra permissions. Supported events are trackChange, playStateChange, timeUpdate, queueChange, seeked, and queueExhausted (exceeding 10 listeners on one event triggers a leak warning).

Resource cleanup in destroy(): Always remove event listeners with api.off(), unregister UI slots/providers, and clear interval timers when destroy() is invoked.

Available Permissions

Permissions gate runtime APIs in Audion. Request only the scopes your plugin needs:

ScopeEnforcementDescription & APIs
player:readEnforcedSynchronous state: getCurrentTrack(), isPlaying(), getCurrentTime(), getDuration(), getQueue().
player:controlEnforcedplay(), pause(), seek(), next(), prev(), setTrack(), playQueue(), queue mutations, and api.stream.
library:readEnforcedQuery library tracks and playlists: getTracks(), getPlaylists().
library:writeEnforceddownloadTrack(), addExternalTrack(), likeTrack(), unlikeTrack(), removeTrack(), deleteTrack(), refresh(), playlist/cover updates.
storage:localEnforcedAsync api.storage.get() / set() (5 MB quota, 50 writes/min) and unlocks api.settings.
settings:writeEnforcedModify app settings via api.settings.setDownloadLocation() (storage:local also grants access).
network:fetchEnforcedCORS-free Rust-proxied api.fetch(url, init) and api.fetchBlob(url, init).
ui:injectEnforcedapi.ui.registerSlot(slotName, element, priority) and unregisterSlot(slotName).
lyrics:read / lyrics:write / system:notifyDeclared-onlyManifest declarations documenting intent; api.lyrics is always available at runtime.

Storage, Settings & Network APIs

api.storage is asynchronous and sandboxed per plugin (5 MB quota, 50 writes/minute). Network requests via api.fetch and api.fetchBlob are proxied through Rust so they bypass browser CORS restrictions.

javascript
// Storage (requires storage:local)
await this.api.storage.set('scrobbleEnabled', true);
const isEnabled = (await this.api.storage.get('scrobbleEnabled')) ?? false;

// Settings (requires storage:local or settings:write)
this.api.settings.setDownloadLocation('/path/to/downloads');

// CORS-free Network (requires network:fetch)
const res = await this.api.fetch('https://api.example.com/tracks');
if (res.ok) {
    const json = await res.json();
}
const blobUrl = await this.api.fetchBlob('https://example.com/cover.jpg');

Providers & Always-Available APIs

Plugins can register providers to extend playback, metadata, lyrics, search, and cover art:

  • Stream Provider (api.stream, requires player:control): registerProvider(), unregisterProvider(), registerResolver(sourceType, fn), unregisterResolver(sourceType), and resolveStream().
  • Metadata Provider (api.metadata, always available): registerProvider(), unregisterProvider(), and search().
  • Lyrics (api.lyrics, always available): registerProvider(), unregisterProvider(), fetchLyrics(), getCurrentTrackLyrics(), getCurrentTrackActiveLyric(), getLyrics(musicPath), and getCurrentLyric(musicPath, currentTime).
  • Search & Covers (api.search, api.covers, always available): registerSource(), unregisterSource(), and query().
  • Theme & Discord RPC (always available): api.theme.refresh() and api.discord (connect, updatePresence, clearPresence, disconnect, reconnect, resolveCover).
  • Inter-Plugin IPC: api.handleRequest(method, handler) and api.request(method, params), gated by cross_plugin_access in plugin.json.

UI Injection

Plugins with ui:inject can register DOM elements into Shadow DOM-isolated application slots (with Audion CSS theme variables forwarded). Available slots: playerbar:left, playerbar:right, playerbar:menu (auto-mirrors to mobile:home), sidebar:top, sidebar:bottom, mobile:home, and mobile:bottomnav.

javascript
const badge = document.createElement('button');
badge.textContent = 'Plugin Action';

// Lower priority renders first (default: 50)
this.api.ui.registerSlot('playerbar:menu', badge, 10);

// Clean up in stop() or destroy()
this.api.ui.unregisterSlot('playerbar:menu');

Testing Locally

Copy your plugin folder directly into your local Audion plugins directory:

  • Windows: %APPDATA%\Audion\plugins\your-plugin-name
  • macOS: ~/Library/Application Support/Audion/plugins/your-plugin-name
  • Linux: ~/.config/Audion/plugins/your-plugin-name

Open Audion Settings > Plugins, click Refresh, and toggle your plugin on. Press Ctrl+Shift+I (or Cmd+Option+I on macOS) to inspect runtime logs in DevTools.


Publishing to the Registry

The Audion marketplace indexes community plugins into dupitydumb/audion-plugins (registry/main/registry.json) every 6 hours or via a plugin-released dispatch:

  1. Host your plugin in a public GitHub repository with plugin.json at the root of the default branch.
  2. Bundle your JavaScript into a single entry file — Audion's installer fetches only plugin.json, entry, and a relative icon from raw GitHub.
  3. Add the topic audion-plugins in your GitHub repository Settings.
  4. Use a registry-accepted category (audio, ui, lyrics, library, utility, appearance, social, sync, or metadata) to avoid indexer warnings; Audion normalizes aliases like audio to streaming.

Deep Link Distribution

Share one-click installation links using the registered audion:// desktop protocol:

plaintext
audion://install-plugin?url=https://github.com/your-username/your-plugin

Audion prompts the user for confirmation, downloads plugin.json, entry, and any relative icon, verifies optional sha256/integrity hashes, and registers the plugin.


Audion Skins (.audionskin v2 & Folder Skins)

Audion supports local visual themes via standalone .audionskin v2 JSON files or modular skin folders (skin.ini, user.css, effect.js). Skins are local-only and are not indexed in the plugin registry.

  • .audionskin v2 JSON: Requires version (1 or 2), name, accentColor (6/8-digit hex), and mode (dark | light | system). Supports 10 customColors keys (6/8-digit hex only), background (none | color | gradient; image/video are downgraded to none), animation, schemes, customCss (<style id="audion-skin-css"> with --skin-* variables), and customJs.
  • customJs / effect.js: Runs on #audion-effect-layer as new Function('canvas', 'ctx', 'accent', js), must return a cleanup function, and only executes when allowCustomJs is enabled.
  • Folder skins: Place skin.ini ([Metadata], [Theme], [Skin], [Setting] + scheme sections), user.css, and effect.js in a local skin folder. Folder skins override standalone .audionskin files of the same name.
json
{
  "version": 2,
  "name": "Midnight Neon",
  "author": "Your Name",
  "mode": "dark",
  "accentColor": "#00e5ff",
  "customColors": {
    "bgBase": "#0b0d12",
    "bgElevated": "#121620",
    "bgSurface": "#181d2a",
    "bgHighlight": "#22293a",
    "textPrimary": "#f2f5f9",
    "textSecondary": "#a7b1c2",
    "textSubdued": "#6b768a",
    "borderColor": "#273044",
    "sidebarBg": "#0e1118",
    "playerBg": "#0f131c"
  },
  "background": {
    "type": "gradient",
    "value": "linear-gradient(135deg, #0b0d12 0%, #111b2e 100%)",
    "opacity": 0.85,
    "blur": 12,
    "fixed": true
  },
  "customCss": ".sidebar { border-right: 1px solid var(--skin-border); }"
}

Ready to build?

Inspect existing extensions in the marketplace, read the full Markdown guide, or install Audion's AI Agent Skills (audion-plugin, audion-skin, audion-registry) with npx skills add dupitydumb/Audion-Skills.