Expand description
Video embed synthesizer.
Receives a TitleParams (Stage 2 dispatcher already parsed it), the
source URL, and an AssetSnapshot. Emits final <video> HTML at the
typed-data boundary — including every attribute the legacy
add_video_placeholder_attributes regex used to inject.
§Authoritative byte shape (Phase 2E parity)
<video class="moss-embed moss-embed-video" src="URL.mp4"
data-placeholder-src="URL.original" poster="URL.thumb.jpg"
data-thumb-src="URL.thumb.jpg" controls preload="metadata"
{ width="W"}?{ height="H"}?></video>- Single
src=attribute on<video>(no nested<source>child) — load-bearing for the survivingadd_video_placeholder_attributesregex pass (preserved until PR3 of Phase 2E). The regex’s skip guard atplaceholder.rs:435triggers ondata-placeholder-src, making the post-pass a no-op for synthesizer-emitted videos. Source: moss-core pre-Phase-0VideoRendereratcrates/moss-core/src/resolve/embed_renderer.rs:509-571(commitefb834a3e). controls preload="metadata"emitted on the default branch. The ambient loop branch (![[clip.mp4|loop]]) instead emitsautoplay muted loop playsinline preload="metadata"with nocontrolsand addsdata-loopfor JS/CSS targeting. SeeAMBIENT_PLAYBACK_ATTRS.- Width/height priority: (1)
TitleParams|WxHsizing alias wins when present (with units like640px). (2)AssetSnapshot.dimensionslookup as fallback, emitted unitless (e.g.width="1920"). (3) Both attributes omitted when the snapshot dims are(0, 0)— that is the sentinel for “unknown,” NOT a real dimension. Both omitted when no entry is in the snapshot. data-placeholder-srcis the ORIGINAL src (e.g.clip.mov). The iframe-bridge swapssrcto the.mp4payload once the transcode completes (frontend/bridge/iframe-bridge.ts:666).posteranddata-thumb-srcboth referenceto_thumb(original_src). The iframe-bridge listens formoss-thumb-readyand swapsposterin when the thumbnail lands.
§.mov → .mp4 source-extension swap (moved from placeholder.rs)
moss converts .mov source files to .mp4 during build, so a raw
.mov reference in the rendered HTML would 404. Pre-Phase-0 this swap
lived in placeholder.rs::add_video_placeholder_attributes as a regex
post-pass. Phase 1’s typed-data-boundary architecture moves it here:
the synthesizer is the single source of truth for the URL that ends up
in <video src=>.
§Multi-source HLS form (NOT emitted here)
This synthesizer never emits <video><source src=…></video> (multi-
source / adaptive-bitrate form). That shape is reserved for HLS / DASH
streams that don’t need transcode-pending hydration. The regex pass
also skips it (video_re requires src="…" directly on <video>),
and the data-placeholder-src / poster / data-thumb-src injection
only applies to the single-src form by design. If a future callsite
wants the multi-source form, it must NOT route through this
synthesizer.
Constants§
- AMBIENT_
PLAYBACK_ ATTRS - Core playback attributes shared by the ambient loop branch and cover.rs.
Functions§
- synthesize_
video_ html - Synthesize video embed HTML for
Tag::Linkwithmoss:kind=videotitle.