oversightstudio

mux video

by oversightstudio
payload-plugins
Media & images
v3
^3.90.0
MIT

Overview

Summary generated from the README

Adds a mux-video collection to the Payload admin for uploading videos directly to Mux and managing them. Videos deleted in Payload are removed from Mux and the reverse, synced through a webhook endpoint the plugin registers. Requires Mux API tokens and a webhook secret, plus JWT keys for signed playback. Works with the Mux Player React component on the frontend.

Features

  • Public and signed playback policies with configurable signed URL expiration
  • Two-way deletion sync between the Payload admin and Mux
  • Animated gif, image or no thumbnails in the collection list view
  • Optional reconciliation of Payload entries with Mux assets on startup
  • Auto-creation of missing Payload videos when Mux webhooks arrive
  • Option to extend an existing collection with Mux video functionality

Use cases

  • Host and stream large videos from Mux instead of storing files in Payload
  • Restrict video access with signed playback URLs for members-only content
  • Backfill Payload with videos uploaded directly in the Mux dashboard

From the author

Brings Mux Video to PayloadCMS.

Installation

npm i @oversightstudio/mux-video

84

Stars

9

Forks

2

Open Issues

1 months ago

Last Updated

3.6k

Weekly Downloads

v1.4.1

npm Version

53.3 KB

Unpacked Size

2

Dependencies

Repository stars

84+3 since Sep 6

Show data
Repository stars by day (UTC)
DateStars
Dec 5, 202684
Dec 4, 202684
Dec 3, 202684
Dec 2, 202684
Dec 1, 202684
Nov 30, 202684
Nov 29, 202684
Nov 28, 202684
Nov 27, 202684
Nov 26, 202684
Nov 25, 202684
Nov 24, 202684
Nov 23, 202684
Nov 22, 202684
Nov 21, 202684
Nov 20, 202684
Nov 19, 202684
Nov 18, 202684
Nov 17, 202684
Nov 16, 202684
Nov 15, 202684
Nov 14, 202684
Nov 13, 202684
Nov 12, 202684
Nov 11, 202684
Nov 10, 202684
Nov 9, 202684
Nov 8, 202684
Nov 7, 202684
Nov 6, 202684
Nov 5, 202684
Nov 4, 202684
Nov 3, 202683
Nov 2, 202683
Nov 1, 202683
Oct 31, 202683
Oct 30, 202683
Oct 29, 202683
Oct 28, 202683
Oct 27, 202683
Oct 26, 202683
Oct 25, 202683
Oct 24, 202683
Oct 23, 202683
Oct 22, 202683
Oct 21, 202683
Oct 20, 202683
Oct 19, 202683
Oct 18, 202683
Oct 17, 202683
Oct 16, 202683
Oct 15, 202683
Oct 14, 202683
Oct 13, 202683
Oct 12, 202683
Oct 11, 202683
Oct 10, 202683
Oct 9, 202682
Oct 8, 202682
Oct 7, 202682
Oct 6, 202682
Oct 5, 202682
Oct 4, 202682
Oct 3, 202682
Oct 2, 202682
Oct 1, 202682
Sep 30, 202681
Sep 29, 202681
Sep 28, 202681
Sep 27, 202681
Sep 26, 202681
Sep 25, 202681
Sep 24, 202681
Sep 23, 202681
Sep 22, 202681
Sep 21, 202681
Sep 20, 202681
Sep 19, 202681
Sep 18, 202681
Sep 17, 202681
Sep 16, 202681
Sep 15, 202681
Sep 14, 202681
Sep 13, 202681
Sep 12, 202681
Sep 11, 202681
Sep 10, 202681
Sep 9, 202681
Sep 8, 202681
Sep 7, 202681
Sep 6, 202681

Shared by 3 plugins in oversightstudio/payload-plugins.

npm weekly downloads

