Skip to content

Fix media player file path resolution#412

Merged
srperens merged 10 commits intomainfrom
fix/mediaplayer
Mar 9, 2026
Merged

Fix media player file path resolution#412
srperens merged 10 commits intomainfrom
fix/mediaplayer

Conversation

@srperens
Copy link
Collaborator

@srperens srperens commented Mar 6, 2026

Summary

  • Media player was looking for files at ./media/ but the configured media path is strom-data/media (controlled by data_dir in .strom.toml)
  • Frontend hardcoded ./media/ prefix when storing playlist file paths
  • Backend normalize_uri() joined with cwd, producing the wrong absolute path

Changes

  • Backend: expand_blocks now injects _media_path as a block property (like _flow_id), passed from PipelineManager::newstate.rs
  • Backend: MediaPlayerState stores media_path; normalize_uri() resolves relative paths against it instead of cwd
  • Backend: Legacy ./media/ prefix in stored paths is stripped for backward compatibility
  • Frontend: Playlist editor now stores paths relative to media root (e.g., recordings/file.mkv) instead of prepending ./media/

Test plan

  • Start server with data_dir = ./strom-data in .strom.toml
  • Add a media player block to a flow
  • Double-click to open playlist editor, add files from browser
  • Start the flow — files should be found and played without "No such file" errors
  • Verify paths shown in playlist editor are relative to media root

🤖 Generated with Claude Code

Per Enstedt and others added 10 commits March 6, 2026 17:30
Previously, the frontend hardcoded ./media/ as the path prefix when
adding files to the playlist. With data_dir = ./strom-data in .strom.toml,
the actual media path is strom-data/media, causing "No such file" errors.

- Inject _media_path into block properties via expand_blocks (like _flow_id)
- Pass media_path through PipelineManager::new to expand_blocks
- Add media_path field to MediaPlayerState; use it in normalize_uri()
- normalize_uri() resolves relative paths against media_path and
  handles legacy ./media/ prefixed paths for backward compatibility
- Frontend: store playlist paths relative to media root (no ./media/ prefix)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Canonicalize media_path before injecting as _media_path in expand_blocks,
  ensuring blocks always receive an absolute path regardless of whether the
  config uses a relative path (e.g. ./strom-data/media)
- Fix playlist editor browser path display: show media/ instead of ./media/
  since the ./media prefix was an incorrect assumption about server layout
- Replace deprecated child_ui() with new_child() in playlist editor layout

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Truncate long filenames in playlist with hover tooltip for full path
- Use phosphor icons for move up/down buttons
- Improve divider dragging to track pointer position
- Fix right pane background fill
- Minor layout and spacing improvements

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace equal columns with resizable split pane (draggable divider)
- Left pane (file browser) has fixed pixel width, right pane expands freely
- Fix separator direction by using explicit top_down layout in each pane
- Truncate filename in compact media player widget with hover tooltip
- Double-click on media player node opens playlist editor
- Replace text buttons with phosphor icons: ARROW_UP/DOWN, FLOPPY_DISK, TRASH, PLAY
- Remove block ID label from playlist editor header

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…loop

- Rename PlaylistEditor::browser_width_fraction to browser_width_px (field
  stored pixels, not a fraction; default 350.0 made no sense as a fraction)
- Move media_path canonicalize() call out of the per-block loop in
  expand_blocks() so it runs once instead of once per block

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lict

Both branches added media_path to expand_blocks. Our branch used
&std::path::Path at position 4; main used PathBuf as the last argument.
Kept our version (borrow, position 4, canonicalized in-function) and
removed the duplicate parameter from construction.rs call site.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ScrollArea without max_height expanded indefinitely, causing the
window to grow instead of scrolling. Set max_height to
ui.available_height() so the scroll area stays within the pane.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
with_layout(top_down) creates a child UI with infinite available_height,
so ui.available_height() inside show_browser_panel returned infinity.
Pass pane_height from the window show closure directly as max_height
for the ScrollArea instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ck loop

The egui Window Resize container does desired_size = desired_size.max(last_content_size)
each frame. Any layout where child sizes are derived from the window creates a
feedback loop. StripBuilder breaks this because "strip cells do not grow with children".

- Use egui_extras::StripBuilder with clip(true) for the two-column layout
- clip(true) prevents content overflow from affecting the Resize container
  in both vertical and horizontal directions
- Add .vscroll(false).hscroll(false) on the Window to prevent its internal
  ScrollArea from interfering
- Move trailing content (hint labels, action buttons) BEFORE scroll areas
  so nothing overflows the fixed-height strip cells
- Use max_height(ui.available_height()) on scroll areas — stable inside
  StripBuilder cells since cell height is fixed
- Draggable divider rendered via ui.interact() inside its own strip cell

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add auto_shrink(false) so the scrollbar sits at the pane edge
near the divider, not where the file names end.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@srperens srperens merged commit 7f22233 into main Mar 9, 2026
6 checks passed
@srperens srperens deleted the fix/mediaplayer branch March 9, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant