`resolveVideoSource` chose between a local file and a remote URL for video playback. Backend-owned stream selection took that decision into Rust — `media_local_selection` for a downloaded file, `get_stream_selection` for a streamed one — and its last caller went with it. What remained was the function plus sixty lines of tests exercising nothing that ships. `fittedVideoSize` computed the rendered size of a video letterboxed into its container. Nothing has ever called it: it arrived with the fix that made the video fill its viewport and was superseded by `object-fit: contain` in the same change. There is some irony in a helper that models letterboxing sitting unused beside a container that was not letterboxing at all — the bug fixed in the previous commit was CSS, and this function would not have helped. A survey for exported symbols referenced only by their own tests finds 22 more. Most are legitimate — test mocks, deliberate reset hooks, public utility APIs — and the rest are unrelated to this work, so they are left for a cleanup that can be reviewed on its own terms rather than smuggled into a playback branch. Also records in the spec why DR-231's design changed. Reparenting Tauri's webview into a GtkOverlay aborts the process on the first click: Linux calls `attach_resize_handler` unconditionally (the Windows path guards it with `is_decorated()`), and its handler walks webview -> GtkBox -> GtkWindow with an unwrap that an overlay breaks. So the webview is not moved at all — mpv draws into the default vbox's own `draw` handler via `gdk_cairo_draw_from_gl()`, and GTK's container-before-children order puts the webview on top for free. No reparent, one less widget, and nothing a Tauri upgrade can invalidate by assuming its own layout.
18 lines
723 B
TypeScript
18 lines
723 B
TypeScript
// Sizing rules for the HTML5 <video> element in the full-screen player.
|
|
// Extracted from VideoPlayer.svelte so the fit behaviour is unit-testable.
|
|
|
|
/**
|
|
* Classes applied to the <video> element so it fits the player viewport.
|
|
*
|
|
* TRACES: UR-005
|
|
*
|
|
* `max-w-full max-h-full` only ever *shrinks* oversized media, so a source
|
|
* smaller than the window (e.g. 480p on a 1080p display) rendered at its
|
|
* intrinsic size - a small box in the middle of a black screen. Filling the
|
|
* container and letting `object-contain` do the scaling fits the picture to
|
|
* whichever axis constrains it, in both directions, preserving aspect ratio.
|
|
*/
|
|
export function videoFitClass(): string {
|
|
return "w-full h-full object-contain";
|
|
}
|