bearnie

Video

A lazy video embed for YouTube and Vimeo — the player only loads when clicked.

Installation

npx bearnie add video
npx bearnie add video

Usage

import { Video } from "@/components/bearnie/video"
<Video src="https://www.youtube.com/watch?v=..." title="Product demo" />

A plain YouTube iframe loads roughly a megabyte of player JavaScript before anyone presses play. Video renders just a thumbnail and a play button instead; the iframe (via the cookie-free youtube-nocookie.com domain) is created only on click and starts playing immediately. Accepts YouTube watch/share/shorts/embed URLs, bare YouTube video ids, and Vimeo URLs.

Examples

Vimeo

YouTube thumbnails are resolved automatically. Vimeo has no public thumbnail URL scheme, so pass your own poster (without one, the facade is a plain surface with a play button).

Custom aspect ratio

The default is aspect-video (16:9); override it with a class.

Props

Prop Type Default Description
src string required YouTube/Vimeo URL or bare YouTube video id
title string required Accessible name; also the iframe title
poster string YouTube thumbnail Thumbnail image shown before load
class string - Additional CSS classes