[](https://crates.io/crates/libminau)
[](https://opensource.org/licenses/BSD-3-Clause)
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](https://github.com/pdeljanov/Symphonia), such as MP3, FLAC, Ogg Vorbis, WAV, and more.
* **Cross-Platform**: Thanks to [CPAL](https://github.com/RustAudio/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](https://github.com/Serial-ATA/lofty-rs) 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`:
```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:
```rust
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.