The previous .git directory was found gutted (only info/ remained), so history is unrecoverable locally. This commit restores version control with the tree exactly as it stands: the working app, the preview-tracks launcher on the artist hero, the scrollable-track-previews design bundle (docs + approved mockups), and the Phase 0 validation artifacts.
42 lines
1.4 KiB
Rust
42 lines
1.4 KiB
Rust
//! Local playback smoke test: play a file, seek, report positions.
|
|
//!
|
|
//! cargo run -p player --example play -- "C:\path\to\file.flac"
|
|
|
|
use player::{Player, PlayerEvent};
|
|
use std::time::Duration;
|
|
|
|
fn main() {
|
|
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("debug")).init();
|
|
let path = std::env::args().nth(1).expect("usage: play <file>");
|
|
|
|
let (player, events) = Player::spawn();
|
|
player.play_local(&path, None);
|
|
|
|
let mut last_pos = 0.0;
|
|
let start = std::time::Instant::now();
|
|
let mut seeked = false;
|
|
|
|
while start.elapsed() < Duration::from_secs(12) {
|
|
match events.recv_timeout(Duration::from_millis(500)) {
|
|
Ok(PlayerEvent::Playing) => println!("PLAYING"),
|
|
Ok(PlayerEvent::Position { secs, duration }) => {
|
|
last_pos = secs;
|
|
println!("pos={secs:.1} dur={duration:?}");
|
|
if secs > 3.0 && !seeked {
|
|
seeked = true;
|
|
println!("SEEK to 60s…");
|
|
player.seek(60.0);
|
|
}
|
|
}
|
|
Ok(PlayerEvent::Error(e)) => {
|
|
println!("ERROR: {e}");
|
|
return;
|
|
}
|
|
Ok(ev) => println!("{ev:?}"),
|
|
Err(_) => {}
|
|
}
|
|
}
|
|
println!("final pos: {last_pos:.1} (expect > 60 if seek worked)");
|
|
player.stop();
|
|
}
|