pub struct VideoRenderer;Expand description
Renderer for video embeds: ![[clip.mp4]] → <video src="..." controls>.
|WxH becomes width/height attrs. preload=metadata so the browser
fetches duration/dimensions but not the full payload until play.
Output form: single src= attribute on <video> (no <source> child),
no type= attribute. Two coupled reasons:
-
type=would go stale. The downstream rewritersrc-tauri/src/build/media/placeholder.rs::add_video_placeholder_attributesrewrites thesrcextension from.movto.mp4after the renderer runs (moss converts.movsource files to.mp4during build, so a raw.movreference would 404). Any explicittype="video/quicktime"emitted here would survive the rewrite as a lie. Browser sniffing from the rewritten URL extension is more reliable than a stale type hint. -
The rewriter regex requires single-
src=form. It matches<video\s+[^>]*?src="...">—src=must be on the<video>tag itself, not on a nested<source>child. With nested<source>, the regex no-ops and the.mov→.mp4rewrite +data-placeholder-srcposter+data-thumb-srcinjection all silently drop. This constraint is load-bearing; see #592 for an integration test that pins it across the cross-crate boundary, and #593 for the audio asymmetry. This shape also matches the historical moss output that liu-guo.com still ships.
Note: .mov is codec-dependent at the source. Safari plays QuickTime
natively; Chrome/Firefox accept the MIME but decode only if the
container’s video codec is supported (usually H.264). The .mov→.mp4
rewriter solves this in practice — served files end as .mp4.
Trait Implementations§
Source§impl Debug for VideoRenderer
impl Debug for VideoRenderer
Source§impl EmbedRenderer for VideoRenderer
impl EmbedRenderer for VideoRenderer
Source§fn extensions(&self) -> &[&'static str]
fn extensions(&self) -> &[&'static str]
Source§fn render(&self, embed: &ParsedEmbed<'_>) -> RenderedEmbed
fn render(&self, embed: &ParsedEmbed<'_>) -> RenderedEmbed
Source§fn head_assets(&self) -> &[&'static str]
fn head_assets(&self) -> &[&'static str]
<head>, injected
once per page that contains at least one embed from this renderer. Read more