Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
fix(player): resolve windows vlc spawn and subtitle path handling
Samir Hossainsecc45dd759fa
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 18d2277..4b35e6d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -19,6 +19,7 @@- **Cross-platform release validation**: Run all-feature locked builds/tests, binary startup smoke tests, Unix and Windows installer syntax checks, and release-target builds in CI.- **Release artifact smoke tests**: Execute each native release target's produced binary on its CI runner before archiving.- **Documentation accuracy**: Document Android intent limitations, the actual Termux binary model, macOS-only IINA support, native runtime verification requirements, and the current automated test count.+- **Windows VLC & player spawn fix**: Removed erroneous `CREATE_NO_WINDOW` flag that suppressed GUI window creation and caused VLC to crash on Windows; normalized Windows backslash subtitle paths in `--sub-file` and gracefully handle subtitle download failures without breaking stream playback.- **Termux player opener resolution**: Resolve `termux-open`, `termux-open-url`, and `termux-am` directly in `$PREFIX/bin` and static Termux paths; remove broken `/system/bin/am` fallback in unrooted Termux that crashed with Permission Denied (exit code 126).- **Termux dependency path**: Remove the Android platform-verifier dependency path that caused the v0.1.12 startup panic; real-device confirmation remains required.diff --git a/docs/cross-platform.md b/docs/cross-platform.mdindex 285dee7..d5db97c 100644--- a/docs/cross-platform.md+++ b/docs/cross-platform.md@@ -13,7 +13,7 @@ the release checks in [`release-checklist.md`](release-checklist.md).| Platform | Notes || ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- || macOS | IINA preferred player (via the installed IINA `iina-cli`); VLC/mpv `.app` paths detected. `process_group(0)` on spawn. |-| Windows | mpv/VLC detected via Program Files + `%LOCALAPPDATA%`; players spawned with `CREATE_NO_WINDOW`; path-safe file stems; static MSVC CRT linking (`+crt-static`) for zero-dependency standalone binaries. |+| Windows | mpv/VLC detected via Program Files + `%LOCALAPPDATA%`; path-safe file stems; static MSVC CRT linking (`+crt-static`) for zero-dependency standalone binaries. || Linux | Flatpak mpv/VLC supported (`flatpak run …`); xdg data/cache dirs. || Android (Termux) | Uses the Linux ARM64 binary and dynamically checks for `termux-open`, `termux-open-url`, `termux-am`, or in-terminal `mpv`; playback strips `LD_LIBRARY_PATH` and `LD_PRELOAD` before launching the chooser. Android intent playback cannot forward stream headers or attach subtitles. Real-device chooser behavior is a release prerequisite; Proot/Termux X11 behavior is unsupported unless separately tested. |diff --git a/docs/known-issues.md b/docs/known-issues.mdindex b472e7c..bbabb08 100644--- a/docs/known-issues.md+++ b/docs/known-issues.md@@ -29,6 +29,6 @@ Tracked here so future work and issue reports reference the same facts.## Verification-- Automated testing is enforced via `cargo test --all-features --locked` covering 172 unit and integration tests across 16 test suites (see [`docs/testing.md`](testing.md)). The count is updated when tests change; it does not replace real-player and real-device verification.+- Automated testing is enforced via `cargo test --all-features --locked` covering 173 unit and integration tests across 16 test suites (see [`docs/testing.md`](testing.md)). The count is updated when tests change; it does not replace real-player and real-device verification.- Static correctness is enforced by strict compiler type checking, the lint gate (`cargo clippy --all-targets --all-features --locked -- -D warnings`), formatting (`cargo fmt --check`), dependency vulnerability scanning (`cargo audit`), and packaging verification (`cargo package --locked`).- Runtime and platform-specific behavior (terminal resize, focus handling, external player launch, and Termux chooser) are verified through the release checklist in [`release-checklist.md`](release-checklist.md).diff --git a/src/player.rs b/src/player.rsindex 074b5bf..4bb2ccf 100644--- a/src/player.rs+++ b/src/player.rs@@ -320,7 +320,8 @@ fn mpv_command(} else {"--sub-file"};- command.arg(format!("{opt}={subtitle}"));+ let sub_path = subtitle.replace('\\', "/");+ command.arg(format!("{opt}={sub_path}"));}command.arg(url);@@ -432,7 +433,8 @@ fn vlc_command(}}if let Some(subtitle) = subtitle {- command.arg(format!("--sub-file={subtitle}"));+ let sub_path = subtitle.replace('\\', "/");+ command.arg(format!("--sub-file={sub_path}"));}command.arg(url);@@ -810,6 +812,26 @@ mod tests {);}+ #[test]+ fn vlc_command_normalizes_windows_subtitle_paths() {+ let command = vlc_command(+ "https://example.test/video.mp4",+ Some(r"C:\Users\User\AppData\Local\MovieBox-Tui\subs\sub.srt"),+ &[],+ None,+ None,+ );+ let args = command+ .get_args()+ .map(|arg| arg.to_string_lossy().into_owned())+ .collect::<Vec<_>>();+ assert!(+ args.contains(+ &"--sub-file=C:/Users/User/AppData/Local/MovieBox-Tui/subs/sub.srt".into()+ )+ );+ }+#[test]fn header_support_rejects_android_and_unsupported_vlc_headers() {let headers = vec![("Cookie".into(), "session=secret".into())];diff --git a/src/tui/app/playback.rs b/src/tui/app/playback.rsindex 12b1a5b..6996061 100644--- a/src/tui/app/playback.rs+++ b/src/tui/app/playback.rs@@ -184,6 +184,7 @@ impl App {temporary_subtitle = Some(path);}Err(_) => {+ local_subtitle = None;log::warn!("subtitle download failed for {:?} player, playing without subtitles (url was {})",kind,@@ -218,11 +219,6 @@ impl App {use std::os::unix::process::CommandExt;command.process_group(0);}- #[cfg(windows)]- {- use std::os::windows::process::CommandExt;- command.creation_flags(0x08000000);- }match command.spawn() {Ok(mut child) => {