Audion Plugin & Skin Development Guide
Welcome to the Audion developer guide. This document covers everything you need to know to build plugins and visual skins for Audion.
Introduction
Audion's plugin system allows you to extend the player's functionality using JavaScript or WebAssembly. Plugins run in an isolated scope and interact with the player through a permission-gated api object.
With plugins, you can:
- Control Playback: Play, pause, seek, and manage the playback queue.
- Read State: Access current track metadata, playback time, queue, and library data.
- Inject UI: Register custom DOM elements in Shadow DOM-isolated application slots.
- Register Providers: Supply external stream resolvers, metadata search, lyrics, unified search, and cover art sources.
- Store Data: Persist settings and plugin-specific data locally.
- Make Network Requests: Perform CORS-free HTTP requests proxied through the Rust backend.
Audion also supports visual skins via standalone .audionskin v2 JSON packages or modular skin folders (skin.ini, user.css, effect.js).
Getting Started
- Create a new folder for your plugin, e.g.,
my-plugin. - Create a
plugin.jsonmanifest file at the folder root. - Create an
index.js(or.wasm) entry point file. - Test Locally: Copy your plugin folder into Audion's local plugins directory:
- Windows:
%APPDATA%\Audion\plugins\my-plugin - macOS:
~/Library/Application Support/Audion/plugins/my-plugin - Linux:
~/.config/Audion/plugins/my-plugin
- Windows:
Open Audion Settings -> Plugins, click Refresh, and enable your plugin.
Plugin Structure
1. Manifest (plugin.json)
The manifest defines your plugin's metadata, entry point, and requested permissions.
{
"name": "My Plugin",
"safe_name": "my-plugin",
"version": "1.0.0",
"description": "A brief description of what my plugin does.",
"author": "Your Name",
"entry": "index.js",
"type": "js",
"category": "utility",
"tags": ["playback", "scrobbler"],
"provides": ["metadata"],
"permissions": [
"player:read",
"ui:inject",
"network:fetch"
],
"ui_slots": ["playerbar:menu"],
"min_version": "1.2.0",
"license": "MIT",
"repo": "https://github.com/username/my-plugin"
}Required Fields
name: Display name of your plugin.version: Semantic version string (e.g.,"1.0.0").author: Developer or organization name.type: Runtime type —"js"or"wasm".entry: Relative path to the entry file (e.g.,"index.js"or"index.wasm"). Must be a single bundled file for marketplace installs.permissions: Array of permission scope strings required by your plugin.
Optional Fields
safe_name: Folder/identifier name (kebab-case). Generated fromnameif omitted.description: Short summary shown in the plugin manager and marketplace.repo: Public GitHub repository URL.manifest_url: Direct URL toplugin.jsonfor updates.category: Canonical app categories are"streaming","metadata","lyrics","library","integration","appearance", and"utility". Aliases mapped by the app:"audio"->"streaming","ui"/"theme"->"appearance","social"/"sync"->"integration","tool"/"tools"->"utility". (For registry publishing without indexer warnings, prefer"audio","ui","lyrics","library","utility","appearance","social","sync", or"metadata".)tags: Array of search tags (string[]).provides: Array declaring provider capabilities:"stream","metadata", and/or"lyrics".ui_slots: Array of UI slot names the plugin targets (string[]).cross_plugin_access: Array of{ "plugin": "target-safe-name", "methods": ["methodName"] }objects authorizing inter-pluginapi.request()calls.icon: Relative path to a local icon file (e.g.,"icon.png").icon_url: Remote icon URL.homepage: Project homepage or documentation URL.min_version: Minimum supported Audion version.license: SPDX license identifier (e.g.,"MIT").sha256/integrity: Expected SHA-256 hash of theentryfile bytes, verified byinstall_pluginduring installation and updates.
2. Entry Point (index.js)
Register your plugin with Audion.register(plugin) (preferred). CommonJS module.exports and window.AudionPlugin are supported as fallbacks.
(function () {
'use strict';
const MyPlugin = {
name: 'My Plugin',
api: null,
init(api) {
this.api = api;
this.onTrackChange = ({ track }) => {
if (track) {
console.log('Track changed:', track.title);
}
};
api.on('trackChange', this.onTrackChange);
},
start() {
console.log('My Plugin started');
},
stop() {
console.log('My Plugin stopped');
},
destroy() {
if (this.api && this.onTrackChange) {
this.api.off('trackChange', this.onTrackChange);
}
this.api = null;
}
};
if (typeof Audion !== 'undefined' && Audion.register) {
Audion.register(MyPlugin);
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = MyPlugin;
} else {
window.AudionPlugin = MyPlugin;
}
})();API Reference
Lifecycle Hooks
init(api): Called when the plugin is loaded. Saveapiand initialize state.start(): Called when the plugin is enabled by the user.stop(): Called when the plugin is disabled.destroy(): Called when the plugin is unloaded. Remove listeners, clear timers, and unregister slots/providers.
Events (api.on, api.off, api.once)
Always available.
Subscribe to player lifecycle events (note: maxListeners = 10 per event emits a leak warning if exceeded):
trackChange: Fired when the active track changes.playStateChange: Fired when play/pause state changes.timeUpdate: Fired periodically as playback time advances.queueChange: Fired when the playback queue is modified.seeked: Fired when playback seeks to a new position.queueExhausted: Fired when the queue reaches the end.
api.on('trackChange', ({ track, previousTrack }) => { ... });
api.on('playStateChange', ({ isPlaying }) => { ... });
api.once('timeUpdate', ({ currentTime, duration }) => { ... });
api.off('trackChange', handler);Player State & Control (api.player)
Read State (Requires player:read)
All read methods are synchronous:
api.player.getCurrentTrack(): Returns the current track object ornull.api.player.isPlaying(): Returnsboolean.api.player.getCurrentTime(): Returns current playback time in seconds.api.player.getDuration(): Returns total track duration in seconds.api.player.getQueue(): Returns the current queue array.
Control Playback (Requires player:control)
api.player.play()api.player.pause()api.player.seek(seconds)api.player.next()api.player.prev()api.player.setTrack(trackObject)api.player.playQueue(tracks, startIndex)api.player.addToQueue(tracks)api.player.removeFromQueue(index)api.player.reorderQueue(fromIndex, toIndex)api.player.clearUpcoming()
Library Management (api.library)
Read Library (Requires library:read)
api.library.getTracks(): Returns all tracks in the library.api.library.getPlaylists(): Returns all playlists.
Modify Library (Requires library:write)
api.library.downloadTrack(options): Download an audio file to local storage.api.library.addExternalTrack(trackData): Add an external/streaming track to the library.api.library.likeTrack(trackId)/api.library.unlikeTrack(trackId): Favorite or unfavorite a track.api.library.removeTrack(trackId)/api.library.deleteTrack(trackId): Remove or delete a track.api.library.refresh(): Trigger a library refresh.api.library.createPlaylist(name): Create a new playlist.api.library.addTrackToPlaylist(playlistId, trackId): Add a track to a playlist.api.library.updatePlaylistCover(playlistId, coverUrl): Update playlist cover image.api.library.updateTrackCoverUrl(trackId, coverUrl): Update track cover image.
await api.library.addExternalTrack({
title: "Song Title",
artist: "Artist Name",
album: "Album Name",
cover_url: "https://example.com/cover.jpg",
source_type: "my-service",
external_id: "12345",
duration: 180
});Network API (api.fetch, api.fetchBlob)
Requires network:fetch permission.
Make CORS-free network requests routed through the Rust backend.
const response = await api.fetch('https://api.example.com/data', {
method: 'GET',
headers: { 'Authorization': 'Bearer token' }
});
// response has { ok, status, headers, text(), json() }
const data = await response.json();
// Fetch binary content and receive a local blob: URL
const blobUrl = await api.fetchBlob('https://example.com/cover.jpg');Storage & Settings (api.storage, api.settings)
api.storage requires storage:local permission (5 MB quota, 50 writes/min rate limit).
await api.storage.set('my-key', { enabled: true });
const value = await api.storage.get('my-key');api.settings requires storage:local or settings:write permission.
api.settings.setDownloadLocation('/path/to/downloads');Providers (api.stream, api.metadata, api.lyrics, api.search, api.covers)
- Stream Provider (
api.stream) (Requiresplayer:control):api.stream.registerProvider(provider)/api.stream.unregisterProvider()api.stream.registerResolver(sourceType, async (externalId, options) => url)/api.stream.unregisterResolver(sourceType)api.stream.resolveStream(sourceType, externalId, options)
- Metadata Provider (
api.metadata) (Always available):api.metadata.registerProvider(provider)/api.metadata.unregisterProvider()api.metadata.search(query, options)
- Lyrics Provider & Lookup (
api.lyrics) (Always available):api.lyrics.registerProvider(provider)/api.lyrics.unregisterProvider()api.lyrics.fetchLyrics(track)api.lyrics.getCurrentTrackLyrics()api.lyrics.getCurrentTrackActiveLyric()api.lyrics.getLyrics(musicPath)api.lyrics.getCurrentLyric(musicPath, currentTime)
- Search & Covers (
api.search,api.covers) (Always available):api.search.registerSource(source)/api.search.unregisterSource()/api.search.query(q)api.covers.registerSource(source)/api.covers.unregisterSource()/api.covers.query(track)
Theme, Discord RPC & Cross-Plugin IPC
Always available (api.request / api.handleRequest gated by cross_plugin_access in plugin.json).
api.theme.refresh(): Re-apply active theme and skin styles.api.discord:connect(),updatePresence(data),clearPresence(),disconnect(),reconnect(),resolveCover(track).api.handleRequest(method, async (params) => result)/await api.request(method, params).
UI Injection (api.ui)
Requires ui:inject permission.
Inject custom HTML elements into Shadow DOM-isolated application slots (CSS theme variables are forwarded into the shadow root):
api.ui.registerSlot(slotName, element, priority = 50): Register a DOM element in a slot. Lowerpriorityrenders first.api.ui.unregisterSlot(slotName): Remove a previously registered slot element.
const el = document.createElement('button');
el.textContent = 'My Plugin';
api.ui.registerSlot('playerbar:menu', el, 10);Available Slots
playerbar:left: Left side of the player bar (near track info).playerbar:right: Right side of the player bar (near volume controls).playerbar:menu: Dedicated plugin popup menu (automatically mirrors tomobile:homeon mobile).sidebar:top: Top of the sidebar, below the logo.sidebar:bottom: Bottom of the sidebar, above library actions.mobile:home: Mobile home plugin section.mobile:bottomnav: Mobile bottom navigation bar.
Permissions
Declare required permissions in plugin.json:
| Permission | Enforcement | Description |
|---|---|---|
player:read | Enforced | Read current track, time, duration, play state, and queue. |
player:control | Enforced | Control playback, manage queue, and register api.stream providers/resolvers. |
library:read | Enforced | Read library tracks and playlists. |
library:write | Enforced | Add external tracks, download tracks, like/remove tracks, manage playlists. |
storage:local | Enforced | Async api.storage.get/set (5 MB quota, 50 writes/min) and api.settings. |
ui:inject | Enforced | Register and unregister elements in api.ui slots. |
network:fetch | Enforced | Use api.fetch and api.fetchBlob via the Rust backend. |
settings:write | Enforced | Modify app settings via api.settings (storage:local also unlocks this). |
lyrics:read | Declared-only | Intent declaration for reading lyrics (api.lyrics is always available). |
lyrics:write | Declared-only | Intent declaration for writing/providing lyrics. |
system:notify | Declared-only | Intent declaration for system notifications. |
Publishing & Marketplace
Audion indexes community plugins from GitHub into dupitydumb/audion-plugins (registry/main/registry.json) on a 6-hour schedule or via plugin-released repository dispatch.
How to Publish
- Host your plugin in a public GitHub repository with
plugin.jsonat the repository root on the default branch. - Bundle your JavaScript into a single
entryfile (e.g.,index.js). During installation, Audion fetches onlyplugin.json,entry, and a relativeicondirectly from raw GitHub — it does not download ZIP archives or walk subdirectories. - Add the
audion-pluginstopic to your GitHub repository settings. - Ensure
plugin.jsonincludes all required fields (name,version,author,type,entry,permissions). - For
category, use one of the registry-accepted values (audio,ui,lyrics,library,utility,appearance,social,sync,metadata) to avoid indexer warnings; the Audion app automatically normalizes aliases likeaudio->streamingandsocial/sync->integration. - Optionally include
sha256orintegrityinplugin.jsonso Audion verifies yourentrybytes on install/update.
Deep Link Installation
Users can install your plugin in one click using:
audion://install-plugin?url=https://github.com/username/my-pluginAudion Skins
Audion supports local visual customization through standalone .audionskin (v2 JSON) packages and modular skin folders. Skins are local-only and are not indexed in the plugin registry.
1. .audionskin v2 JSON Format
A .audionskin file is a JSON document defining colors, animations, schemes, optional CSS, and optional canvas effects:
{
"version": 2,
"name": "Midnight Neon",
"author": "Your Name",
"description": "High-contrast dark theme with cyan accent",
"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
},
"animation": {
"reducedMotion": false,
"pageTransition": true,
"playerVisualization": true,
"hoverScale": true,
"accentPulse": false,
"transitionSpeed": "normal"
},
"activeScheme": "default",
"schemes": {},
"customCss": ".sidebar { border-right: 1px solid var(--skin-border); }",
"customJs": "return () => {};"
}Key Schema Rules
version:1or2.name: Display name of the skin.accentColor: Mandatory 6-digit or 8-digit hex color (e.g.,"#00e5ff").mode:"dark","light", or"system".customColors: 10 keys (bgBase,bgElevated,bgSurface,bgHighlight,textPrimary,textSecondary,textSubdued,borderColor,sidebarBg,playerBg). Only 6/8-digit hex values are preserved byparseSkinPackage;rgba()or invalid values fall back to mode defaults.background:type("none","color","gradient","image","video"),value,opacity(0..1),blur(0..40),fixed(boolean). Note:imageandvideobackgrounds are blanked and downgraded to"none"on parse/export.animation:reducedMotion,pageTransition,playerVisualization,hoverScale,accentPulse,transitionSpeed.customCss: Injected into<style id="audion-skin-css">with--skin-*CSS variables available.customJs: Body ofnew Function('canvas', 'ctx', 'accent', js)running on#audion-effect-layer. Must return a cleanup function and only runs whenallowCustomJsis enabled in settings.
2. Modular Folder Skins
Place a folder in Audion's local skins directory containing:
skin.ini: INI configuration with[Metadata],[Theme],[Skin],[Setting], and optional color scheme sections.user.css: Custom CSS rules (mapped tocustomCss).effect.js: Custom canvas effect script (mapped tocustomJs).
If a modular skin folder and a standalone .audionskin file share the same name, the folder skin takes precedence.