mirror of
https://github.com/RustAudio/rodio
synced 2024-12-12 13:12:30 +00:00
14 lines
392 B
Rust
14 lines
392 B
Rust
use std::error::Error;
|
|
use std::io::BufReader;
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
let stream_handle = rodio::OutputStreamBuilder::try_default_stream()?;
|
|
let sink = rodio::Sink::connect_new(&stream_handle.mixer());
|
|
|
|
let file = std::fs::File::open("assets/music.mp3")?;
|
|
sink.append(rodio::Decoder::new(BufReader::new(file))?);
|
|
|
|
sink.sleep_until_end();
|
|
|
|
Ok(())
|
|
}
|