konstantin-paulus 1539ded67a Add image source handling and readiness mechanism to HtmlHost
Implemented a new `whenReady` method in the HtmlHost class to ensure all images in its subtree are decoded before rendering updates. Updated the playback system to utilize this method for improved rendering reliability. Enhanced the WorldDocument class to manage image sources more effectively, including support for various input types and object URL management. Updated documentation to reflect changes in image handling and source resolution.
2026-07-31 16:01:25 +02:00

1.1 KiB

Media source resolution

src (on <video>, <image>, <audio>, and the DOM <img> inside <html>) accepts:

  • Global path: e.g. "/Movies/video.mp4", resolved against the user's OS.
  • Remote URL: e.g. "https://my.videoarchive.com/audio/clip.wav", registered as a remote asset.
  • Asset id: e.g. "gbHJ", an imported asset (discover ids with dapi asset ls or dapi asset tree).
  • AssetRef: the value returned by a generate.* declaration (see generate.md). The node is inserted immediately as a placeholder and its paint is attached once the asset has generated.

In dapi node patch, src takes a path, URL, or asset id; generate.* declarations are JSX-only.

An <img> additionally takes a data: or blob: URL, which goes to the browser as it is.

To read a source's raw bytes inside an effect (rather than mount it as a node), pass the same input to useFile, which resolves it to a File.