Web source: fix rendering — fixed 1920×1080 viewport (OBS pattern), Stretch=Uniform, startup registration

This commit is contained in:
2026-08-28 10:23:59 -07:00
parent fd6e02b687
commit e917c41a48
6 changed files with 88 additions and 207 deletions
+15 -9
View File
@@ -905,18 +905,24 @@ capturing the primary display (which causes the infinity mirror effect).
**Goal:** make the web source actually render URLs into the preview and stream output.
### Status: ☐ Not started — required for v1
### Status: ✅ Done — required for v1 (2026-08-28)
1. ☐ Add `Microsoft.Web.WebView2` NuGet package
2. ☐ Schema v10: `WebUri TEXT` column on `Source` table + migration in `LayoutStore.cs`
3. ☐ Persist `Source.WebUri` on save/load (currently in-memory only — lost on restart)
4. ☐ Hidden `WebView2` control per web source — navigates to `WebUri`, renders in-app
5. ☐ Frame capture from WebView2 (`CoreWebView2.CapturePreviewAsync` or `CompositionSurface`) → `VideoFrame` (BGRA8)
6. ☐ Wire into `FramePump` resolver — `Source { Type: WebSource }` → latest WebView2 frame
7. ☐ Wire into `SceneCompositor` — render web source as an image element at its position/size
8. ☐ Preview shows live web content (not just a blank rectangle)
1. ✅ Add `Microsoft.Web.WebView2` NuGet package
2. ✅ Schema v10: `WebUri TEXT` column on `Source` table + migration in `LayoutStore.cs`
3. ✅ Persist `Source.WebUri` on save/load (currently in-memory only — lost on restart)
4. ✅ Hidden off-screen `WebView2` control per web source — navigates to `WebUri`, renders in-app
5. ✅ Frame capture from WebView2 (`CoreWebView2.CapturePreviewAsync`) → `WriteableBitmap` (BGRA8)
6. ✅ Wire into `FramePump` resolver — `Source { Type: WebSource }` → latest WebView2 frame
7. ✅ Wire into `SceneCompositor` — render web source as an image element at its position/size
8. ✅ Preview shows live web content (not just a blank rectangle)
9. ☐ Handle navigation errors, invalid URIs, timeout gracefully
**Rendering model (2026-08-28, the fix that works):** WebView2 viewport is FIXED at the master
canvas size (1920×1080) in `Register`, never tracking the element box — the OBS/CEF pattern
(fixed render viewport, display box scaled independently via `Stretch="Uniform"`). Capturing the
box-sized viewport was the truncation bug. Display `Stretch`: web → `Uniform` (no crop),
everything else → `UniformToFill`. Graceful-error handling (item 9) is a follow-up.
### Design decisions
- WebView2 is the only option for Windows — it's pre-installed on Windows 10 20H2+ and Windows 11