1 unstable release
Uses new Rust 2024
| 0.1.0 | Oct 10, 2025 |
|---|
#1131 in Audio
60KB
1.5K
SLoC
This is the library version of Minau, a music player built directly on Symphonia and CPAL. It provides simple functionality for playing audio from local files or URLs.
Key Features
- Wide Format Support: Can decode many audio formats supported by Symphonia, such as MP3, FLAC, Ogg Vorbis, WAV, and more.
- Cross-Platform: Thanks to CPAL, audio playback is supported on major platforms including Windows, macOS, and Linux.
- Network Streaming: Supports playing music via HTTP/HTTPS.
- Metadata Retrieval: Uses Lofty to read track tags (artist, album, etc.) and track duration.
- Playlist Support: Can parse playlists in M3U format.
Installation
Add the following line to your Cargo.toml:
// filepath: Cargo.toml
// ...existing code...
[dependencies]
libminau = "0.1.0"
// ...existing code...
Usage
Here is a basic example for playing a local music file:
use libminau::player::Player;
use std::time::Duration;
#[tokio::main]
fn main() -> anyhow::Result<()> {
// Play a local file
let mut player = Player::from_file("/path/to/music.mp3")?;
// If you want to specify a URL, use Player::from_url
// let mut player = Player::from_url("https://example.com/music.mp3").await?;
// Set volume
player.set_volume(0.7)?;
// Start playback
player.play()?;
println!("Playback started.");
// Wait for the music to finish
player.wait_until_finished().await;
println!("Playback finished.");
Ok(())
}
License
This project is released under the BSD-3-Clause license.
Dependencies
~34–74MB
~1M SLoC