# Experimental Media Domain

Optional media experiments live here so they can be removed without disturbing the attachment transfer domain or chat rendering.

## VLC.js Playback

The VLC.js player is off by default and is only offered for audio/video attachments that do not use the native Chromium player path. Chat does not instantiate VLC.js while scrolling; the runtime is loaded only after the user chooses the experimental player on a downloaded attachment.

The app does not bundle VideoLAN's proof-of-concept build directly. Instead, `ExperimentalVlcRuntimeService` loads this browser adapter script:

```text
/vlcjs/metoyou-vlc-player.js
```

That script must register this adapter on `window`:

```ts
window.MetoYouVlcJs = {
  createPlayer({ container, sourceUrl, filename, mime }) {
    // Mount VLC.js/WebAssembly UI into container and return an optional cleanup handle.
    return { destroy() {} };
  }
};
```

The repository includes a small placeholder at `toju-app/public/vlcjs/metoyou-vlc-player.js` so dev/prod servers return JavaScript instead of the Angular HTML fallback. The placeholder sets `isPlaceholder: true`; the settings toggle stays disabled and chat does not show the experimental Play action while only the placeholder is present. To enable real playback, replace that file with an adapter that mounts the chosen VLC.js/WebAssembly runtime, removes `isPlaceholder`, and returns an optional cleanup handle.

On Electron, downloaded file-backed attachments also expose an Open action in the generic file interface. Use that for MKV/AVI or other unsupported formats until a real VLC.js adapter is bundled; Electron opens the saved file with the operating system's default player.

## Removal

To remove the experiment later:

1. Delete this domain folder.
2. Remove `ExperimentalMediaSettingsService` and `ExperimentalVlcPlayerComponent` imports/usages from the chat message item and general settings.
3. Delete any bundled `public/vlcjs/` runtime files.

The attachment transport, persistence, and default file UI do not depend on this runtime.
