Skip to content

Custom Strapi Mux Video Upload Plugin adding MP4 static asset support for every upload by default

Notifications You must be signed in to change notification settings

ajdemarco95/strapi-plugin-mux-video-uploader-2.0.0

Repository files navigation

Mux Video Uploader

Summary

A Strapi plugin for managing uploads to Mux.

This plugin provides the ability to upload content via a url or a direct file upload to Mux.

Install

npm i strapi-plugin-mux-video-uploader

- or -

yarn add strapi-plugin-mux-video-uploader

Usage

Dependencies

  • A Mux account
  • You will need both the Access Token and Secret Key scoped with "Full Access" permissions which can be created in the Mux Dashboard
  • The Webhook Signing Secret which can be created in the Mux Dashboard (See the Webhooks section for more info)
  • Tested with Strapi v3.6.2 Community Edition

Webhooks

Please note: We've currently disabled webhook signature verification as there is not a way to access the raw request body from the Koa.js middleware (which Strapi is using for parsing requests). This is needed to ensure that we are verifying the signature and that the request JSON payload has properties in the same order that was used for generating the signature.

When setting up your Webhook configuration in the Mux Dashboard, the "URL to notify" field should be in the format of—

{STRAPI_BASE_URL}/mux-video-uploader/webhook-handler

Where {STRAPI_BASE_URL} is the publicly accessible hostname of your Strapi instance.

Configuration

In order for this plugin to communicate with Mux, some configuration values need to be set for the plugin before it can be used.

With your Access Token, Secret Key and Webhook Signing Secret, navigate to the Settings view within Strapi and click the "General" section under MUX VIDEO UPLOADER.

On this view, set the appropriate values to their fields and click the Save button.

Permissions

Currently, anyone with "Super Admin" access to your Strapi instance will be able to utilize the plugin for uploading and managing content.

Aside from admin permissions, a public user role needs to be configured to allow access to the muxwebhookhandler method. This is needed so that Mux can send Webhook events to your Strapi instance for updating MuxAsset content types.

To enable this permission, do the following steps—

  • Log into the Strapi admin UI and navigate to "Roles & Permissions"
  • Click on the edit button aside the "Public" role
  • Drop down the "MUX-VIDEO-UPLOADER" section and check the box nexzt to muxwebhookhandler
  • Save changes

Features

  • Upload videos using a url or a file to Mux from inside of Strapi
  • Mux updates Strapi when the asset is ready
  • A MuxAsset content-type is provided to track asset readiness and that can be referenced by other Strapi content-types

Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

FAQ

My Strapi instance is not publicly available, can I still use Webhooks?

Yes! However, in order to make it work, you'll need a "Webhook Relay" that runs from within your network. You can use a Webhook Relay service like Smee (https://smee.io/) or ngrok (https://ngrok.com/) to forward Webhook events to an instance of Strapi behind a firewall.

Thanks

Strapi.io

References

About

Custom Strapi Mux Video Upload Plugin adding MP4 static asset support for every upload by default

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published