fix: mpv loadfile index arg, cache polling, and sidebar CSS

- Pass integer index (-1) to mpv loadfile command for newer mpv versions
- Poll /api/cache/status instead of streaming endpoints to avoid
  downloading video bodies during readiness checks
- Cancel previous polling when selecting a new file
- Fix sidebar flex-shrink and file name text overflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-17 08:17:23 +02:00
parent 2b6c56cd15
commit a67e189aa0
4 changed files with 43 additions and 7 deletions
+7 -2
View File
@@ -117,9 +117,14 @@ impl Mpv {
}
pub fn load_file(&mut self, video_url: &str, audio_url: &str) -> Result<(), String> {
// Pass audio-file option during load so both streams sync from the start
let options = format!("audio-file={}", audio_url);
self.command(&["loadfile", video_url, "replace", &options])
let resp = self.send_and_recv(json!({
"command": ["loadfile", video_url, "replace", -1, options]
}))?;
if resp.get("error").and_then(|e| e.as_str()) != Some("success") {
return Err(format!("mpv error: {}", resp.get("error").unwrap_or(&Value::Null)));
}
Ok(())
}
pub fn seek(&mut self, time: f64) -> Result<(), String> {