Giter Club home page Giter Club logo

sanity-plugin-mux-input's Introduction

Mux Video Input Sanity Plugin

This is a plugin which let you use MUX.com video assets in your Sanity studio.

The Mux plugin for Sanity gives you a way to upload and preview videos easily.

Read our blog post about this plugin.

Not familiar with Sanity? Visit www.sanity.io

Quick start

  • While in your project folder, run sanity install mux-input. Read more about using plugins in Sanity here.

  • Make a schema type that uses the plugin's type mux.video, for example:

        {
          title: "Video blog post",
          name: "videoBlogPost",
          type: "document",
          fields: [
            { title: "Title", name: "title", type: "string" },
            {
              title: "Video file",
              name: "video",
              type: "mux.video"
            }
          ]
        }
    

    Read more about schemas in Sanity here.

  • Get an API Access Token and enter it into the setup screen First time you use the plugin you will be asked to enter your MUX credentials.

    The Mux Video API uses an Access Token and Secret Key for authentication.

    If you haven't already, generate a new Access Token in the Access Token settings of your Mux account dashboard, and make sure it got permission to both read and write video and read data.

    The token is stored in the dataset as a document of the type mux.apiKey with the id secrets.mux. Having the ID be non-root ensures that only editors are able to see it.

    The MUX plugin will find it’s access tokens by fetching this document.

Playing videos in the frontend

We have made an own player which supports poster images for the videos as set with this plugin, see sanity-mux-player

You could use any player which supports HLS, just point the video source to:

https://stream.mux.com/${assetDocument.playbackId}.m3u8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.