Adds a videos collection to Payload that uploads files directly from the browser to Cloudflare Stream, Mux or Bunny Stream. It provides admin tools for processing status, posters, captions and audio tracks, plus React components for rendering with the provider's player or your own. Requires Payload 3.94+ or 4 beta and an account with one of the providers.
Video streaming for Payload CMS (v3 and v4) with Cloudflare Stream, Mux and Bunny Stream: direct uploads, signed playback, webhooks, captions, blocks and bring-your-own player.
Installation
npm i payload-video-streaming0
Stars
0
Forks
4
Open Issues
Today
Last Updated
961
Weekly Downloads
v0.6.1
npm Version
1.0 MB
Unpacked Size
2
Dependencies
00 since Nov 29
| Date | Stars |
|---|---|
| Dec 6, 2026 | 0 |
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
Trends appear after 7 days of data. Collecting since Dec 3 — 4 daily snapshots so far.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1479156892-root)<a href="https://payloaddirectory.dev/plugins/1479156892-root"><img src="https://payloaddirectory.dev/badge/1479156892-root.svg" alt="Payload Directory"></a>README
Video for Payload CMS, from upload to playback.
Upload straight to Cloudflare Stream, Mux or Bunny Stream, follow encoding in the admin,
and play videos on your site with any player. One plugin for Payload 3 and 4.
Quick start • Providers • Features • Docs • Examples • Changelog
videos collection, any provider. Cloudflare Stream, Mux and Bunny Stream behind the same fields, admin and API. Configure one or several.fetch: no SDKs at runtime. A built-in fake provider lets you build and test without an account.Coming from
payload-cf-stream? This is its successor. See Migrating from payload-cf-stream.
You need Payload ^3.94.0 or ^4.0.0-beta.12 and an account with one of the providers.
npm install payload-video-streaming
This uses Cloudflare Stream; Mux and Bunny work the same way.
// payload.config.ts
import { buildConfig } from 'payload'
import { videoField, videoPlugin } from 'payload-video-streaming'
import { cloudflareStream } from 'payload-video-streaming/cloudflare'
export default buildConfig({
collections: [
{ slug: 'posts', fields: [{ name: 'title', type: 'text' }, videoField({ name: 'heroVideo' })] },
],
plugins: [
videoPlugin({
providers: [
cloudflareStream({
accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
apiToken: process.env.CLOUDFLARE_STREAM_API_TOKEN!,
}),
],
}),
],
})
Prefer environment variables? videoPlugin(videoOptionsFromEnv()) configures every provider it finds (variables).
So Payload finds the plugin's components:
npx payload generate:importmap
Upload a video under Videos in the admin. It updates on its own while the provider processes it.
import { Video } from 'payload-video-streaming/react'
const post = await payload.findByID({ collection: 'posts', id, depth: 1 })
<Video video={post.heroVideo} /> // the provider's player, or pass player={YourPlayer}
Anyone who can read the post can watch its video, even though the videos collection itself is only readable by logged-in users by default (who can watch).
| Provider | Setup | Import |
|---|---|---|
| Cloudflare Stream | Account ID and an API token with Stream · Edit (guide) | cloudflareStream() from payload-video-streaming/cloudflare |
| Mux | An access token with Mux Video: Read and Write (guide) | muxVideo() from payload-video-streaming/mux |
| Bunny Stream | Library ID, API key and CDN hostname (guide) | bunnyStream() from payload-video-streaming/bunny |
muxVideo({ tokenId: process.env.MUX_TOKEN_ID!, tokenSecret: process.env.MUX_TOKEN_SECRET! })
bunnyStream({
libraryId: process.env.BUNNY_STREAM_LIBRARY_ID!,
apiKey: process.env.BUNNY_STREAM_API_KEY!,
cdnHostname: process.env.BUNNY_STREAM_CDN_HOSTNAME!,
})
Each guide covers signing keys, webhooks, limits and what was verified against a real account.
The admin shows only what a video's provider can do, and endpoints for anything else answer 501.
| Cloudflare Stream | Mux | Bunny Stream | |
|---|---|---|---|
| Browser upload | POST (≤200 MB) or tus | resumable chunked PUT | tus, signed by your server |
| Import by URL, server upload, adopt existing | ✓ | ✓ | ✓ |
| Encoding progress | ✓ | ✓ (while transcoding) | ✓ |
| Signed playback (optional, off by default; one setting per provider) | signing key optional | signing key required | match the library's token authentication |
| Per-video allowed origins | ✓ | — | — |
| Poster | any frame, GIF clip, image | any frame, WebP clip, image | 1 of 5 thumbnails, preview, image |
| Seek previews (storyboard) | ✓ (generated) | ✓ | ✓ (generated) |
| Captions | upload, AI (12 languages) | upload, AI (22 languages + auto) | upload, AI transcription |
| Extra audio tracks (from a URL) | ✓, rename, choose the default | ✓ (with a language), rename | — (from the source file only) |
| Downloads | MP4 and audio, per video | MP4 and audio, per video | MP4, library-wide |
Watermarks (watermarks) | profiles, per video | overlay, per video | library-wide, in Bunny's dashboard |
| HLS / DASH | ✓ / ✓ | ✓ / — | ✓ / — |
| Webhooks | ✓ | ✓ | ✓ |
All three are tested against real accounts, on Payload 4.0.0-beta.12 and 3.94.2, with SQLite, Postgres and MongoDB (TESTING.md).
[!IMPORTANT] Bunny's standard encoding queue can be slow. On a new library, videos waited at 0% for over 15 minutes; with Premium encoding they were ready in under a minute. More on encoding and limits.
Every upload goes straight from the browser to the provider.
watermarks). See Watermarks.Building your own upload UI? useVideoUpload, useUploadQueue and uploadVideoFile handle every provider's protocol (API reference).
videoField() adds a video to any collection, group or block. videoBlock() is a ready-made block for layout builders and Lexical rich text, with player settings editors can change.
fields: [
videoField({ name: 'heroVideo' }),
{ name: 'layout', type: 'blocks', blocks: [videoBlock(), /* your blocks */] },
]
Populated videos carry a virtual playback field with their URLs in every REST, GraphQL and Local API read. → Video fields and blocks
payload-video-streaming/react works in Server and Client Components, without importing Payload or Next.js.
<Video video={post.heroVideo} /> // a video field
<VideoBlock block={block} /> // a video block
videoJSXConverters() // video blocks in rich text
<Video video={post.heroVideo} player={HlsJsPlayer} /> // any player
{ source, options, title }. source.hls works with hls.js, Video.js, Vidstack, native Safari and iOS, ExoPlayer and AVPlayer.→ Rendering videos, covering your own blocks, a page per video, client-only apps and caching. Ready-made players are in examples/players.
poster: { imageCollection: 'media' }.source.poster gives it to yours.source.storyboard). Vidstack, Plyr, Video.js and Media Chrome take it directly, and useStoryboard helps players that don't.→ Posters and seek previews
access.playback denies are excluded.signedPlayback option (e.g. cloudflareStream({ signedPlayback: true, … })), or for every provider with upload.signedPlayback.access.playback get tokens that outlast the video.ids, one of them signed.→ Who can watch and signed videos
Let your site's users upload their own videos:
ownership records each video's uploader.moderation holds new uploads for review.<VideoUploader /> is a drop-in upload form for your site.import { ownerOr, videoPlugin } from 'payload-video-streaming'
const isAdmin = ({ req }) => req.user?.collection === 'users'
videoPlugin({
providers,
ownership: true,
moderation: true,
upload: { maxFileSize: 2 * 1024 ** 3, allowedTypes: ['video/*'] },
collection: { access: { create: ({ req }) => Boolean(req.user), update: ownerOr(isAdmin), delete: ownerOr(isAdmin) } },
})
Providers encode in the background. The plugin hears back in any of these ways:
| Mechanism | When | Setup |
|---|---|---|
| Admin polling | While an editor has the video open | None |
| Webhook | The moment the provider finishes | npx payload-video-streaming webhooks --url https://your-site.com |
| Sync-pending job | On your schedule | syncPendingTask: { cron: '*/5 * * * *' } |
POST /api/videos/sync-pending | From any external cron | An authenticated request |
The webhooks command prints each provider's URL and setup steps. It can also register Cloudflare's webhook for you (--register cloudflare) and test deployed endpoints (--check). The videos list shows whether each provider's webhook is working. → Webhooks
React when a video becomes ready or fails, whatever triggered the change:
videoPlugin({
providers,
hooks: {
onReady: async ({ doc, req }) => { /* notify the uploader, publish the post… */ },
onError: async ({ doc }) => { /* doc.error.code, doc.error.message */ },
},
})
import { getVideo } from 'payload-video-streaming'
const videos = getVideo(payload)
await videos.uploadFile({ file: buffer, filename: 'intro.mp4' })
await videos.importFromUrl({ url: 'https://example.com/video.mp4' })
await videos.getPlayback(doc, { expiresIn: 600 })
→ API reference: REST endpoints, the server API, frontend exports and writing a provider.
Find provider videos no document references (a failed delete, deleteFromProvider: false, uploads made elsewhere) and delete them after a review:
npx payload-video-streaming orphans # dry run: what would be deleted
npx payload-video-streaming orphans --delete
Videos from the last 7 days are skipped, and orphans.creator keeps other apps' videos in a shared account out. Also as getVideo(payload).cleanupOrphans() and an opt-in jobs task. → Orphan cleanup
| Guide | What's in it |
|---|---|
| Configuration | Every option and environment variable |
| Video fields and blocks | videoField(), videoBlock() and the video document |
| Rendering videos | Components, players, your own blocks, who can watch, signed videos, caching |
| Member uploads | Ownership, moderation, upload rules, VideoUploader |
| Webhooks | Setup per provider, the CLI, local tunnels, troubleshooting |
| Audio tracks | Dubs and other languages: adding from a URL or an upload collection, defaults |
| Viewing stats | Views, watch time, countries and retention from each provider |
| Watermarks | Watermark profiles, choosing one per upload, provider support |
| Orphan cleanup | Finding and deleting provider videos no document references |
| Translations | The admin UI's strings: overriding them and adding languages |
| API reference | Statuses, REST endpoints, server API, frontend exports, writing a provider |
| Providers | Cloudflare Stream, Mux, Bunny Stream |
| Examples | Type-checked configs, Next.js pages, players, upload UIs, server scripts and tests |
| Migrating from payload-cf-stream | Moving existing documents over |
| Import | For |
|---|---|
payload-video-streaming | The plugin, videoField(), videoBlock(), access helpers, getVideo() |
payload-video-streaming/cloudflare, /mux, /bunny | Provider factories, plus standalone REST clients, signing and webhook helpers |
payload-video-streaming/react | Video, VideoBlock, videoJSXConverters, VideoUploader, upload and source hooks |
payload-video-streaming/client | The admin components, if you build your own admin views |
payload-video-streaming/testing | Fake providers for your own tests |
npx payload-video-streaming | webhooks, fake and migrate-cf-stream commands |
readyToStream turns true. That usually takes seconds to a few minutes.meta updates the provider. Signing follows the provider's signedPlayback setting: after changing it, existing videos update when they next sync, or all at once with getVideo(payload).applySigning(). Deleting a document deletes its video there too (deleteFromProvider).req.bun install # installs only; everything else runs on Node
npm run dev # the admin against a fake provider; no account, containers or database server needed
CONTRIBUTING.md covers the dev app, the fake providers and the test suites. ROADMAP.md lists what's planned. Report security problems privately, as described in SECURITY.md.
mux video
Upload and manage Mux videos from a dedicated Payload collection with public or signed playback
793.9k/wk84v3
payload mux
Mux Video integration for Payload with a Videos collection that uploads directly to Mux
58133/wk18v3
payload video stream
Send video uploads from Payload upload collections to Cloudflare Stream and track processing status
5166/wk8v3
payload media
Search stock images and videos from Unsplash, Pexels, Pixabay and Openverse inside the Payload admin
83900/wk8v4
payload plugin media preview
Preview images, video, audio, code, CSV and Office files in the Payload admin edit and list views
66632/wk14v4
mux video
Mux video upload and playback for Atomic Payload, wrapping the Oversight Studio Mux plugin
6443/wk37v3