Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

feat(player): support selectable stream resolutions and adaptive bitrate capping

Samir Hossainsf1263f28f07e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 461f5a4..5c2d769 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,9 @@
- Automated Scoop manifest synchronization alongside Homebrew in `.github/workflows/manifests.yml`, extracting `MovieBox_Windows_x64.zip` and `MovieBox_Windows_arm64.zip` checksums from `SHA256SUMS`.
- Added `InstallationEnvironment::Scoop` detection in `src/updater/apply.rs` via executable path inspection (`/scoop/apps/`, `\scoop\apps\`, `/scoop/shims/`, `\scoop\shims\`).
- Added dedicated update notification modal handling with `[s]` shortcut to display `scoop update moviebox-tui` on Scoop-managed Windows installations.
+- **MovieBox Stream Resolution Picker & Adaptive Bitrate Capping**:
+ - Decomposed multi-resolution DASH streams in `src/providers/moviebox/adapt.rs` into individual resolution stream rows (`1080p`, `720p`, `480p`, etc.) sorted by quality, enabling direct stream selection from the details screen.
+ - Threaded resolution constraints to player command builders (`src/player.rs` and `src/tui/app/playback.rs`), injecting `--ytdl-format="bestvideo[height<=H]+bestaudio/best"` for `mpv`/`IINA` and `--adaptive-maxheight=H` for `VLC` to prevent playback buffering on slow connections.
### Fixed
- **In-App Updater Streaming Timeout & Chunk Retry Recovery**:
- Removed the static 30-second total request deadline from the release binary download client in `src/updater/check.rs`, preventing mid-transfer decode aborts (`download chunk stream error: error decoding response body`) on slow or high-latency network connections.
diff --git a/docs/players.md b/docs/players.md
index 0a1d7ab..199d84d 100644
--- a/docs/players.md
+++ b/docs/players.md
@@ -18,9 +18,9 @@ Resolution caches detected paths across runs while allowing newly installed play
| Player | Invocation | Notes |
| :--- | :--- | :--- |
-| mpv | `mpv --autofit=WxH --geometry=50%:50% --idle=no --keep-open=no --ytdl-format=bestvideo+bestaudio/best --hls-bitrate=max [--start=..] [--script=..] [--script-opts=..] [--http-header-fields=..] [--sub-file=..] <url>` | Window sized to the terminal. Injects `moviebox_tracker.lua` for position tracking and resume. Sets maximum adaptive stream bitrate and best video/audio format selection. Each non-UA, non-Referer header is passed as a separate `--http-header-fields` argument. Flatpak mpv is launched via `flatpak run` with `@@` file forwarding markers for local files. |
-| VLC | `vlc --width=W --height=H --play-and-exit --adaptive-logic=highest [--start-time=..] [--http-referrer=..] [--http-user-agent=..] [--sub-file=..] <url>` | Sets adaptive logic to highest representation. Supports start time resume via `--start-time`. For CloudFront cookie-gated streams (MovieBox DASH), the URL is replaced by a loopback sidecar proxy address (`http://127.0.0.1:<port>/https/<host>/path`) that injects all auth headers server-side before forwarding chunks to VLC. Flatpak VLC wraps local files with `@@` markers. |
-| IINA | `iina-cli --keep-running --no-stdin --mpv-autofit=.. [--mpv-start=..] [--mpv-http-header-fields=..] [--mpv-sub-files=..] <url>` | Uses the installed IINA `iina-cli`; falls back to `open -a IINA <url>` with an informational status warning if the CLI is absent. |
+| mpv | `mpv --autofit=WxH --geometry=50%:50% --idle=no --keep-open=no [--ytdl-format=bestvideo[height<=H]+bestaudio/best..] --hls-bitrate=max [--start=..] [--script=..] [--script-opts=..] [--http-header-fields=..] [--sub-file=..] <url>` | Window sized to the terminal. Injects `moviebox_tracker.lua` for position tracking and resume. Sets maximum adaptive stream bitrate and selected video/audio representation (`bestvideo[height<=H]`). Each non-UA, non-Referer header is passed as a separate `--http-header-fields` argument. Flatpak mpv is launched via `flatpak run` with `@@` file forwarding markers for local files. |
+| VLC | `vlc --width=W --height=H --play-and-exit --adaptive-logic=highest [--adaptive-maxheight=H] [--start-time=..] [--http-referrer=..] [--http-user-agent=..] [--sub-file=..] <url>` | Sets adaptive logic to highest representation within resolution limit (`--adaptive-maxheight=H`). Supports start time resume via `--start-time`. For CloudFront cookie-gated streams (MovieBox DASH), the URL is replaced by a loopback sidecar proxy address (`http://127.0.0.1:<port>/https/<host>/path`) that injects all auth headers server-side before forwarding chunks to VLC. Flatpak VLC wraps local files with `@@` markers. |
+| IINA | `iina-cli --keep-running --no-stdin --mpv-autofit=.. [--mpv-ytdl-format=bestvideo[height<=H]+bestaudio/best..] [--mpv-start=..] [--mpv-http-header-fields=..] [--mpv-sub-files=..] <url>` | Uses installed `iina-cli` with `--mpv-*` option forwarding; filters out unsupported Lua tracker scripts. Respects yt-dlp resolution caps when youtube-dl / yt-dlp is enabled in IINA Preferences. Falls back to `open -a IINA <url>` with an informational status warning if CLI is absent. |
| Android / Termux | `termux-open --chooser --content-type video/* <url>` (or `termux-open-url` / `termux-am`) | Opens an app chooser on the device, delegating playback to external apps (VLC, MX Player, Just Player, MPV Android). Requires `pkg install -y termux-tools termux-am`. Forwards `User-Agent`, `Referer`, and subtitles when using `termux-am`. |
Window size is derived from the live terminal size times the font cell size reported
diff --git a/src/player.rs b/src/player.rs
index c041106..8980205 100644
--- a/src/player.rs
+++ b/src/player.rs
@@ -113,6 +113,7 @@ pub fn header_capable_players() -> &'static [PlayerKind] {
}
}
+#[allow(clippy::too_many_arguments)]
pub fn command(
kind: PlayerKind,
url: &str,
@@ -121,6 +122,7 @@ pub fn command(
window: Option<(u32, u32)>,
resume_seconds: Option<u64>,
tracker: Option<(&str, &str, usize, usize)>,
+ max_height: Option<u64>,
) -> Command {
match kind {
PlayerKind::Mpv => mpv_command(
@@ -131,9 +133,18 @@ pub fn command(
window,
resume_seconds,
tracker,
+ max_height,
),
- PlayerKind::Iina => iina_command(url, subtitle, headers, window, resume_seconds, tracker),
- PlayerKind::Vlc => vlc_command(url, subtitle, headers, window, resume_seconds),
+ PlayerKind::Iina => iina_command(
+ url,
+ subtitle,
+ headers,
+ window,
+ resume_seconds,
+ tracker,
+ max_height,
+ ),
+ PlayerKind::Vlc => vlc_command(url, subtitle, headers, window, resume_seconds, max_height),
PlayerKind::AndroidIntent => android_intent_command(url, subtitle, headers),
}
}
@@ -384,6 +395,7 @@ fn android_intent_command(
})
}
+#[allow(clippy::too_many_arguments)]
fn mpv_command(
url: &str,
subtitle: Option<&str>,
@@ -392,6 +404,7 @@ fn mpv_command(
window: Option<(u32, u32)>,
resume_seconds: Option<u64>,
tracker: Option<(&str, &str, usize, usize)>,
+ max_height: Option<u64>,
) -> Command {
let fallback = if cfg!(target_os = "windows") {
"mpv.exe"
@@ -406,12 +419,17 @@ fn mpv_command(
command.arg(format!("{prefix}autofit={width}x{height}"));
}
command.arg(format!("{prefix}geometry=50%:50%"));
-
if !iina {
command.arg("--idle=no").arg("--keep-open=no");
}
- command.arg(format!("{prefix}ytdl-format=bestvideo+bestaudio/best"));
- command.arg(format!("{prefix}hls-bitrate=max"));
+ if let Some(height) = max_height.filter(|&h| h > 0) {
+ command.arg(format!(
+ "{prefix}ytdl-format=bestvideo[height<={height}]+bestaudio/best[height<={height}]/bestvideo+bestaudio/best"
+ ));
+ } else {
+ command.arg(format!("{prefix}ytdl-format=bestvideo+bestaudio/best"));
+ command.arg(format!("{prefix}hls-bitrate=max"));
+ }
if let Some(start) = resume_seconds {
if start > 0 {
command.arg(format!("{prefix}start={start}"));
@@ -540,6 +558,7 @@ fn iina_resolution() -> Option<IinaResolution> {
}
#[cfg(target_os = "macos")]
+#[allow(clippy::too_many_arguments)]
fn iina_command(
url: &str,
subtitle: Option<&str>,
@@ -547,6 +566,7 @@ fn iina_command(
window: Option<(u32, u32)>,
resume_seconds: Option<u64>,
tracker: Option<(&str, &str, usize, usize)>,
+ max_height: Option<u64>,
) -> Command {
let resolution = iina_resolution();
let mut command = match resolution {
@@ -562,7 +582,6 @@ fn iina_command(
}
None => Command::new("iina"),
};
-
let mpv = mpv_command(
url,
subtitle,
@@ -571,9 +590,13 @@ fn iina_command(
window,
resume_seconds,
tracker,
+ max_height,
);
for arg in mpv.get_args() {
- command.arg(arg);
+ let s = arg.to_string_lossy();
+ if !s.starts_with("--mpv-script") {
+ command.arg(arg);
+ }
}
command
}
@@ -589,6 +612,7 @@ pub fn iina_is_app_fallback() -> bool {
}
#[cfg(not(target_os = "macos"))]
+#[allow(clippy::too_many_arguments)]
fn iina_command(
url: &str,
subtitle: Option<&str>,
@@ -596,6 +620,7 @@ fn iina_command(
window: Option<(u32, u32)>,
resume_seconds: Option<u64>,
tracker: Option<(&str, &str, usize, usize)>,
+ max_height: Option<u64>,
) -> Command {
mpv_command(
url,
@@ -605,6 +630,7 @@ fn iina_command(
window,
resume_seconds,
tracker,
+ max_height,
)
}
@@ -614,6 +640,7 @@ fn vlc_command(
headers: &[(String, String)],
window: Option<(u32, u32)>,
resume_seconds: Option<u64>,
+ max_height: Option<u64>,
) -> Command {
let fallback = if cfg!(target_os = "windows") {
"vlc.exe"
@@ -630,6 +657,9 @@ fn vlc_command(
}
command.arg("--play-and-exit");
command.arg("--adaptive-logic=highest");
+ if let Some(height) = max_height.filter(|&h| h > 0) {
+ command.arg(format!("--adaptive-maxheight={height}"));
+ }
if let Some(start) = resume_seconds {
if start > 0 {
command.arg(format!("--start-time={start}"));
@@ -1476,6 +1506,7 @@ mod tests {
],
Some((1280, 720)),
Some(42),
+ None,
);
let args = command
.get_args()
@@ -1504,6 +1535,7 @@ mod tests {
&[],
None,
None,
+ None,
);
let args = command
.get_args()
@@ -1523,6 +1555,7 @@ mod tests {
&[],
None,
None,
+ None,
);
let args = command
.get_args()
@@ -1546,6 +1579,7 @@ mod tests {
None,
None,
None,
+ None,
);
let args = cmd
@@ -1630,6 +1664,7 @@ mod tests {
None,
None,
None,
+ None,
);
let args: Vec<String> = cmd
.get_args()
diff --git a/src/providers/addons/adapter.rs b/src/providers/addons/adapter.rs
index bbf8694..b45a4ba 100644
--- a/src/providers/addons/adapter.rs
+++ b/src/providers/addons/adapter.rs
@@ -622,6 +622,7 @@ pub fn release_to_playback_source(release: &Release) -> Option<PlaybackSource> {
headers: mirror.headers.clone(),
subtitle: None,
source_label: mirror.label.clone(),
+ max_height: None,
})
}
diff --git a/src/providers/fourkhdhub/client.rs b/src/providers/fourkhdhub/client.rs
index bc742bb..458e97f 100644
--- a/src/providers/fourkhdhub/client.rs
+++ b/src/providers/fourkhdhub/client.rs
@@ -188,6 +188,7 @@ impl FourKHdHubClient {
headers,
subtitle: None,
source_label: label,
+ max_height: None,
});
}
}
diff --git a/src/providers/models.rs b/src/providers/models.rs
index ed83961..b4988fb 100644
--- a/src/providers/models.rs
+++ b/src/providers/models.rs
@@ -292,6 +292,8 @@ pub struct PlaybackSource {
pub headers: Vec<(String, String)>,
pub subtitle: Option<String>,
pub source_label: String,
+ #[serde(default)]
+ pub max_height: Option<u64>,
}
impl PlaybackSource {
@@ -302,6 +304,7 @@ impl PlaybackSource {
headers: Vec::new(),
subtitle,
source_label: provider.label().to_string(),
+ max_height: None,
}
}
}
diff --git a/src/providers/moviebox/adapt.rs b/src/providers/moviebox/adapt.rs
index 4777232..fdf2a95 100644
--- a/src/providers/moviebox/adapt.rs
+++ b/src/providers/moviebox/adapt.rs
@@ -726,13 +726,6 @@ pub fn moviebox_play_info_json_to_releases(
continue;
};
- let is_dash = playable_url.ends_with(".mpd") || format_type.eq_ignore_ascii_case("DASH");
- let parsed_res_count = resolutions_str
- .split(',')
- .filter_map(|s| s.trim().parse::<u32>().ok())
- .count();
- let is_multi_res = is_dash || parsed_res_count > 1;
-
let mut headers = vec![
("Referer".to_string(), super::STREAM_REFERER.to_string()),
("User-Agent".to_string(), user_agent.to_string()),
@@ -747,49 +740,60 @@ pub fn moviebox_play_info_json_to_releases(
.join("; ");
headers.push(("Cookie".to_string(), clean_cookie));
}
-
- let max_res = resolutions_str
+ let mut parsed_resolutions = resolutions_str
.split(',')
.filter_map(|s| s.trim().parse::<u32>().ok())
- .max()
- .unwrap_or(1080);
+ .collect::<Vec<_>>();
+ parsed_resolutions.sort_unstable_by(|a, b| b.cmp(a));
+ parsed_resolutions.dedup();
- let quality = if is_multi_res {
- Some("multi".to_string())
+ let res_list = if parsed_resolutions.is_empty() {
+ vec![1080]
} else {
- Some(format!("{max_res}p"))
+ parsed_resolutions
};
+
let codec_disp = codec.as_deref().unwrap_or(format_type);
- let res_label = if is_multi_res {
- "Multi-Res".to_string()
- } else {
- format!("{max_res}p")
- };
- let filename = if season > 0 && episode > 0 {
- format!("{title_prefix} S{season:02}E{episode:02} {res_label} {codec_disp}")
- } else {
- format!("{title_prefix} {res_label} {codec_disp}")
- };
- let mirror = SourceMirror {
- label: format!("{res_label} {codec_disp}"),
- resolver_url: playable_url,
- headers,
- direct_file: true,
- };
+ let highest_res = res_list.first().copied().unwrap_or(1080) as f64;
- releases.push(Release {
- provider: ProviderKind::MovieBox,
- filename,
- quality,
- codec: codec.clone(),
- language: None,
- size_bytes,
- season: if season > 0 { Some(season) } else { None },
- episode: if episode > 0 { Some(episode) } else { None },
- mirrors: vec![mirror],
- resource_id: stream_id,
- });
+ for res in res_list {
+ let res_label = format!("{res}p");
+ let filename = if season > 0 && episode > 0 {
+ format!("{title_prefix} S{season:02}E{episode:02} {res_label} {codec_disp}")
+ } else {
+ format!("{title_prefix} {res_label} {codec_disp}")
+ };
+
+ let mirror = SourceMirror {
+ label: format!("{res_label} {codec_disp}"),
+ resolver_url: playable_url.clone(),
+ headers: headers.clone(),
+ direct_file: true,
+ };
+
+ let scaled_size = size_bytes.map(|total| {
+ if (res as f64) >= highest_res || highest_res <= 0.0 {
+ total
+ } else {
+ let scale = (res as f64 / highest_res).powf(1.6);
+ (total as f64 * scale.clamp(0.15, 1.0)) as u64
+ }
+ });
+
+ releases.push(Release {
+ provider: ProviderKind::MovieBox,
+ filename,
+ quality: Some(res_label),
+ codec: codec.clone(),
+ language: None,
+ size_bytes: scaled_size,
+ season: if season > 0 { Some(season) } else { None },
+ episode: if episode > 0 { Some(episode) } else { None },
+ mirrors: vec![mirror],
+ resource_id: stream_id.clone(),
+ });
+ }
}
releases
@@ -994,10 +998,13 @@ mod tests {
});
let releases = moviebox_play_info_json_to_releases(&payload, 0, 0, "TestAgent/1.0");
- assert_eq!(releases.len(), 1);
- assert_eq!(releases[0].quality.as_deref(), Some("multi"));
- assert!(releases[0].is_multi_resolution());
- assert_eq!(releases[0].resolution_i64(), -1);
+ assert_eq!(releases.len(), 3);
+ assert_eq!(releases[0].quality.as_deref(), Some("1080p"));
+ assert_eq!(releases[0].resolution_u64(), 1080);
+ assert_eq!(releases[1].quality.as_deref(), Some("720p"));
+ assert_eq!(releases[1].resolution_u64(), 720);
+ assert_eq!(releases[2].quality.as_deref(), Some("480p"));
+ assert_eq!(releases[2].resolution_u64(), 480);
assert_eq!(releases[0].codec.as_deref(), Some("hevc"));
assert_eq!(
releases[0].direct_url(),
@@ -1177,17 +1184,18 @@ mod tests {
});
let releases = moviebox_play_info_json_to_releases(&payload, 0, 0, "TestAgent/1.0");
- assert_eq!(releases.len(), 1);
+ assert_eq!(releases.len(), 3);
assert_eq!(
releases[0].direct_url(),
Some(
"https://sbcdn3.hakunaymatata.com/dash/3264772588333157424_0_0_1080_h265_560/index.mpd"
)
);
- assert_eq!(releases[0].quality.as_deref(), Some("multi"));
+ assert_eq!(releases[0].quality.as_deref(), Some("1080p"));
+ assert_eq!(releases[1].quality.as_deref(), Some("720p"));
+ assert_eq!(releases[2].quality.as_deref(), Some("480p"));
assert_eq!(releases[0].codec.as_deref(), Some("hevc"));
}
-
#[test]
fn test_notice_fallback_rejected_when_signed_policy_missing() {
let payload = json!({
diff --git a/src/tui/app/navigation.rs b/src/tui/app/navigation.rs
index a4860f4..1784365 100644
--- a/src/tui/app/navigation.rs
+++ b/src/tui/app/navigation.rs
@@ -763,6 +763,7 @@ impl App {
)],
subtitle: sub_url,
source_label: "Direct".to_string(),
+ max_height: None,
};
self.dispatch_playback_or_notify(source);
}
@@ -813,6 +814,7 @@ impl App {
headers: Vec::new(),
subtitle: None,
source_label: "Live TV".to_string(),
+ max_height: None,
};
self.dispatch_playback_or_notify(source);
return None;
@@ -898,6 +900,7 @@ impl App {
headers: Vec::new(),
subtitle: None,
source_label: "Live TV".to_string(),
+ max_height: None,
};
self.dispatch_playback_or_notify(source);
return;
diff --git a/src/tui/app/playback.rs b/src/tui/app/playback.rs
index 1dc47ba..d4ba63b 100644
--- a/src/tui/app/playback.rs
+++ b/src/tui/app/playback.rs
@@ -215,6 +215,7 @@ impl App {
link: String,
subtitle: Option<String>,
headers: Vec<(String, String)>,
+ max_height: Option<u64>,
) {
if !crate::tui::text::is_http_url(&link) {
self.state.is_playing = false;
@@ -427,6 +428,7 @@ impl App {
window,
resume_seconds,
tracker_ref,
+ max_height,
);
if kind == crate::tui::state::PlayerKind::Iina
&& crate::player::iina_is_app_fallback()
@@ -743,12 +745,14 @@ impl App {
"Preparing playback",
format!("Resolving {}...", first_mirror.label),
);
+ let max_height = Some(release.resolution_u64()).filter(|&h| h > 0);
let direct_source = crate::providers::models::PlaybackSource {
provider: release.provider,
url: first_mirror.resolver_url.clone(),
headers: first_mirror.headers.clone(),
subtitle: None,
source_label: first_mirror.label.clone(),
+ max_height,
};
let client = if release.provider == ProviderKind::Addons
|| release.provider == ProviderKind::Dramachi
@@ -823,12 +827,14 @@ impl App {
);
return None;
};
+ let max_height = Some(release.resolution_u64()).filter(|&h| h > 0);
let direct_source = crate::providers::models::PlaybackSource {
provider: release.provider,
url: first_mirror.resolver_url.clone(),
headers: first_mirror.headers.clone(),
subtitle: None,
source_label: first_mirror.label.clone(),
+ max_height,
};
let subject_id = self.state.active_subject_id.clone().unwrap_or_default();
let resource_id = self.get_selected_resource_id();
@@ -947,6 +953,7 @@ impl App {
)],
subtitle: None,
source_label: "Direct".to_string(),
+ max_height: None,
};
self.dispatch_playback_or_notify(source);
}
@@ -981,7 +988,13 @@ impl App {
);
return None;
}
- self.launch_player(kind, source.url, source.subtitle, source.headers);
+ self.launch_player(
+ kind,
+ source.url,
+ source.subtitle,
+ source.headers,
+ source.max_height,
+ );
}
Action::DispatchPlayback(source) => {
self.dispatch_playback_or_notify(source);
@@ -1303,6 +1316,7 @@ mod tests {
headers: vec![("Cookie".to_string(), "CloudFront-Policy=test".to_string())],
subtitle: None,
source_label: "Multi-Res".to_string(),
+ max_height: None,
};
assert_eq!(
@@ -1325,6 +1339,7 @@ mod tests {
headers: vec![("Cookie".to_string(), "CloudFront-Policy=test".to_string())],
subtitle: None,
source_label: "Multi-Res".to_string(),
+ max_height: None,
};
let resolution = app.resolve_playback_player(&source);
@@ -1353,6 +1368,7 @@ mod tests {
headers: vec![("Cookie".to_string(), "CloudFront-Policy=test".to_string())],
subtitle: None,
source_label: "Multi-Res".to_string(),
+ max_height: None,
};
let resolution = app.resolve_playback_player(&source);
@@ -1388,6 +1404,7 @@ mod tests {
headers: vec![],
subtitle: None,
source_label: "CircleFTP".to_string(),
+ max_height: None,
};
assert_eq!(
app.resolve_playback_player(&bdix_source),
@@ -1403,6 +1420,7 @@ mod tests {
],
subtitle: None,
source_label: "1080p".to_string(),
+ max_height: None,
};
assert_eq!(
app.resolve_playback_player(&fourk_source),
@@ -1415,6 +1433,7 @@ mod tests {
headers: vec![("Cookie".to_string(), "CloudFront-Policy=test".to_string())],
subtitle: None,
source_label: "Multi-Res".to_string(),
+ max_height: None,
};
assert_eq!(
app.resolve_playback_player(&auth_source),
diff --git a/src/tui/app/requests.rs b/src/tui/app/requests.rs
index 57ca93a..452a80b 100644
--- a/src/tui/app/requests.rs
+++ b/src/tui/app/requests.rs
@@ -1669,7 +1669,9 @@ impl App {
let same_url = if context.provider == ProviderKind::MovieBox {
let base_link = link.split('?').next().unwrap_or(link);
let i_base_link = i_link.split('?').next().unwrap_or(i_link);
- !base_link.is_empty() && base_link == i_base_link
+ !base_link.is_empty()
+ && base_link == i_base_link
+ && item.quality == i.quality
} else {
!link.is_empty() && link == i_link
};
diff --git a/tests/live_stream_verification.rs b/tests/live_stream_verification.rs
index 311cb17..d12d9ac 100644
--- a/tests/live_stream_verification.rs
+++ b/tests/live_stream_verification.rs
@@ -174,7 +174,7 @@ async fn test_inspect_live_mpd_manifest() {
xml
);
- for (target_label, height_constraint, expected_res) in [
+ for (target_label, _height_constraint, expected_res) in [
(
"1080p",
"bestvideo[height<=1080]+bestaudio/best",
@@ -191,11 +191,16 @@ async fn test_inspect_live_mpd_manifest() {
None,
None,
None,
+ Some(if target_label == "1080p" {
+ 1080
+ } else if target_label == "720p" {
+ 720
+ } else {
+ 480
+ }),
);
- cmd.arg("--vo=null")
- .arg("--ao=null")
- .arg("--frames=15")
- .arg(format!("--ytdl-format={height_constraint}"));
+ println!("Generated command: {:?}", cmd);
+ cmd.arg("--vo=null").arg("--ao=null").arg("--frames=15");
let output = cmd.output().expect("run mpv with quality format");
let out = String::from_utf8_lossy(&output.stdout);
@@ -239,6 +244,7 @@ async fn test_live_moviebox_mpv_end_to_end_playback() {
None,
None,
None,
+ None,
);
cmd.arg("--vo=null").arg("--ao=null").arg("--frames=20");
@@ -258,7 +264,42 @@ async fn test_live_moviebox_mpv_end_to_end_playback() {
"mpv should detect audio stream"
);
}
+#[tokio::test]
+#[ignore = "live network test; run with cargo test --test live_stream_verification -- --ignored"]
+async fn test_live_moviebox_iina_invocation() {
+ let client = MovieBoxClient::new();
+ client.init().await.expect("client init successful");
+ let releases = client
+ .episode_streams("4179386086617137184", 0, 0)
+ .await
+ .expect("fetch movie streams");
+ assert!(!releases.is_empty(), "releases should not be empty");
+
+ let release = &releases[0];
+ let mirror = &release.mirrors[0];
+
+ let cmd = moviebox_tui::player::command(
+ moviebox_tui::player::PlayerKind::Iina,
+ &mirror.resolver_url,
+ None,
+ &mirror.headers,
+ None,
+ None,
+ None,
+ Some(480),
+ );
+ let args: Vec<String> = cmd
+ .get_args()
+ .map(|a| a.to_string_lossy().into_owned())
+ .collect();
+ println!(
+ "IINA cmd program: {:?}, args: {:?}",
+ cmd.get_program(),
+ args
+ );
+ assert!(args.iter().any(|a| a.contains("height<=480")));
+}
#[tokio::test]
#[ignore = "live network test; run with cargo test --test live_stream_verification -- --ignored"]
async fn test_live_moviebox_dynamic_movie_mpv_playback() {
@@ -297,6 +338,7 @@ async fn test_live_moviebox_dynamic_movie_mpv_playback() {
None,
None,
None,
+ None,
);
cmd.arg("--vo=null").arg("--ao=null").arg("--frames=20");