Tauri Plugin Audioplayer
tauri-plugin-audioplayer is a Tauri v2 desktop plugin for building native audio playback experiences. It exposes typed JavaScript bindings for discovering audio devices, selecting the input and output devices your application will use, loading a remote audio file, and controlling its playback from the frontend.
Audio is downloaded and decoded once into an in-memory interleaved f32 buffer. The plugin then renders that buffer through the selected CPAL output device, so play, pause, stop, progress reporting, and seeking work without downloading the track again. Symphonia provides broad container and codec support, with symphonia-adapter-libopus included for Opus files.
The current implementation manages one loaded track at a time. Playback requires an F32 output configuration with a sample rate equal to the decoded track; output conversion, resampling, input capture, playlists, and progressive streaming are intentionally outside the current scope.
Installation
Install the rust part of the plugin
```bash
cargo add tauri-plugin-audioplayer
```
Install the js bindings
Use your preferred javascript package manager to add @audioland/tauri-plugin-audioplayer
```bash
pnpm add @audioland/tauri-plugin-audioplayer
npm add @audioland/tauri-plugin-audioplayer
```
Examples
-
examples/demo - Tauri + SvelteJS app: get an audio from a unauthenticated URL, selfhost the local server with examples/httpserver
-
examples/demo-authenticated - Tauri + SvelteJS app: get an audio from an authenticated URL.
Requirements
- Git must be available in
PATH. The Opus adapter is pinned to a Git revision, so Cargo uses Git during a clean dependency install. - Rust 1.90 or newer, including
cargo,rustc, and the host target. The crate uses Rust edition 2024. - The platform prerequisites required by Tauri v2. On Windows this means the MSVC C++ build tools and Windows SDK; they are also required to build the bundled
libopusadapter. - Node.js 20.19+ or 22.12+ and pnpm for the JavaScript bindings and the Svelte demo.
- Internet access for the first
cargoandpnpminstall. Later builds can use the local dependency caches. - A working input and/or output device is required only to exercise device selection and playback; compilation and the automated tests do not open audio hardware.
Feature Support
| Feature | Status | Description |
|---|---|---|
| Desktop platforms | 🟢 | Windows, Linux, and macOS are declared as fully supported desktop targets. |
| Device discovery | 🟢 | Lists input and output devices with stable device IDs and the selected CPAL stream configuration. |
| Device selection | 🟢 | Selects one input device and one output device by ID. Input capture is not implemented yet. |
| Audio formats | 🟢 | Support for AIFF, CAF, MP4/M4A, MKV/WebM, OGG, WAV, AAC, ALAC, FLAC, MP1/MP2/MP3, PCM, Vorbis and Opus audio codecs using Symphonia |
| Load into memory | 🟢 | Downloads and fully decodes a single audio track into an in-memory f32 interleaved buffer before playback. |
| Authenticated requests | 🟢 | Load into memory audio from authenticated sources |
| Playback controls | 🟢 | Play, pause, stop, playback progress, and seek commands operate on the loaded buffer. Seeking while playing continues from the selected position. |
🟢 Supported 🟡 In Development 🔴 Planned
Contributing
We welcome contributions! Please see our Contributing Guidelines and Code of Conduct for details on how to get started.
License
This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.