2.6K−5K since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 20262,601
Dec 4, 20262,345
Dec 3, 20262,564
Dec 2, 20263,281
Dec 1, 20263,319
Nov 30, 20263,424
Nov 29, 20265,020
Nov 28, 20266,362
Nov 27, 20267,602
Nov 26, 20268,770
Nov 25, 20269,453
Nov 24, 20269,561
Nov 23, 20269,713
Nov 22, 20269,185
Nov 21, 20269,634
Nov 20, 20269,012
Nov 19, 20268,034
Nov 18, 20267,146
Nov 17, 20267,176
Nov 16, 20267,046
Nov 15, 20266,769
Nov 14, 20265,685
Nov 13, 20265,861
Nov 12, 20265,891
Nov 11, 20266,102
Nov 10, 20266,001
Nov 9, 20266,180
Nov 8, 20267,045
Nov 7, 20267,878
Nov 6, 20268,808
Nov 5, 20269,459
Nov 4, 20268,966
Nov 3, 20268,962
Nov 2, 20268,760
Nov 1, 20268,017
Oct 31, 20267,423
Oct 30, 20266,404
Oct 29, 20264,645
Oct 28, 20263,822
Oct 27, 20263,899
Oct 26, 20264,060
Oct 25, 20264,417
Oct 24, 20264,459
Oct 23, 20263,309
Oct 22, 20264,648
Oct 21, 20265,308
Oct 20, 20265,403
Oct 19, 20265,293
Oct 18, 20265,040
Oct 17, 20265,100
Oct 16, 20266,109
Oct 15, 20266,152
Oct 14, 20266,407
Oct 13, 20266,327
Oct 12, 20266,322
Oct 11, 20265,997
Oct 10, 20265,998
Oct 9, 20266,007
Oct 8, 20265,894
Oct 7, 20266,054
Oct 6, 20266,017
Oct 5, 20266,015
Oct 4, 20265,899
Oct 3, 20265,355
Oct 2, 20265,308
Oct 1, 20264,952
Sep 30, 20264,980
Sep 29, 20265,029
Sep 28, 20265,068
Sep 27, 20265,697
Sep 26, 20266,228
Sep 25, 20266,556
Sep 24, 20267,310
Sep 23, 20267,811
Sep 22, 20267,846
Sep 21, 20268,052
Sep 20, 20268,419
Sep 19, 20268,504
Sep 18, 20268,633
Sep 17, 20268,369
Sep 16, 20267,418
Sep 15, 20267,534
Sep 14, 20267,428
Sep 13, 20266,948
Sep 12, 20267,324
Sep 11, 20267,105
Sep 10, 20266,914
Sep 9, 20267,946
Sep 8, 20267,766
Sep 7, 20267,762
Sep 6, 20267,618

Each point is npm's rolling 7-day download count.

Health Score

