rodio/examples/music_ogg.rs

12 lines
331 B
Rust
Raw Normal View History

2015-09-10 17:53:00 +02:00
use std::io::BufReader;
fn main() {
2020-02-25 10:09:17 +00:00
let (_stream, handle) = rodio::OutputStream::try_default().unwrap();
let sink = rodio::Sink::try_new(&handle).unwrap();
2015-09-10 17:53:00 +02:00
let file = std::fs::File::open("assets/music.ogg").unwrap();
2015-10-22 16:45:33 +02:00
sink.append(rodio::Decoder::new(BufReader::new(file)).unwrap());
2015-09-10 17:53:00 +02:00
2017-02-09 11:49:44 +01:00
sink.sleep_until_end();
2015-09-10 17:53:00 +02:00
}