2024-11-19 20:58:05 +00:00
|
|
|
use std::error::Error;
|
2015-09-10 15:53:00 +00:00
|
|
|
use std::io::BufReader;
|
|
|
|
|
2024-11-19 20:58:05 +00:00
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
2024-11-21 17:43:24 +00:00
|
|
|
let stream_handle = rodio::OutputStreamBuilder::open_default_stream()?;
|
2024-11-09 22:34:49 +00:00
|
|
|
let sink = rodio::Sink::connect_new(&stream_handle.mixer());
|
2015-09-10 15:53:00 +00:00
|
|
|
|
2024-11-19 20:58:05 +00:00
|
|
|
let file = std::fs::File::open("assets/music.ogg")?;
|
|
|
|
sink.append(rodio::Decoder::new(BufReader::new(file))?);
|
2015-09-10 15:53:00 +00:00
|
|
|
|
2017-02-09 10:49:44 +00:00
|
|
|
sink.sleep_until_end();
|
2024-11-19 20:58:05 +00:00
|
|
|
|
|
|
|
Ok(())
|
2015-09-10 15:53:00 +00:00
|
|
|
}
|