79/100Excellent

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/932147916-mux-video.svg)](https://payloaddirectory.dev/plugins/932147916-mux-video)
HTML
<a href="https://payloaddirectory.dev/plugins/932147916-mux-video"><img src="https://payloaddirectory.dev/badge/932147916-mux-video.svg" alt="Payload Directory"></a>
Updated Oct 23, 2026Created Feb 13, 2025Published Aug 2, 2026

README

Mux Video Payload Plugin

Install

pnpm add @oversightstudio/mux-video @mux/mux-player-react

About

This plugin brings Mux Video to Payload! It creates a “Videos” collection within the admin panel, making it simple to upload videos directly to Mux and manage them.

Features include:

  • Support for both public and signed playback policies.
  • Ensures that videos deleted in the admin panel are automatically deleted from Mux, and vice versa.
  • Video gif previews on the videos collection list view, which can be disabled if required.

muxVideoPreview

Payload Setup

There are two possible setups for this plugin: The public setup, and the signed URLs setup. The main difference between the two is that the signed URLs setup requires setting up a little extra configuration, but that's about it.

To get started, you’ll need to generate your MUX tokens and secrets from the MUX Dashboard. When configuring the webhook, set the URL to the automatically generated API endpoint provided by this plugin at /api/mux/webhook. If you have set a custom API route in Payload config via routes.api, the API endpoint will be <your_custom_api_route>/mux/webhook.

Public Setup

import { buildConfig } from 'payload'
import { muxVideoPlugin } from '@oversightstudio/mux-video'

export default buildConfig({
  plugins: [
    muxVideoPlugin({
      enabled: true,
      initSettings: {
        tokenId: process.env.MUX_TOKEN_ID || '',
        tokenSecret: process.env.MUX_TOKEN_SECRET || '',
        webhookSecret: process.env.MUX_WEBHOOK_SIGNING_SECRET || '',
      },
      uploadSettings: {
        cors_origin: process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:3000',
      },
    }),
  ],
})

Signed URLs Setup

import { buildConfig } from 'payload'
import { muxVideoPlugin } from '@oversightstudio/mux-video'

export default buildConfig({
  plugins: [
    muxVideoPlugin({
      enabled: true,
      initSettings: {
        tokenId: process.env.MUX_TOKEN_ID || '',
        tokenSecret: process.env.MUX_TOKEN_SECRET || '',
        webhookSecret: process.env.MUX_WEBHOOK_SIGNING_SECRET || '',
        jwtSigningKey: process.env.MUX_JWT_KEY_ID || '',
        jwtPrivateKey: process.env.MUX_JWT_KEY || '',
      },
      uploadSettings: {
        cors_origin: process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:3000',
        new_asset_settings: {
          playback_policy: ['signed'],
        },
      },
    }),
  ],
})

Options

OptionTypeDefaultDescription
enabledbooleanRequiredWhether the plugin is enabled.
initSettingsMuxVideoInitSettingsRequiredInitialization settings for the Mux implementation.
uploadSettingsMuxVideoUploadSettingsRequiredUpload settings for Mux video assets.
extendCollectionstringOptionalThe slug of an existing collection to extend with Mux video functionality.
access(request: PayloadRequest) => Promise<boolean> | booleanOptionalAn optional function to determine who can upload files. Should return a boolean or a Promise resolving to a boolean.
signedUrlOptionsMuxVideoSignedUrlOptionsOptionalOptions for signed URL generation.
posterExtension'webp' | 'jpg' | 'png'"png"The image format to use for video posters.
animatedGifExtension'gif' | 'webp'"gif"The image format to use for animated preview thumbnails.
adminThumbnail'gif' | 'image' | 'none'"gif"Specifies the type of thumbnail to display for videos in the collection list view.
reconcileOnInitfalse | "createMissing" | "deleteStale" | "createMissingAndDeleteStale"falseReconcile Payload entries with all Mux assets in the background after startup. Delete modes remove stale Payload entries only; they never delete Mux assets.
autoCreateOnWebhookbooleanfalseIf enabled, the Mux webhook will automatically create videos that are missing in Payload when webhooks are received from Mux. Useful for uploading videos directly in Mux and automatically backfilling them in Payload.

initSettings Options

OptionTypeDefaultDescription
tokenIdstringRequiredThe Mux token ID.
tokenSecretstringRequiredThe Mux token secret.
webhookSecretstringRequiredThe secret used to validate Mux webhooks.
jwtSigningKeystringOptionalOptional JWT signing key, required for signed URL setup.
jwtPrivateKeystringOptionalOptional JWT private key, required for signed URL setup.

uploadSettings Options

OptionTypeDefaultDescription
cors_originstringRequiredThe required CORS origin for Mux.
new_asset_settingsMuxVideoNewAssetSettingsOptionalAdditional settings for creating assets in Mux.

new_asset_settings Options

OptionTypeDefaultDescription
playback_policy`Array<'public''signed'>`public

signedUrlOptions Options

OptionTypeDefaultDescription
expirationstring"1d"Expiration time for signed URLs. Default is "1d".

Videos Collection

This is the collection generated by the plugin with the mux-video slug.

FieldTypeRead-OnlyDescription
titletextNoA unique title for this video that will help you identify it later.
assetIdtextYes
durationnumberYes
posterTimestampnumberNoA timestamp (in seconds) from the video to be used as the poster image. When unset, defaults to the middle of the video.
aspectRatiotextYes
maxWidthnumberYes
maxHeightnumberYes
playbackOptionsarrayYes

playbackOptions Fields

FieldTypeRead-OnlyDescription
playbackIdtextYes
playbackPolicyselectYesOptions: signed, public
playbackUrltext (virtual)Yes
posterUrltext (virtual)Yes

Payload Usage Example

import { CollectionConfig } from 'payload'

export const ExampleCollection: CollectionConfig = {
  slug: 'example',
  fields: [
    // To link videos to other collection, use the `relationship` field type
    {
      name: 'video',
      label: 'Preview Video',
      type: 'relationship',
      relationTo: 'mux-video',
    },
  ],
}

Frontend Usage Example

import config from '@/payload.config'
import { getPayload } from 'payload'
import MuxPlayer from '@mux/mux-player-react'

async function Page() {
  const payload = await getPayload({ config })

  const video = await payload.findByID({
    collection: 'mux-video',
    id: 'example',
  })

  return (
    <MuxPlayer
      // Using playback id
      playbackId={video.playbackOptions![0].playbackId!}
      // Or use the playback URL
      src={video.playbackOptions![0].playbackUrl!}
      // Poster
      poster={video.playbackOptions![0].posterUrl!}
    />
  )
}

export default Page

Credits

  • Huge shoutout to jamesvclements for building the initial version of this plugin!
  • Shoutout to Paul for being a real one.

Similar plugins