From 77d7208bfa875ea90baef47f5b36b22fdf29c3de Mon Sep 17 00:00:00 2001 From: gramps Date: Thu, 5 Nov 2026 07:17:43 -0800 Subject: [PATCH] feat(media): add a video file layer that decodes into the scene MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TASK 21's picker slice: the decoder, manager, pacing and loop mechanism were already shipped but nothing ever acquired a session, so a media Source rendered nothing. Adds "Video File" to the (+) menu (video-filtered OpenFileDialog), one decode session per distinct path with a HasSession guard, release when the last scene reference goes, and a post-load reconcile. Loop is a manager-level per-path answer ("any live reference loops") applied before StartAsync and updated live via SetLooping. Properties panel shows the file with Change… and Loop. Volume stays unwired: media audio rides the desktop loopback, TRAX-style. Reference: OBS's media source (file → decode → composite into the scene) is the established answer for this feature; the lifecycle shape mirrors this repo's WebView2/ScreenCapture registration rather than inventing a new one. Test: ytLive.Tests/MediaSourceAcquisitionTests.cs — add starts one decoder and frames reach the layer, loop flip reaches the decoder, remove stops it. Docs: task-21 closed, TASKS row + Day-4 row + stale 3·17 row corrected, frame-pipeline acquisition note, HANDOFF rewritten. verify.sh green. --- Controls/LeftPanel.xaml | 25 ++++ HANDOFF.md | 21 +-- Models/Source.cs | 10 +- Services/MediaVideoSourceManager.cs | 37 ++++- TASKS.md | 14 +- TASKS/task-21-media-source.md | 62 ++++----- ViewModels/MainViewModel.Media.cs | 146 +++++++++++++++++++- ViewModels/MainViewModel.Sources.cs | 29 +++- ViewModels/MainViewModel.cs | 19 ++- docs/ai/frame-pipeline.md | 11 ++ ytLive.Tests/MediaSourceAcquisitionTests.cs | 123 +++++++++++++++++ 11 files changed, 429 insertions(+), 68 deletions(-) create mode 100644 ytLive.Tests/MediaSourceAcquisitionTests.cs diff --git a/Controls/LeftPanel.xaml b/Controls/LeftPanel.xaml index 57311cc..9ecfed0 100644 --- a/Controls/LeftPanel.xaml +++ b/Controls/LeftPanel.xaml @@ -70,6 +70,8 @@ IsEnabled="{Binding CanAddWebcam}" ToolTip="{Binding WebcamAddToolTip}"/> + + + + + + + + + + +