npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sanity-plugin-video-posters

v0.1.0

Published

Generates poster images for Sanity video file fields, in the browser.

Readme

🎥 sanity-plugin-video-posters 🖼️

A Sanity Studio (v5/v6) plugin that fills an image field with a poster frame taken from a sibling video file field. Everything happens in the browser: the Studio loads the video, grabs a frame onto a canvas, encodes it and uploads it as an image asset. There is no Sanity Function, Blueprint or FFMPEG binary to deploy.

Install

npm install sanity-plugin-video-posters
// sanity.config.ts
import {defineConfig} from 'sanity'
import {videoPosters} from 'sanity-plugin-video-posters'

export default defineConfig({
  // ...
  plugins: [
    videoPosters({ 
      mode: 'automatic', 
      format: 'webp', 
      offset: 0, 
      maxWidth: 1200, 
      quality: 0.85
    })
  ],
})

Schema

Declare the relationship on the poster field, naming the sibling video field. This works at any nesting depth, including inside array items.

defineField({
  name: 'video', 
  type: 'file', 
  options: {
    accept: 'video/*'
  }
}),

defineField({
  name: 'poster',
  type: 'image',
  options: {
    videoPoster: {
      videoField: 'video'
      /* , mode, format, offset, quality */
    }
  },
}),

Options

Set them on the plugin for defaults, or on options.videoPoster per field (field wins).

| Option | Default | Description | | --- | --- | --- | | videoField | (required, field only) | Name of the sibling file field holding the video. | | mode | 'automatic' | 'automatic' generates when the video file changes; 'manual' only generates via the button. | | format | 'webp' | 'webp', 'jpeg' or 'png'. WebP falls back to JPEG in browsers that can't encode it. | | offset | 0 | Seconds into the video for the frame. Clamped to the video's duration. | | maxWidth | 1200 | Maximum poster width in pixels. Larger frames are scaled down (aspect ratio kept), smaller ones are never enlarged. -1 keeps the video's own resolution. | | quality | 0.85 | Encoder quality, 0–1. Ignored for PNG. |

A Generate poster / Regenerate poster button appears next to the field in both modes.

Behavior

  • Automatic mode runs when the video is added or replaced during the editing session, and replaces any existing poster. It never runs when a document is first opened, on read-only fields, or while another generation is running.
  • Replaced posters are not deleted; the old image asset stays in the dataset until you clean it up.

Limits

  • Only videos added through the Studio form get posters. Videos uploaded through the API or the Media Library do not.
  • Only codecs the browser can decode work (for example HEVC .mov files often fail outside Safari). Failures show an error toast and the form stays usable.
  • The Studio origin must be allowed by the project's CORS settings, which it will be for any working Studio. If the CDN refuses a direct read, the plugin downloads the file and reads the frame from that copy.

License

MIT