Skip to content

Overview

Minimum foobar2000 version: 2.0+

foo_ui_webview2 is a foobar2000 component that replaces the default user interface with WebView2, so you can build custom UIs with modern web technologies (HTML/CSS/JavaScript).

Migrating from Spider Monkey Panel (SMP)?

v1.2.0 ships a full SMP compatibility layer, including:

  • 35 SMP event mappings — SMP names such as on_playback_new_track work directly
  • 8 wrapper classesFbMetadbHandle, FbTitleFormat, ContextMenuManager, and more
  • Full fb / plman objects — sync properties, playback control, and playlist management

How it works: a cache + event model wraps async APIs as sync properties to match SMP's sync semantics. This is an eventual consistency model (not strong consistency) and fits UI rendering. For precise transactional control, call the low-level fb2k.invoke() APIs directly. WARNING: SMP GDI/GDI+ drawing (on_paint(gr), etc.) cannot migrate — rewrite the UI layer with HTML/CSS/Canvas. → Full SMP compatibility docs

Key Features

API distribution

ModuleCountDescription
playback27Playback control, state, volume, path playback
playlist45Playlist management and autoplaylists
library21Media library browse, search, path lookup
artwork12Cover art, fb2k:// URLs, batch fetch, server-side scaling
config29Configuration, devices, persistent storage, output settings
window72Window control, DWM effects, multi-window system
system9Theme/DPI/language, API discovery
file10File read/write, copy, move, directory ops
dialog4File/folder dialogs
clipboard4Clipboard operations
shell4System integration
http4HTTP requests
ui5Custom menus and notifications
keyboard4Global hotkeys
lyrics3Lyrics management
metadata9Metadata read/write and batch read
audio12Audio analysis, spectrum, waveform
console6Logging
dnd4Drag and drop
queue8Playback queue
jitQueue7JIT immediate queue
discovery15Service discovery and context menus
dsp8DSP chain management
output3Audio output devices
replaygain8ReplayGain settings
playcount6Play statistics and ratings
titleformat5Titleformat evaluation
selection6Selection sync and viewer mode
menu5Main/context menu commands
misc9Path queries, preferences, console helpers
panel2Panel mode detection
test2Test utilities

Design principles

foo_ui_webview2 follows "the component provides capabilities; the app decides policy."

Component responsibilities (provided by foo_ui_webview2)

CategoryDescriptionExamples
foobar2000 core capabilitiesPlayback, playlists, library, artworkplayback.*, playlist.*
Window managementDWM effects, caption, scalingwindow.*
System integrationFiles, dialogs, shellfile.*, dialog.*
Audio analysisSpectrum and waveformaudio.*
Config storagePersistent key-value storageconfig.*
Streaming helpersGeneric URL playback, JIT queuejitQueue.*

Application responsibilities (implemented by you)

CategoryDescriptionWhy not in the component
Online service integrationSpotify, NetEase, QQ Music, etc.Auth and business flows differ
Multi-source lyrics aggregationOnline search and translation mergeBusiness logic
Artwork cache policyPrefetch and LRUPolicy choice
UI theme and layoutColors, fonts, animationApp-specific

Example: capability vs policy

javascript
// Component capability: fetch artwork
await fb2k.invoke('artwork.getFb2kUrl', { path: trackPath, maxSize: 200 });

// App policy: prefetch / cache
function prefetchCovers(albums) {
    albums.forEach(album => {
        const img = new Image();
        img.src = `fb2k://artwork/${encodeURIComponent(album.path)}?maxSize=200`;
    });
}