//filename:Cargo.toml
[dependencies]
rodio="0.13.0"
//filename:main.rs
use rodio::Sink;
fn main ()
{
let file = std::fs::File::open("hca.mp3").unwrap();
let (_strea,handle) = rodio::OutputStream::try_default().unwrap();
let sink1:Sink=rodio::Sink::try_new(&handle).unwrap();
let file_source= rodio::Decoder::new(file).unwrap();
sink1.append(file_source);
sink1.sleep_until_end();
}
//注意:hca.mp3路径
1
共 0 条评论, 1 页
评论区
写评论还没有评论