Skip to content

Avalonia GUI in the browser (WebAssembly) - #14

Merged
simonebortolin merged 4 commits into
masterfrom
ccr-avalonia-browser
Nov 14, 2026
Merged

simonebortolin merged 4 commits into
masterfrom
ccr-avalonia-browser

Conversation

@simonebortolin

@simonebortolin simonebortolin commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Adds the Avalonia GUI in the browser, built on MediaInfoLib compiled for browser-wasm and the net10.0-browser TFM from #13 (already merged).

What it does

New project SharpMediaInfo.GUI.Avalonia.Browser (net10.0-browser, Avalonia.Browser): the same Avalonia GUI, running entirely in the browser as a static site. Files are analysed locally, in chunks: nothing is uploaded.

Published on GitHub Pages at every push to master: https://simonebortolin.github.io/SharpMediaInfo/. This needs a one-time setting: Settings → Pages → Source: GitHub Actions.

Architecture

  • Shared views and view models: linked from SharpMediaInfo.GUI.Avalonia, hosted in a single-view lifetime (MainView). AvaloniaClipboardService now also works without a desktop window.
  • BrowserFileRegistry: maps the IStorageFile objects from the picker or drag & drop to pseudo-paths, so the existing services keep working with paths.
  • SeekableBlobStream: BlobReadableStream (Avalonia.Browser) reads through Blob.slice and supports Seek(x, Begin), but it declares CanSeek = false. The wrapper tracks the position itself, and MediaInfo reads only the chunks it needs (it was tested with a moov atom at the end of the file).
  • Configuration goes in localStorage. Exports use the save picker where it exists, otherwise they are downloaded.
  • TrimmerRootAssembly for CascadiaUI and MsBox.Avalonia: without it, trimming removes their precompiled XAML.

Bug fix: decimal values and culture

MediaInfoBuilder converted decimals with Replace(".", ",") plus the current culture. On en-US this produced values 1000× too large (25.000 fps → 25000). Decimals are now parsed with CultureInfo.InvariantCulture. The new test DecimalValues_AreParsedIndependentlyOfCurrentCulture covers en-US, it-IT and invariant; it fails without the fix.

CI / tooling

  • test-wasm publishes the browser GUI, checks that dotnet.native.*.wasm contains MediaInfo, and uploads the static site as the SharpMediaInfo-web artifact.
  • New pages job (master only, after test and test-wasm): deploys that artifact with upload-pages-artifact / deploy-pages. All paths are relative, so the site works under /SharpMediaInfo/. It was verified in Chromium, served under that subpath, with no errors. COOP/COEP headers are not needed.
  • SharpMediaInfo.GUI.Avalonia.Browser/run.sh: publishes and serves locally on 127.0.0.1:8080.
  • README: project table row and a "The GUI in the browser" section with the link.
  • The project is not in SharpMediaInfo.slnx (same as SharpMediaInfo.Wasm.Smoke), so opening the solution does not require the wasm workload.

Testing

  • SharpMediaInfo.Tests 68/68, GUI.Tests 203/203, Native.Tests 15/15.
  • Chromium (Playwright):
    • the app loads;
    • analysis via the native showOpenFilePicker and via the <input> fallback;
    • the Standard Report has correct values and is aligned (CascadiaUI bundles a monospaced font);
    • the MsBox error dialog works;
    • the app loads under the /SharpMediaInfo/ subpath.

Known limitations

  • Drag & drop and exports/downloads have not been tested automatically (synthetic DragEvents do not reach Avalonia).
  • No recent files, shell integration or "open folder".

🤖 Generated with Claude Code

https://claude.ai/code/session_01SyVioAMhEw3uuqBekTJcn2

@simonebortolin
simonebortolin added this pull request to stack #15 November 14, 2026 14:13
Base automatically changed from ccr-5c8d7d65-2wuyn3 to master November 14, 2026 14:15
GetDoubleValue replaced '.' with ',' and parsed with the current culture, which only
works where ',' is the decimal separator: on en-US (and in the browser, and on the
invariant culture) "25.000" became 25000, so frame rates, aspect ratios and stream
size proportions were 1000x off. MediaInfo always emits '.', so parse it invariantly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioAMhEw3uuqBekTJcn2
SharpMediaInfo.GUI.Avalonia.Browser runs the Avalonia app on the .NET WebAssembly
runtime with MediaInfoLib linked into dotnet.native.wasm. Views, controls and
converters are the desktop app's, compiled in as linked files; only startup, a
single-view MainView and the services that touch files, settings and the browser
are new:

- files picked or dropped are kept as IStorageFile behind pseudo paths, so the
  shared view models are unchanged, and read in chunks through Blob.slice
  (SeekableBlobStream exposes the seeking Avalonia's stream supports but does not
  advertise), so large videos are never loaded whole and nothing is uploaded;
- settings in localStorage; exports through the save picker or a download;
- no recent files, shell integration or "open containing folder".

The clipboard service also works with a single-view lifetime. CI publishes the
site, checks MediaInfoLib was linked and uploads it as the SharpMediaInfo-web
artifact; run.sh publishes and serves it locally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioAMhEw3uuqBekTJcn2
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Pre-release 26.10.3-pr.14.55 is ready: https://github.com/simonebortolin/SharpMediaInfo/releases/tag/pr-14-55-1

Windows, Linux and macOS desktop builds and NuGet packages of 2ea8b17. Updated on every push, deleted when this PR is closed.

Releases the browser GUI and the culture-independent decimal parsing fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SyVioAMhEw3uuqBekTJcn2
@simonebortolin
simonebortolin merged commit 944b873 into master Nov 14, 2026
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.

2 participants