diff --git a/audio-player/src/player_engine.rs b/audio-player/src/player_engine.rs index 0cf3d79..113c6de 100644 --- a/audio-player/src/player_engine.rs +++ b/audio-player/src/player_engine.rs @@ -208,7 +208,15 @@ impl PlayerEngine { .map_err(|_| anyhow!("timed out opening stream after {STREAM_OPEN_TIMEOUT:?}"))? .context("failed to open http stream") })?; + // Symphonia probes the container length during init; without a + // known byte length it seeks from the end, which rodio 0.22 turns + // into an `unreachable!` panic on a streamed source. Handing it the + // content length up front avoids that seek entirely. + let byte_len = reader.content_length(); let mut builder = Decoder::builder().with_data(reader).with_seekable(true); + if let Some(len) = byte_len { + builder = builder.with_byte_len(len); + } if let Some(extension) = Path::new(url.path()).extension().and_then(|e| e.to_str()) { builder = builder.with_hint(extension);