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