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.
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
| Field | Type | Description |
|---|---|---|
name | string | Human-readable plugin name (e.g. "Last.fm Scrobbler"). |
version | string | Semantic version string (e.g. "1.0.0"). |
author | string | Developer or organization name. |
type | string | Must be "js" or "wasm". |
entry | string | Relative path to the entry file (e.g. "index.js" or "index.wasm"). |
permissions | string[] | Array of declared permission scopes (e.g. ["player:read", "network:fetch"]). |
Optional Manifest Fields
| Field | Type | Description |
|---|---|---|
safe_name | string | Kebab-case identifier and folder name. Generated from name if omitted. |
description | string | Short summary displayed on marketplace cards. |
category | string | Canonical: streaming, metadata, lyrics, library, integration, appearance, utility (aliases: audio, ui, theme, social, sync, tool). |
tags | string[] | Searchable keyword tags. |
provides | string[] | Provider roles: "stream", "metadata", and/or "lyrics". |
ui_slots | string[] | Declared UI slot names the plugin injects into. |
cross_plugin_access | object[] | Array of { plugin, methods[] } entries for api.request(). |
icon / icon_url | string | Relative path to a local icon (e.g. "icon.png") or remote icon URL. |
repo / manifest_url | string | Public GitHub repository URL and optional direct plugin.json URL. |
homepage / license | string | Project homepage URL and SPDX license identifier (e.g. "MIT"). |
min_version | string | Minimum supported Audion version (e.g. "1.2.0"). |
sha256 / integrity | string | SHA-256 hash of entry bytes, verified by Audion on install and update. |
Sample plugin.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:
your-plugin-name/
├── plugin.json # Manifest file (required)
├── index.js # Single bundled entry file (required)
├── icon.png # Optional relative icon
└── README.md # Optional documentationJavaScript 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.
(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:
Discovery
Audion scans the local plugins directory for valid plugin.json manifest files.
Loading
The JS or WASM entry file is loaded into an isolated plugin scope.
init(api)
Audion passes the permission-gated PluginAPI instance to your plugin. Store the reference and initialize state.
start()
Fires when the user enables your plugin in Settings. Register slots, providers, and active timers.
stop()
Fires when the user disables your plugin. Pause polling, background fetch routines, or visualizers.
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).
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:
| Scope | Enforcement | Description & APIs |
|---|---|---|
player:read | Enforced | Synchronous state: getCurrentTrack(), isPlaying(), getCurrentTime(), getDuration(), getQueue(). |
player:control | Enforced | play(), pause(), seek(), next(), prev(), setTrack(), playQueue(), queue mutations, and api.stream. |
library:read | Enforced | Query library tracks and playlists: getTracks(), getPlaylists(). |
library:write | Enforced | downloadTrack(), addExternalTrack(), likeTrack(), unlikeTrack(), removeTrack(), deleteTrack(), refresh(), playlist/cover updates. |
storage:local | Enforced | Async api.storage.get() / set() (5 MB quota, 50 writes/min) and unlocks api.settings. |
settings:write | Enforced | Modify app settings via api.settings.setDownloadLocation() (storage:local also grants access). |
network:fetch | Enforced | CORS-free Rust-proxied api.fetch(url, init) and api.fetchBlob(url, init). |
ui:inject | Enforced | api.ui.registerSlot(slotName, element, priority) and unregisterSlot(slotName). |
lyrics:read / lyrics:write / system:notify | Declared-only | Manifest 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.
// 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, requiresplayer:control):registerProvider(),unregisterProvider(),registerResolver(sourceType, fn),unregisterResolver(sourceType), andresolveStream(). - Metadata Provider (
api.metadata, always available):registerProvider(),unregisterProvider(), andsearch(). - Lyrics (
api.lyrics, always available):registerProvider(),unregisterProvider(),fetchLyrics(),getCurrentTrackLyrics(),getCurrentTrackActiveLyric(),getLyrics(musicPath), andgetCurrentLyric(musicPath, currentTime). - Search & Covers (
api.search,api.covers, always available):registerSource(),unregisterSource(), andquery(). - Theme & Discord RPC (always available):
api.theme.refresh()andapi.discord(connect,updatePresence,clearPresence,disconnect,reconnect,resolveCover). - Inter-Plugin IPC:
api.handleRequest(method, handler)andapi.request(method, params), gated bycross_plugin_accessinplugin.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.
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:
- Host your plugin in a public GitHub repository with
plugin.jsonat the root of the default branch. - Bundle your JavaScript into a single
entryfile — Audion's installer fetches onlyplugin.json,entry, and a relativeiconfrom raw GitHub. - Add the topic
audion-pluginsin your GitHub repository Settings. - Use a registry-accepted
category(audio,ui,lyrics,library,utility,appearance,social,sync, ormetadata) to avoid indexer warnings; Audion normalizes aliases likeaudiotostreaming.
Deep Link Distribution
Share one-click installation links using the registered audion:// desktop protocol:
audion://install-plugin?url=https://github.com/your-username/your-pluginAudion 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.
.audionskinv2 JSON: Requiresversion(1or2),name,accentColor(6/8-digit hex), andmode(dark|light|system). Supports 10customColorskeys (6/8-digit hex only),background(none|color|gradient;image/videoare downgraded tonone),animation,schemes,customCss(<style id="audion-skin-css">with--skin-*variables), andcustomJs.customJs/effect.js: Runs on#audion-effect-layerasnew Function('canvas', 'ctx', 'accent', js), must return a cleanup function, and only executes whenallowCustomJsis enabled.- Folder skins: Place
skin.ini([Metadata],[Theme],[Skin],[Setting]+ scheme sections),user.css, andeffect.jsin a local skin folder. Folder skins override standalone.audionskinfiles of the same name.
{
"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.