Skip to main content

VideoRenderer

Struct VideoRenderer 

Source
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:

  1. type= would go stale. The downstream rewriter src-tauri/src/build/media/placeholder.rs::add_video_placeholder_attributes rewrites the src extension from .mov to .mp4 after the renderer runs (moss converts .mov source files to .mp4 during build, so a raw .mov reference would 404). Any explicit type="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.

  2. 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→.mp4 rewrite + data-placeholder-src

    • poster + data-thumb-src injection 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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl EmbedRenderer for VideoRenderer

Source§

fn extensions(&self) -> &[&'static str]

Extensions this renderer claims (lowercase, without leading dot).
Source§

fn render(&self, embed: &ParsedEmbed<'_>) -> RenderedEmbed

Render the embed. Must be pure; moss-core is I/O-free.
Source§

fn head_assets(&self) -> &[&'static str]

Page-level HTML fragments this renderer needs in <head>, injected once per page that contains at least one embed from this renderer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.