Crates.io | url2audio |
lib.rs | url2audio |
version | 0.3.0 |
source | src |
created_at | 2024-07-08 06:39:03.070046 |
updated_at | 2024-10-25 12:41:54.340415 |
description | simple-to-use lib for playing audio streams |
homepage | https://github.com/zchira/url2audio |
repository | https://github.com/zchira/url2audio |
max_upload_size | |
id | 1295417 |
size | 119,467 |
Simple to use rust library for playing audio streams.
// create Player instance
let mut p = Player::new();
// open audio stream from url:
// example: https://something.from.the.web/xyz.mpr
let res = p.open(src);
println!("duration: {}", p.duration());
sleep(std::time::Duration::from_secs(3));
// pause playback
p.pause();
sleep(std::time::Duration::from_secs(3));
// resume playback
p.play();
println!("Resume at: {}", p.current_position());
sleep(std::time::Duration::from_secs(3));
// seek
p.seek(600.0);
sleep(std::time::Duration::from_secs(5));