Code Monkey home page Code Monkey logo

sanity-plugin-mux-input's Introduction

Mux Video Input Sanity Plugin

This is a Sanity Studio v3 plugin. For the v2 version, please refer to the v2-branch.

This plugin lets you use Mux video assets in your Sanity studio.

The Mux plugin for Sanity allows you to easily upload and preview videos.

Read our blog post about this plugin.

Not familiar with Sanity? Visit www.sanity.io

Installation

npm install sanity-plugin-mux-input

or

yarn add sanity-plugin-mux-input

Quick start

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

    export default {
      title: 'Video blog post',
      name: 'videoBlogPost',
      type: 'document',
      fields: [
        {title: 'Title', name: 'title', type: 'string'},
        {
          title: 'Video file',
          name: 'video',
          type: 'mux.video',
        },
      ],
    }
    • Add the muxInput import to your plugins:
    import {defineConfig} from 'sanity'
    import {muxInput} from 'sanity-plugin-mux-input'
    
    export default defineConfig({
      plugins: [muxInput()],
    })

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 its access tokens by fetching this document.

Fetching playback IDs and understanding the data structure

When a Mux video is uploaded/chosen in a document via this plugin, it gets stored as a reference to the video document:

// example document
{
  "_type": "exampleSchemaWithVideo",
  // Example video field
  "myVideoField": {
    "_type": "mux.video",
    "asset": {
      "_type": "reference",
      "_weak": true,
      "_ref": "4e37284e-cec2-406d-973c-fdf9ab1e5598" // πŸ‘ˆ ID of the document holding the video's Mux data
    }
  }
}

Before you can display videos in your frontend, you need to follow these references to fetch the asset's playback ID, which will be used to create a player. Here's an example GROQ query to expand the video reference in the example data above:

// Example for fetching data above
*[ _type == "exampleSchemaWithVideo" ] {
  myVideoField {
    asset-> {
      playbackId,
      assetId,
      filename,
    }
  }
}

πŸ’‘ For more information on querying references, refer to the documentation on Writing GROQ queries for references or on Sanity's GraphQL API.

For reference, here's an example mux.videoAsset document:

{
  "_id": "4e37284e-cec2-406d-973c-fdf9ab1e5598",
  "_type": "mux.videoAsset",
  "assetId": "7ovyI76F92n02H00mWP7lOCZMIU00N4iysDiQDNppX026HY",
  "filename": "mux-example-video.mp4",
  "status": "ready",
  "playbackId": "YA02HBpY02fKWHDRMNilo301pdH02LY3k9HTcK43ItGJLWA",
  // Full Mux asset data:
  "data": {
    "encoding_tier": "smart",
    "max_resolution_tier": "1080p",
    "aspect_ratio": "16:9",
    "created_at": "1706645034",
    "duration": 25.492133,
    "status": "ready",
    "master_access": "none",
    "max_stored_frame_rate": 29.97,
    "playback_ids": [
      {
        "id": "YA02HBpY02fKWHDRMNilo301pdH02LY3k9HTcK43ItGJLWA",
        "policy": "signed"
      }
    ],
    "resolution_tier": "1080p",
    "ingest_type": "on_demand_url",
    "max_stored_resolution": "HD",
    "tracks": [
      {
        "max_channel_layout": "stereo",
        "max_channels": 2,
        "id": "00MKMC73SYimw1YTh0102lPJJp9w2R5rHddpNX1N9opAMk",
        "type": "audio",
        "primary": true,
        "duration": 25.45
      },
      {
        "max_frame_rate": 29.97,
        "max_height": 1080,
        "id": "g1wEph3CVvbJL01YNKzAWMyH8N1SxW00WeECGjqwEHW9g",
        "type": "video",
        "duration": 25.4254,
        "max_width": 1920
      }
    ],
    "id": "7ovyI76F92n02H00mWP7lOCZMIU00N4iysDiQDNppX026HY",
    "mp4_support": "none"
  }
}

Playing videos in the frontend

We recommend using Mux Player to properly display your videos, through packages like @mux/mux-player and @mux/mux-player-react. Here's an example of how you can use the Mux Player to display a video in a React component:

'use client'

import MuxPlayer from '@mux/mux-player-react'

export default function MuxVideo({playbackId, title}: {playbackId?: string; title?: string}) {
  if (!playbackId) return null

  return <MuxPlayer playbackId={playbackId} metadata={title ? {video_title: title} : undefined} />
}

πŸ’‘ You can try these recommendations through the Codesandbox example.

Configuring Mux Video uploads

Signed URLs (private playbacks)

To enable signed URLs with content uploaded to Mux, you will need to check the "Enable Signed Urls" option in the Mux Plugin configuration. This feature requires you to set the API Access Token and Secret Key (as per the Quick start section).

πŸ“Œ Note: When the signed URL option is triggered, the plugin will cache a signingKeyPrivate in a private document in the dataset. This key is used by Mux to sign the uploads, and if it's incorrect your uploads will fail. If that's the case, you can delete the secrets document and try again:

# Using the Sanity CLI, delete the secrets, then re-open the plugin and configure it again
sanity documents delete secrets.mux

More information on signed URLs is available on Mux's docs

MP4 support (downloadable videos or offline viewing)

To enable static MP4 renditions, add mp4_support: 'standard' to the options of your mux.video schema type.

import {muxInput} from 'sanity-plugin-mux-input'

export default defineConfig({
  plugins: [muxInput({mp4_support: 'standard'})],
})

If MP4 support is enabled in the plugin's configuration, editors can still choose to enable MP4 renditions on a per-video basis when uploading new assets.

MP4 allows users to download videos for later or offline viewing. More information can be found on Mux's documentation.

Video resolution (max_resolution_tier)

To edit max_resolution_tier to support other resolutions other than 1080p, add max_resolution_tier: '1080p' | '1440p' | '2160p' to the options of your mux.video schema type. Defaults to 1080p.

import {muxInput} from 'sanity-plugin-mux-input'

export default defineConfig({
  plugins: [muxInput({max_resolution_tier: '2160p'})],
})

When uploading new assets, editors can still choose a lower resolution for each video than configured globally. This option controls the maximum resolution encoded or processed for the uploaded video. The option is particularly important to manage costs when uploaded videos are higher than 1080p resolution. More information on the feature is available on Mux's docs. Also, read more on this feature announcement on Mux's blog.

Encoding tier (smart or baseline)

The encoding tier informs the cost, quality, and available platform features for the asset. You can choose between smart and baseline at the plugin configuration. Defaults to smart.

import {muxInput} from 'sanity-plugin-mux-input'

export default defineConfig({
  plugins: [muxInput({encoding_tier: 'baseline'})],
})

If encoding_tier: 'smart', editors can still choose to use the baseline encoding tier on a per-video basis when uploading new assets.

More information on the feature is available on Mux's documentation. Also, read more on the feature announcement on Mux's blog

Auto-generated subtitles and captions

If you've enabled smart encoding, you can use Mux's auto-generated subtitles feature. Unless you pass disableTextTrackConfig: true to the configuration, users will be able to choose a language to auto-generate subtitles for uploaded videos. Refer to Mux's documentation for the list of supported languages.

You can also define a default language for the upload configuration form:

import {muxInput} from 'sanity-plugin-mux-input'

export default defineConfig({
  plugins: [
    muxInput({
      encoding_tier: 'smart',
      defaultAutogeneratedSubtitleLang: 'en', // choose from one of the supported languages
    }),
  ],
})

If your videos are always spoken in a specific language and you want to include captions by default, you can use disableTextTrackConfig: true together with defaultAutogeneratedSubtitleLang to transcribe captions for every uploaded asset without needing user interaction.

Contributing

Issues are actively monitored and PRs are welcome. When developing this plugin the easiest setup is:

  1. Fork this repo.
  2. Create a studio v3 project: npm create sanity@dev-preview. Follow the prompts, starting out with the blog template is a good way to go.
  3. cd into your project directory, run npm install && npm start - your sanity studio should be running on http://localhost:3333.
  4. cd into the plugins directory of your project.
  5. Fork this repo and clone your fork into the plugins directory inside your project git clone [email protected]:your-fork/sanity-plugin-mux-input.git.
  6. Open sanity.json, go to the plugins array and add mux-input.
  7. Re-start the sanity studio server with npm start.
  8. Edit schemas/post.js and add follow the plugin documentation to add a mux.video type field.
  9. Your studio should reload, and now when you edit the plugin code it should reload the studio, when you're done creating a branch, put in a PR and a maintainer will review it. Thank you!

Publishing

Run the "CI" workflow. Make sure to select the main branch and check "Release new version".

Semantic release will only release on configured branches, so it is safe to run release on any branch.

On the studio-v2 branch this will result in:

  • a new version on the latest dist-tag.
  • running yarn add sanity-plugin-mux-input or npm i sanity-plugin-mux-input will fetch the new version.
  • running sanity install mux-input will fetch the new version.
  • studio-v3 users are unaffected.

On the main branch this will result in:

  • a new prerelease version on the studio-v3 dist-tag.
  • running yarn add sanity-plugin-mux-input@studio-v3 or npm i sanity-plugin-mux-input@studio-v3 will fetch the new version.
  • running sanity install mux-input won't fetch the new version.

After Studio v3 turns stable this behavior will change. The v2 version will then be available on the studio-v2 dist-tag, and studio-v3 is upgraded to live on latest.

Develop & test

This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.

See Testing a plugin in Sanity Studio on how to run this plugin with hotreload in the studio.

Release new version

Run "CI & Release" workflow. Make sure to select the main branch and check "Release new version".

Semantic release will only release on configured branches, so it is safe to run release on any branch.

License

MIT-licensed. See LICENSE.

sanity-plugin-mux-input's People

Contributors

amazinglalu avatar bjoerge avatar dependabot[bot] avatar donalffons avatar dylanjha avatar edwin-mejia avatar erikpena avatar hdoro avatar israelroldan avatar jakobsen avatar jaredsmith avatar jonabc avatar kimpaow avatar kmelve avatar mariuslundgard avatar olivierverwoerd avatar phmasek avatar renovate[bot] avatar rexxars avatar robinpyon avatar runeb avatar semantic-release-bot avatar skogsmaskin avatar snorrees avatar stipsan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sanity-plugin-mux-input's Issues

Error and missing thumbnails on assets that didn’t finish upload

When not finishing an upload, the asset still shows up in β€˜browse’ with a question mark thumbnail and with some errors (see screenshots) due to missing playback id

Expected/suggested behaviour would be to not show the assets that aren't ready.
Alternatively to show title/filename only and not try to fetch the asset and thumbnail.

Version 1.1.9 on Sanity 2.35.0

CleanShot 2022-10-21 at 10 05 08@2x

CleanShot 2022-10-21 at 10 05 04@2x

CleanShot 2022-10-21 at 10 07 09@2x

The best workaround I've found for now is to delete the mux.videoAsset that didn’t finish, but this is not good for most normal contributors.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.


Using a curated preset maintained by


Sanity: The Composable Content Cloud

Pending Approval

These branches will be created by Renovate only once you click their checkbox below.

  • fix(deps): Update example dependencies (@mux/mux-player-react, @sanity/client, @sanity/icons, @sanity/pkg-utils, @sanity/plugin-kit, @sanity/ui, @sanity/vision, @types/lodash, @types/react, @typescript-eslint/eslint-plugin, @typescript-eslint/parser, eslint-plugin-prettier, eslint-plugin-simple-import-sort, next, next-sanity, npm-run-all2, prettier, prettier-plugin-packagejson, react-rx, sanity, sanity-plugin-mux-input, styled-components, type-fest, typescript)
  • chore(deps): update dependency jsonwebtoken-esm to v2
  • chore(deps): update dependency npm-run-all2 to v6
  • chore(deps): lock file maintenance
  • πŸ” Create all pending approval PRs at once πŸ”

Detected dependencies

github-actions
.github/workflows/main.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/prettier.yml
  • actions/checkout v4
  • actions/setup-node v4
  • EndBug/add-and-commit v9@a94899bca583c204427a224a7af87c02f9b325d5
npm
example/package.json
  • @mux/mux-player-react ^2.6.0
  • @portabletext/react ^3.0.18
  • @sanity/client ^6.18.2
  • @sanity/image-url ^1.0.2
  • @sanity/vision ^3.42.1
  • next ^14.2.3
  • next-sanity ^9.0.20
  • react ^18.3.1
  • react-dom ^18.3.1
  • sanity ^3.42.1
  • sanity-plugin-mux-input ^2.3.0
  • styled-components ^6.1.11
  • @types/react ^18.3.2
  • @types/react-dom ^18.3.0
  • typescript ^5.4.5
package.json
  • @mux/mux-player-react ^2.6.0
  • @mux/upchunk ^3.4.0
  • @sanity/icons ^3.0.0
  • @sanity/incompatible-plugin ^1.0.4
  • @sanity/ui ^2.1.11
  • @sanity/uuid ^3.0.2
  • iso-639-1 ^3.1.2
  • jsonwebtoken-esm ^1.0.5
  • lodash ^4.17.21
  • react-rx ^3.0.0
  • rxjs ^7.8.1
  • scroll-into-view-if-needed ^3.1.0
  • suspend-react ^0.1.3
  • swr ^2.2.5
  • type-fest ^4.18.2
  • use-error-boundary ^2.0.6
  • @sanity/client ^6.18.2
  • @sanity/pkg-utils ^6.8.16
  • @sanity/plugin-kit 4.0.12
  • @sanity/semantic-release-preset ^5.0.0
  • @sanity/vision ^3.42.1
  • @types/lodash ^4.17.4
  • @types/react ^18.3.2
  • @types/react-is ^18.3.0
  • @types/styled-components ^5.1.34
  • @typescript-eslint/eslint-plugin ^7.0.2
  • @typescript-eslint/parser ^7.0.2
  • eslint ^8.57.0
  • eslint-config-prettier ^9.1.0
  • eslint-config-react-app ^7.0.1
  • eslint-config-sanity ^7.1.2
  • eslint-plugin-import ^2.29.1
  • eslint-plugin-prettier ^5.1.3
  • eslint-plugin-react-hooks ^4.6.2
  • eslint-plugin-simple-import-sort ^12.1.0
  • npm-run-all2 ^5.0.0
  • prettier ^3.2.5
  • prettier-plugin-packagejson ^2.5.0
  • react ^18.3.1
  • react-dom ^18.3.1
  • react-is ^18.3.1
  • rimraf ^5.0.7
  • sanity ^3.42.1
  • semantic-release ^24.0.0
  • styled-components ^6.1.11
  • typescript ^5.4.5
  • yalc 1.0.0-pre.53
  • react ^18
  • react-is ^18
  • sanity ^3.42.0
  • styled-components ^5 || ^6
  • node >=18

  • Check this box to trigger a request for Renovate to run again on this repository

Sanity Plugin Setup Error

Hello, I am following this blog post (https://www.sanity.io/blog/first-class-responsive-video-support-with-the-new-mux-plugin) to set up your plugin in Sanity.

When I get to this step: Back in Sanity Studio, find the document where your video field appears, and click the plug-icon πŸ”Œon the Paste your Access Token and Secret Key., I get an error that I cannot figure out.

When clicking on the plug icon, Sanity crashes with the following error color.default.readOnly is undefined. And it gives me this Stack trace:

inputElementStyles@http://localhost:3333/static/js/app.bundle.js:436242:1
Ne@http://localhost:3333/static/js/app.bundle.js:595:14926
ie</e.prototype.generateAndInjectStyles@http://localhost:3333/static/js/app.bundle.js:595:11364
O/</S<@http://localhost:3333/static/js/app.bundle.js:595:19144
O/<@http://localhost:3333/static/js/app.bundle.js:595:19319
O@http://localhost:3333/static/js/app.bundle.js:595:19910
renderWithHooks@http://localhost:3333/static/js/vendor.bundle.js:18129:27
updateForwardRef@http://localhost:3333/static/js/vendor.bundle.js:20142:20
beginWork@http://localhost:3333/static/js/vendor.bundle.js:21971:16
callCallback@http://localhost:3333/static/js/vendor.bundle.js:3514:14
invokeGuardedCallbackDev@http://localhost:3333/static/js/vendor.bundle.js:3563:16
invokeGuardedCallback@http://localhost:3333/static/js/vendor.bundle.js:3618:31
beginWork$1@http://localhost:3333/static/js/vendor.bundle.js:26529:28

As well as this Component stack:

in styled.input (created by ForwardRef(Checkbox2))
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Checkbox2))
    in ForwardRef(Checkbox2) (created by MuxVideoInputSetup)
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Box2))
    in ForwardRef(Box2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(Flex2))
    in ForwardRef(Flex2) (created by MuxVideoInputSetup)
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Box2))
    in ForwardRef(Box2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(Stack2))
    in ForwardRef(Stack2) (created by MuxVideoInputSetup)
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Box2))
    in ForwardRef(Box2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(Stack2))
    in ForwardRef(Stack2) (created by MuxVideoInputSetup)
    in form (created by MuxVideoInputSetup)
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Box2))
    in ForwardRef(Box2) (created by MuxVideoInputSetup)
    in MuxVideoInputSetup (created by MuxVideoInput)
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Box2))
    in ForwardRef(Box2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(DialogCard2))
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Box2))
    in ForwardRef(Box2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(Flex2))
    in ForwardRef(Flex2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(DialogCard2))
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Box2))
    in ForwardRef(Box2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(Card2))
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by ThemeColorProvider)
    in ThemeColorProvider (created by ForwardRef(Card2))
    in ForwardRef(Card2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(DialogCard2))
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Box2))
    in ForwardRef(Box2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(Container2))
    in ForwardRef(Container2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(DialogCard2))
    in ForwardRef(DialogCard2) (created by ForwardRef(Dialog2))
    in div (created by styled.div)
    in styled.div (created by ForwardRef(LayerChildren2))
    in ForwardRef(LayerChildren2) (created by ForwardRef(Layer2))
    in LayerProvider (created by ForwardRef(Layer2))
    in ForwardRef(Layer2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(Dialog2))
    in Portal (created by ForwardRef(Dialog2))
    in ForwardRef(Dialog2) (created by MuxVideoInput)
    in div (created by MuxVideoInput)
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Box2))
    in ForwardRef(Box2) (created by Styled(Component))
    in Styled(Component) (created by ForwardRef(Flex2))
    in ForwardRef(Flex2) (created by MuxVideoInput)
    in div (created by styled.div)
    in styled.div (created by ForwardRef(Box2))
    in ForwardRef(Box2) (created by MuxVideoInput)
    in MuxVideoInput (created by withDocument(MuxVideoInput))
    in withDocument(MuxVideoInput) (created by FormBuilderInputInner)
    in ChangeIndicatorProvider (created by FormBuilderInputInner)
    in div (created by FormBuilderInputInner)
    in FormBuilderInputInner (created by FormBuilderInput)
    in FormBuilderInput (created by Field)
    in div (created by Field)
    in Field (created by ObjectInput)
    in div (created by ObjectInput)
    in div (created by ObjectInput)
    in ObjectInput (created by FormBuilderInputInner)
    in ChangeIndicatorProvider (created by FormBuilderInputInner)
    in div (created by FormBuilderInputInner)
    in FormBuilderInputInner (created by FormBuilderInput)
    in FormBuilderInput (created by EditDialog)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by EditDialog)
    in div (created by ForwardRef(RegionsWithIntersections))
    in div (created by ForwardRef(RegionsWithIntersections))
    in ForwardRef(RegionsWithIntersections) (created by StickyOverlay)
    in StickyOverlay (created by OverlayEnabled)
    in Tracker (created by OverlayEnabled)
    in OverlayEnabled (created by EditDialog)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by DialogCard)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Flex)
    in Flex (created by Styled(Flex))
    in Styled(Flex) (created by DialogCard)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Card)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by ThemeColorProvider)
    in ThemeColorProvider (created by Card)
    in Card (created by Styled(Card))
    in Styled(Card) (created by DialogCard)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Container)
    in Container (created by Styled(Container))
    in Styled(Container) (created by DialogCard)
    in DialogCard (created by Dialog)
    in div (created by styled.div)
    in styled.div (created by ForwardRef(LayerChildren2))
    in ForwardRef(LayerChildren2) (created by ForwardRef(Layer2))
    in LayerProvider (created by ForwardRef(Layer2))
    in ForwardRef(Layer2) (created by Styled(Component))
    in Styled(Component) (created by Dialog)
    in Portal (created by Dialog)
    in Dialog (created by EditDialog)
    in EditDialog (created by ArrayItem)
    in ArrayItem (created by ArrayInput)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Card)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by ThemeColorProvider)
    in ThemeColorProvider (created by Card)
    in Card (created by Styled(Card))
    in Styled(Card) (created by sortableElement(Styled(Card)))
    in sortableElement(Styled(Card)) (created by Item)
    in Item (created by ArrayInput)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Grid)
    in Grid (created by ForwardRef(Sortable))
    in ForwardRef(Sortable) (created by sortableList)
    in sortableList (created by ForwardRef(SortableList))
    in ForwardRef(SortableList) (created by List)
    in List (created by ArrayInput)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Stack)
    in Stack (created by ArrayInput)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Stack)
    in Stack (created by ArrayInput)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Grid)
    in Grid (created by FormFieldSet)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by FormFieldSet)
    in fieldset (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by FormFieldSet)
    in FormFieldSet (created by ForwardRef(FileTarget))
    in ForwardRef(FileTarget) (created by ForwardRef(UploadTarget))
    in div (created by styled.div)
    in styled.div (created by ForwardRef(UploadTarget))
    in ForwardRef(UploadTarget) (created by ArrayInput)
    in ArrayInput (created by ForwardRef(SanityArrayInput))
    in ForwardRef(SanityArrayInput) (created by FormBuilderInputInner)
    in ChangeIndicatorProvider (created by FormBuilderInputInner)
    in div (created by FormBuilderInputInner)
    in FormBuilderInputInner (created by FormBuilderInput)
    in FormBuilderInput (created by Field)
    in div (created by Field)
    in Field (created by ObjectInput)
    in div (created by ObjectInput)
    in div (created by ObjectInput)
    in ObjectInput (created by FormBuilderInputInner)
    in ChangeIndicatorProvider (created by FormBuilderInputInner)
    in div (created by FormBuilderInputInner)
    in FormBuilderInputInner (created by FormBuilderInput)
    in FormBuilderInput (created by EditDialog)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by EditDialog)
    in div (created by ForwardRef(RegionsWithIntersections))
    in div (created by ForwardRef(RegionsWithIntersections))
    in ForwardRef(RegionsWithIntersections) (created by StickyOverlay)
    in StickyOverlay (created by OverlayEnabled)
    in Tracker (created by OverlayEnabled)
    in OverlayEnabled (created by EditDialog)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by DialogCard)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Flex)
    in Flex (created by Styled(Flex))
    in Styled(Flex) (created by DialogCard)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Card)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by ThemeColorProvider)
    in ThemeColorProvider (created by Card)
    in Card (created by Styled(Card))
    in Styled(Card) (created by DialogCard)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Container)
    in Container (created by Styled(Container))
    in Styled(Container) (created by DialogCard)
    in DialogCard (created by Dialog)
    in div (created by styled.div)
    in styled.div (created by ForwardRef(LayerChildren2))
    in ForwardRef(LayerChildren2) (created by ForwardRef(Layer2))
    in LayerProvider (created by ForwardRef(Layer2))
    in ForwardRef(Layer2) (created by Styled(Component))
    in Styled(Component) (created by Dialog)
    in Portal (created by Dialog)
    in Dialog (created by EditDialog)
    in EditDialog (created by ArrayItem)
    in ArrayItem (created by ArrayInput)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Card)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by ThemeColorProvider)
    in ThemeColorProvider (created by Card)
    in Card (created by Styled(Card))
    in Styled(Card) (created by sortableElement(Styled(Card)))
    in sortableElement(Styled(Card)) (created by Item)
    in Item (created by ArrayInput)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Grid)
    in Grid (created by ForwardRef(Sortable))
    in ForwardRef(Sortable) (created by sortableList)
    in sortableList (created by ForwardRef(SortableList))
    in ForwardRef(SortableList) (created by List)
    in List (created by ArrayInput)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Stack)
    in Stack (created by ArrayInput)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Stack)
    in Stack (created by ArrayInput)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Grid)
    in Grid (created by FormFieldSet)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by FormFieldSet)
    in fieldset (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by FormFieldSet)
    in FormFieldSet (created by ForwardRef(FileTarget))
    in ForwardRef(FileTarget) (created by ForwardRef(UploadTarget))
    in div (created by styled.div)
    in styled.div (created by ForwardRef(UploadTarget))
    in ForwardRef(UploadTarget) (created by ArrayInput)
    in ArrayInput (created by ForwardRef(SanityArrayInput))
    in ForwardRef(SanityArrayInput) (created by FormBuilderInputInner)
    in ChangeIndicatorProvider (created by FormBuilderInputInner)
    in div (created by FormBuilderInputInner)
    in FormBuilderInputInner (created by FormBuilderInput)
    in FormBuilderInput (created by Field)
    in div (created by Field)
    in Field (created by ObjectInput)
    in div (created by ObjectInput)
    in div (created by ObjectInput)
    in ObjectInput (created by FormBuilderInputInner)
    in ChangeIndicatorProvider (created by FormBuilderInputInner)
    in div (created by FormBuilderInputInner)
    in FormBuilderInputInner (created by FormBuilderInput)
    in FormBuilderInput (created by SanityFormBuilder)
    in FormBuilderContext (created by SanityFormBuilderContext)
    in SanityFormBuilderContext (created by SanityFormBuilder)
    in SanityFormBuilder (created by EditForm)
    in form (created by EditForm)
    in EditForm (created by FormView)
    in div (created by ForwardRef(RegionsWithIntersections))
    in div (created by ForwardRef(RegionsWithIntersections))
    in ForwardRef(RegionsWithIntersections) (created by StickyOverlay)
    in StickyOverlay (created by OverlayEnabled)
    in Tracker (created by OverlayEnabled)
    in OverlayEnabled (created by FormView)
    in div (created by FormView)
    in FormView (created by DocumentPanel)
    in div (created by ForwardRef(ScrollContainer))
    in ForwardRef(ScrollContainer) (created by DocumentPanel)
    in div (created by DocumentPanel)
    in BoundaryElementProvider (created by DocumentPanel)
    in PortalProvider (created by DocumentPanel)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Card)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by ThemeColorProvider)
    in ThemeColorProvider (created by Card)
    in Card (created by DocumentPanel)
    in DocumentPanel (created by DocumentPane)
    in div (created by DocumentPane)
    in div (created by ForwardRef(ScrollContainer))
    in ForwardRef(ScrollContainer) (created by EnabledChangeConnectorRoot)
    in Tracker (created by EnabledChangeConnectorRoot)
    in EnabledChangeConnectorRoot (created by DocumentPane)
    in DialogProvider (created by DocumentPane)
    in div (created by KeyboardShortcutResponder)
    in KeyboardShortcutResponder (created by GetHookCollectionState)
    in GetHookCollectionState (created by RenderActionCollectionState)
    in RenderActionCollectionState (created by DocumentActionShortcuts)
    in DocumentActionShortcuts (created by DocumentPane)
    in LayerProvider (created by LegacyLayerProvider)
    in LegacyLayerProvider (created by DocumentPane)
    in DocumentPane (created by DocumentPaneProvider)
    in DocumentHistoryProvider (created by DocumentPaneProvider)
    in DocumentPaneProvider
    in StreamingComponent
    in StreamingComponent (created by Context.Consumer)
    in WithInitialValueWrapper (created by DeskToolPane)
    in DeskToolPane (created by DeskToolPanes)
    in SplitPaneWrapper (created by DeskToolPanes)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in PanesSplitController (created by DeskToolPanes)
    in PortalProvider (created by DeskToolPanes)
    in div (created by DeskToolPanes)
    in DeskToolPanes (created by DeskTool)
    in DeskTool (created by withRouter(DeskTool))
    in withRouter(DeskTool) (created by DeskToolPaneStateSyncer)
    in DeskToolPaneStateSyncer (created by DeskTool)
    in DeskToolFeaturesProvider (created by DeskTool)
    in DeskTool (created by RenderTool)
    in RenderTool (created by SchemaErrorReporter)
    in RouteScope (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in SchemaErrorReporter (created by DefaultLayout)
    in DefaultLayout (created by withRouter(DefaultLayout))
    in withRouter(DefaultLayout) (created by DefaultLayoutRoot)
    in RouterProvider (created by DefaultLayoutRoot)
    in LoginWrapper (created by DefaultLayoutRoot)
    in DefaultLayoutRoot (created by AppProvider)
    in div (created by styled.div)
    in styled.div (created by Box)
    in Box (created by Styled(Box))
    in Styled(Box) (created by Card)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by ThemeColorProvider)
    in ThemeColorProvider (created by Card)
    in Card (created by Styled(Card))
    in Styled(Card) (created by AppProvider)
    in SnackbarProvider (created by AppProvider)
    in ToastProvider (created by AppProvider)
    in LayerProvider (created by AppProvider)
    in PortalProvider (created by AppProvider)
    in UserColorManagerProvider (created by AppProvider)
    in AppProvider (created by SanityRoot)
    in Ge (created by ThemeProvider)
    in ThemeProvider (created by SanityRoot)
    in ZIndexProvider (created by SanityRoot)
    in SanityRoot
    in AppContainer
    ```

I followed the instructions, I do not understand why this is happening. Any help would be greatly appreciated. Thanks!

Deploying Graphql

When I run the command sanity graphql deploy I receive this error:

TypeError: Cannot read property 'get' of undefined
    at o (~/Path-to-projct/sanity/node_modules/media-chrome/dist/index.js:82:259)
    at ~/Path-to-projct/sanity/node_modules/media-chrome/dist/index.js:82:1574
    at Object.<anonymous> (~/Path-to-projct/sanity/node_modules/media-chrome/dist/index.js:792:1271)

After downgrading to version 0.3.4 I was able to deploy again without any problems.

Mux.video type name breaks sanity-codegen type generation

I'm using the sanity-codegen plugin to generate typescript types across my project but it's throwing an error due the full stop in the mux.video schema type name.

Error: Name "mux.video" is not valid. Ensure camel case, alphanumeric, and underscore characters only
    at validatePropertyName (/Users/rob/Code/ida-io/sanity/node_modules/sanity-codegen/generate-types.js:14:11)

I appreciate it's a third-party plugin and not the responsibilty of the authors of this repo but does anyone have an suggestions? Is it possble to alias the name in some form? Short of forking the whole plugin I can't think of a solution

Anybody got any ideas for a workaround?

P.S. I've raised an issue in the sanity-codegen repo as well if it'll help

Failing to prompt for mux credentials on first use

Issue description

Using v0.3.0.
While using the plugin for the first time a spinner with a message saying "Fetching credentials" appears. I have not previously added the credentials. Meanwhile the button to toggle the credentials prompt doesn't do anything.

Steps to reproduce the issue

  1. Install the plugin in a new project
  2. Add schema making use of the "mux-input" as described in the readme
  3. Start the Sanity Studio

What's the expected result?

  • To be able to toggle the credentials dialog and add the Mux Token ID and the Mux token secret.

What's the actual result?

  • The button doesn't toggle the prompt and a message saying "fetching credentials" appears.

Additional details / screenshot

  • Kapture 2021-02-09 at 11 52 52
  • Installing v0.2.1 allowed me to add the credentials.
  • After adding the credentials using v0.2.1 I upgraded to v0.3.0 and it worked as expected using the credentials.

Can't remove video from document

Our schema has videos nested within an array of content modules. Once a video is set, you can't remove it from the document, unless you delete the parent module / object.

When you remove it using these settings, it appears the video is gone:
image

image

However, when you inspect the document (or even re-open the edit modal for the array item) the video is back:

image

This seems like it could be related to #11

Allow configuring playback_policy

Hi guys!

First of all, awesome work with the plugin!

This is an awesome plugin and offers the exact functionality the majority of mux users need, however... it seems there's no way to configure playback_policy for direct uploads? This must be specified when creating the Video upload URL which IIUC is currently done server side in sanity side (/addons/mux/uploads/${studioClient.clientConfig.dataset} endpoint).

Just like the MUX-Proxy-UUID is currently passed as passthrough, there should be a way to specify something like MUX-Proxy-Playback-Policy in case we want to specify a 'signed' policy (and not the default 'public' one).

It seems that for the case of pasting a video URL into the field, this is already possible, but that's because it is a different endpoint than direct uploads.

For the time being I have implemented this on my own outside of sanity but I'd love to be able to offer this form input in the studio.

Input field logs error to console on each render

Each time the video input field is rendered (e.g. when editing a document containing a field of type mux.video, an error is logged to the console

Error: Invalid call to useReporter(field-video): A component reporting on "field-video" is already mounted in the subtree. Make sure that all reporters within the same subtree have unique ids.

…where field-video will be called something else depending on what you've named your mux.video field in your document schema (mine is called video – renaming that field will just log a similar message but e.g. useReporter(field-someOtherFieldName).

Replace `parcel` with `@sanity/pkg-utils`

Parcel have multiple times blocked new releases due to some incompatibility with a new typescript version. It hurts productivity so it's best to migrate to the same build tooling that we use in the v3 studio: @sanity/pkg-utils, which uses vite under the hood.

Signed URL support?

As far as I can tell, youre able to set up assets on the Sanity end to upload and use signed URLs (some proof here being that they display fine in Sanity and you can see ?token=... in their URLs in the Network tab). However, actually consuming these resources over the Sanity API to your frontend does not appear to work, as there doesn't seem to be a way to request down the asset's playbackId etc along with the required tokens you'd need to get these resources on the frontend (e.g.; without the token in their formatted URLs, you end up getting 403 responses from Mux within your app).

Is there any way to get signed URLs into your frontend over Sanity's API?

Audio files render a large black placeholder

When an audio file is uploaded, a large black placeholder is rendered in the studio.

A black placeholder is rendered when an audio file is uploaded.

The mux-input plugin is using the media-chrome package, which is applying this CSS rule:

:host(:not([audio])) {
    height: 480px;
    width: 720px;
}

However, media-controller in the Video component does not appear to apply the audio attribute, which would remove the large placeholder.

Screen.Recording.2021-10-29.at.11.49.58.AM.mov

The automated release is failing 🚨

🚨 The automated release from the studio-v2 branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the studio-v2 branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Adding Credentials API call is returning a 502 error

curl 'https://3sysi6ek.api.sanity.io/v1/addons/mux/secrets/production/test' \
  -H 'authority: 3sysi6ek.api.sanity.io' \
  -H 'accept: application/json' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36' \
  -H 'origin: http://localhost:3333' \
  -H 'sec-fetch-site: cross-site' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-dest: empty' \
  -H 'referer: http://localhost:3333/' \
  -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8,nl;q=0.7,fr;q=0.6,no;q=0.5,es;q=0.4,da;q=0.3,de;q=0.2,sv;q=0.1,ja;q=0.1' \
  -H 'cookie: sanitySession=REDACTED' \
  --compressed

Returns {"statusCode":502,"error":"Bad Gateway","message":"api.mux.com responded with 404 (The requested resource either doesn't exist or you don't have access to it.)"}

Not sure if this is the best place to file the issue since it seems to be a issue with the Sanity API more than the plugin. Let me know if there is a better place I can post this issue. Thanks :)

Integration with @sanity/client

@sanity/client allows to create documents with assets like images and files but I can't figure out an easy way to do so with Mux videos

See also: #180

Perhaps we can get a client extension or some documentation on how to use this plugin for programmatic upload?

Video upload keeps failing, might be the proxy's fault

I have an issue with the video upload; it keeps failing with a particular video, but it works with another, so the general setup seems to be fine. I have a standard video field in my schema:

{
      title: 'Video',
      name: 'coverVideo',
      type: 'mux.video'
},

When uploading the video, I get this message after 100%:

Screen Shot 2019-07-26 at 5 48 20 PM

"Unexpected error encountered"

The network inspector has this failed request (exported via a HAR file):

Screen Shot 2019-07-26 at 5 53 43 PM

The POST data of that request is missing here, it is:

muxBody = %7B%22input%22%3A%22%22%2C%22playback_policy%22%3A%5B%22public%22%5D%D
filename = stellenanzeige-341407777.mp4

There is no response body for this 400 response.

Finally, I can see in my mux dashboard that the video was uploaded and the following request was logged:

Screen Shot 2019-07-26 at 5 56 37 PM

Any ideas?

Add subtitles to Mux videos on Sanity

Hi, we have Mux integrated with Sanity and currently only video and audio are supported but I was checking the documentation and you also offer the possibility of adding subtitles. Could you make this be available through the Sanity integration? Thank you

Error: Cannot read property 'from' of undefined

Receiving error message 'Error: Cannot read property 'from' of undefined' in Sanity when trying to upload video and/or browsing selecting video. See loom here https://www.loom.com/share/475aed66dc724aa1bfe60cad3f1e77d6

This is with a fresh install of Sanity. Steps I took:

  1. Sanity init
  2. Chose the movie schema when creating sandbox Sanity
  3. Did 'sanity install mux-input'
  4. Added the schema in the quick start
  5. Added new video reference in movie.js schema
  6. Sanity start
  7. Tried uploading MP4 video file
  8. Upload works, but throws error message at end and won't display video
  9. Refreshing, browse to select video I can see video uploaded but cannot select

The console error message is:
react-dom.development.js:328 Uncaught TypeError: Cannot read property 'from' of undefined at Object.onSelect (Input.js:397) at SelectAsset.select (SelectAsset.js:98) at SelectAsset.select (react-hot-loader.development.js:717) at SelectAsset.js:40 at HTMLUnknownElement.callCallback (react-dom.development.js:189) at Object.invokeGuardedCallbackDev (react-dom.development.js:238) at invokeGuardedCallback (react-dom.development.js:293) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:307) at executeDispatch (react-dom.development.js:390) at executeDispatchesInOrder (react-dom.development.js:412) (anonymous) @ Input.js:397 select @ SelectAsset.js:98 select @ react-hot-loader.development.js:717 (anonymous) @ SelectAsset.js:40 callCallback @ react-dom.development.js:189 invokeGuardedCallbackDev @ react-dom.development.js:238 invokeGuardedCallback @ react-dom.development.js:293 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:307 executeDispatch @ react-dom.development.js:390 executeDispatchesInOrder @ react-dom.development.js:412 executeDispatchesAndRelease @ react-dom.development.js:3279 executeDispatchesAndReleaseTopLevel @ react-dom.development.js:3288 forEachAccumulated @ react-dom.development.js:3260 runEventsInBatch @ react-dom.development.js:3305 runExtractedPluginEventsInBatch @ react-dom.development.js:3515 handleTopLevel @ react-dom.development.js:3559 batchedEventUpdates$1 @ react-dom.development.js:21872 batchedEventUpdates @ react-dom.development.js:796 dispatchEventForLegacyPluginEventSystem @ react-dom.development.js:3569 attemptToDispatchEvent @ react-dom.development.js:4268 dispatchEvent @ react-dom.development.js:4190 unstable_runWithPriority @ scheduler.development.js:653 runWithPriority$1 @ react-dom.development.js:11040 discreteUpdates$1 @ react-dom.development.js:21888 discreteUpdates @ react-dom.development.js:807 dispatchDiscreteEvent @ react-dom.development.js:4169 createStore.js:30 Error: Invalid call to useReporter(field-video.video): A component reporting on "field-video.video" is already mounted in the subtree. Make sure that all reporters within the same <Tracker> subtree have unique ids. at add (createStore.js:30) at createUseReporter.js:42 at commitHookEffectListMount (react-dom.development.js:19732) at commitLifeCycles (react-dom.development.js:19788) at commitLayoutEffects (react-dom.development.js:22804) at HTMLUnknownElement.callCallback (react-dom.development.js:189) at Object.invokeGuardedCallbackDev (react-dom.development.js:238) at invokeGuardedCallback (react-dom.development.js:293) at commitRootImpl (react-dom.development.js:22542) at unstable_runWithPriority (scheduler.development.js:653)

Help please! :)

Error when running graphql-deploy

lerna ERR! npm run start stderr:
warning Type `SanityMuxVideoAsset` declared in `createTypes` looks like a node, but doesn't implement a `Node` interface. It's likely that you should add the `Node` interface to your type def:

`type SanityMuxVideoAsset implements Node { ... }`

If you know that you don't want it to be a node (which would mean no root queries to retrieve it), you can explicitly disable inference for it:

`type SanityMuxVideoAsset @dontInfer { ... }`
error Building schema failed

I ran into the following issue when deploying the schema using yarn run graphql-deploy

It seems to work fine in the local studio - by that I was able to set my API keys and upload a video

I followed the instructions here to install the plugin - https://github.com/sanity-io/sanity-plugin-mux-input

put duration in better place in graphQL

When querying my video content with graphql (gatsby) with the following query:

  allSanityVideos {
    edges {
      node {
        video {
          asset {
            playbackId
            thumbTime
            assetId
            status
          }
          _rawAsset(resolveReferences: {maxDepth: 2})
        }
        _id
      }
    }
  }

I am getting the duration only via _rawAsset and not via video -> asset structure. See the result below

{
  "data": {
    "allSanityVideos": {
      "edges": [
        {
          "node": {
            "video": null,
            "_id": "drafts.d970338c-1ebb-4f88-b9b4-cec9615c7e63"
          }
        },
        {
          "node": {
            "video": {
              "asset": {
                "playbackId": "cxsHvFHCpnedi02nL8kNrmvzzHYuSx84LyoA4Nh00Lv6s",
                "thumbTime": null,
                "assetId": "BSt8QSrjyqUhrEGLnMKBNqGrq8wfBmhwwZH8LyRe74A",
                "status": "ready"
              },
              "_rawAsset": {
                "_id": "296f5350-2cf9-40ea-9264-733f3af3ba7d",
                "_type": "mux.videoAsset",
                "_rev": "cWhOHnBK4b0ef4hteFMZbG",
                "_createdAt": "2021-09-03T01:09:50Z",
                "_updatedAt": "2021-09-03T01:09:57Z",
                "assetId": "BSt8QSrjyqUhrEGLnMKBNqGrq8wfBmhwwZH8LyRe74A",
                "data": {
                  "aspect_ratio": "16:9",
                  "created_at": "1630631394",
                  "duration": 1.368033,
                  "id": "BSt8QSrjyqUhrEGLnMKBNqGrq8wfBmhwwZH8LyRe74A",
                  "master_access": "none",
                  "max_stored_frame_rate": 29.97,
                  "max_stored_resolution": "SD",
                  "mp4_support": "none",
                  "passthrough": "296f5350-2cf9-40ea-9264-733f3af3ba7d",
                  "playback_ids": [
                    {
                      "id": "cxsHvFHCpnedi02nL8kNrmvzzHYuSx84LyoA4Nh00Lv6s",
                      "policy": "public"
                    }
                  ],
                  "status": "ready",
                  "tracks": [
                    {
                      "duration": 1.368033,
                      "id": "I3vSAu00fdHFlQG02eUSJcX5PZPr6UjhslSD01337pAXFk",
                      "max_frame_rate": 29.97,
                      "max_height": 540,
                      "max_width": 960,
                      "type": "video"
                    }
                  ],
                  "upload_id": "qOpRpZwWIaWniLFIolTiOL5kduC65GPjGLth8xdrPA00"
                },
                "playbackId": "cxsHvFHCpnedi02nL8kNrmvzzHYuSx84LyoA4Nh00Lv6s",
                "status": "ready",
                "uploadId": "qOpRpZwWIaWniLFIolTiOL5kduC65GPjGLth8xdrPA00",
                "id": "-51e61cef-8d54-5622-821d-20e7758f6d6a",
                "children": [],
                "internal": {
                  "type": "SanityMuxVideoAsset",
                  "contentDigest": "bd28bb324a2e85b9d376e57a4220a842",
                  "owner": "gatsby-source-sanity",
                  "counter": 651
                },
                "parent": null
              }
            },
            "_id": "027b7daa-58b1-479c-840e-40baa23f771c"
          }
        },
]}}}

I simply cant find the codeblock who is responsible for putting the clip duration which is burried under _rawAsset.data into the perfect slot right beneath playbackId and thumbTime.

Can't remove items from media library

It looks like the draft that contains the interface for removing items blocks the removal action:

"The mutation(s) failed: Document "b430b968-9037-44ab-9878-28376fb86d08" cannot be deleted as there are references to it from "drafts.b32572a0-8c4f-43f5-acc1-edf0f6ac9b64""

Uploading video file crashes desk.. even on demo.

Hi,

A bit flustered by this one. No matter what I do, I cannot get Sanity Desk to play nicely with this plugin.

I'll add a schema according to the spec, copying and pasting whats below:

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

And no matter the file size or duration, each time it crashes Sanity Desk with this error:

Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
    at checkForNestedUpdates (/static/js/vendor.bundle.js:28133:15)
    at scheduleUpdateOnFiber (/static/js/vendor.bundle.js:26204:3)
    at Object.enqueueSetState (/static/js/vendor.bundle.js:17670:5)
    at MuxVideo.956.Component.setState (/static/js/vendor.bundle.js:3554:16)
    at MuxVideo.componentDidUpdate (/static/js/app.bundle.js:97380:14)
    at MuxVideo.componentDidUpdate (/static/js/app.bundle.js:245636:123)
    at commitLifeCycles (/static/js/vendor.bundle.js:24877:22)
    at commitLayoutEffects (/static/js/vendor.bundle.js:27843:7)
    at HTMLUnknownElement.callCallback (/static/js/vendor.bundle.js:5197:14)

My Schema within the default schema file is configured as such:

// First, we must import the schema creator
import createSchema from 'part:@sanity/base/schema-creator'

// Then import schema types from any plugins that might expose them
import schemaTypes from 'all:part:@sanity/base/schema-type'

// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
  // We name our schema
  name: 'movie',
  // Then proceed to concatenate our document type
  // to the ones provided by any plugins that are installed
  types: schemaTypes.concat([
    {
        title: "Example Document Type",
        name: "exampleDocumentType",
        type: "document",
        fields: [
            {
                title: "Greeting",
                name: "greeting",
                type: "string"
            },
            {
                title: "Video file",
                name: "video",
                type: "mux.video"
            }
        ]
    }
  ])
})

The video, however, does seem to successfully upload to Mux. So I'm a bit unclear why this crash is happening.
For the record, I've tried this with both the Movies demo thats available as well as starting my own project. This product was basically exactly what I was looking for so this is quite frustrating.

Uncaught error: theme is undefined

After installing the plugin Sanity throws this error: Uncaught error: theme is undefined. The browsers developer tools don't shed any light on the issue.

Does anyone have any idea what could be going on?

Uncaught error

theme is undefined

Stack:

GlobalStyle<@http://localhost:3333/static/js/app.bundle.js:435214:15
Ne@http://localhost:3333/static/js/app.bundle.js:595:14926
Ne@http://localhost:3333/static/js/app.bundle.js:595:14698
He</t.createStyles@http://localhost:3333/static/js/app.bundle.js:595:23106
He</t.renderStyles@http://localhost:3333/static/js/app.bundle.js:595:23345
h@http://localhost:3333/static/js/app.bundle.js:595:24688
l/<@http://localhost:3333/static/js/app.bundle.js:595:24505
commitHookEffectListMount@http://localhost:3333/static/js/vendor.bundle.js:22940:26
commitLifeCycles@http://localhost:3333/static/js/vendor.bundle.js:22996:34
commitLayoutEffects@http://localhost:3333/static/js/vendor.bundle.js:26012:23
callCallback@http://localhost:3333/static/js/vendor.bundle.js:3397:14
invokeGuardedCallbackDev@http://localhost:3333/static/js/vendor.bundle.js:3446:16
invokeGuardedCallback@http://localhost:3333/static/js/vendor.bundle.js:3501:31
commitRootImpl@http://localhost:3333/static/js/vendor.bundle.js:25750:30
unstable_runWithPriority@http://localhost:3333/static/js/vendor.bundle.js:28967:12
runWithPriority$1@http://localhost:3333/static/js/vendor.bundle.js:14248:10
commitRoot@http://localhost:3333/static/js/vendor.bundle.js:25590:20
finishSyncRender@http://localhost:3333/static/js/vendor.bundle.js:25016:13
performSyncWorkOnRoot@http://localhost:3333/static/js/vendor.bundle.js:25002:23
scheduleUpdateOnFiber@http://localhost:3333/static/js/vendor.bundle.js:24397:28
updateContainer@http://localhost:3333/static/js/vendor.bundle.js:27582:15
legacyRenderSubtreeIntoContainer/<@http://localhost:3333/static/js/vendor.bundle.js:27967:22
unbatchedUpdates@http://localhost:3333/static/js/vendor.bundle.js:25112:12
legacyRenderSubtreeIntoContainer@http://localhost:3333/static/js/vendor.bundle.js:27966:21
render@http://localhost:3333/static/js/vendor.bundle.js:28049:10
render@http://localhost:3333/static/js/app.bundle.js:178493:21
@http://localhost:3333/static/js/app.bundle.js:178496:7
__webpack_require__@http://localhost:3333/static/js/vendor.bundle.js:713:30
fn@http://localhost:3333/static/js/vendor.bundle.js:118:20
@http://localhost:3333/static/js/app.bundle.js:178464:18
__webpack_require__@http://localhost:3333/static/js/vendor.bundle.js:713:30
webpackJsonpCallback@http://localhost:3333/static/js/vendor.bundle.js:26:23
@http://localhost:3333/static/js/app.bundle.js:1:13


(Your browsers Developer Tools may contain more info)

Uncaught Error when trying to select a video (when defined as an object inside a block array)

First of all β€” thanks for providing this plugin! Please bear with me as I'm new to Sanity, so nomenclature may be off.

When adding an object containing mux.video as part of a block array, I get the following error when trying to select a video:

primitive.js:41 Uncaught Error: Cannot apply deep operations on primitive values. Received patch with type "set" and path "asset that targeted the value "undefined"
    at apply (primitive.js:41)
    at applyPatch (applyPatch.js:40)
    at _apply (applyPatch.js:44)
    at apply (object.js:65)
    at applyPatch (applyPatch.js:37)
    at _apply (applyPatch.js:44)
    at Array.reduce (<anonymous>)
    at applyAll (applyPatch.js:24)
    at patchBlockData (createPatchToOperations.js:288)
    at ProxyComponent.patchToOperations (createPatchToOperations.js:471)

And my schema (in a clean project initialised by sanity init):

...
export default createSchema({
  name: 'default',
  types: schemaTypes.concat([
    {
      name: 'post',
      title: 'Post',
      type: 'document',
      fields: [
        {
          name: 'title',
          title: 'Title',
          type: 'string',
        },
        // This works
        {
          name: 'videoWithDetatils',
          title: 'Video (with details)',
          type: 'object',
          fields: [
            {
              name: 'video',
              title: 'Video',
              type: 'mux.video'
            },
            {
              name: 'caption',
              title: 'Caption',
              type: 'string'
            }
          ]
        },
        {
          name: 'body',
          title: 'Body',
          type: 'array',
          of: [
            {
              title: 'Block',
              type: 'block'
            },
            // This also works
            {
              name: 'videoSingle',
              title: 'Video (Single)',
              type: 'mux.video'
            },
            // This fails when selecting a video in the 'browse' screen
            {
              name: 'videoWithDetails',
              title: 'Video (with details)',
              type: 'object',
              fields: [
                {
                  name: 'video',
                  title: 'Video',
                  type: 'mux.video'
                },
                {
                  name: 'caption',
                  title: 'Caption',
                  type: 'string'
                }
              ],
            }
          ]
        }
      ]
    }
  ])
})

Am I missing something completely fundamental about how objects should be defined when in a block array? Please let me know if you require more info.

Link up Existing Video in Mux

Hi. Thanks so much for the plugin.

Can I ask if there's a way to associate/select a video asset that already exists in Mux e.g. by its asset ID?

Effectively, we are implementing Sanity as the CMS and need to move the existing video assets into it but don't want to re-upload them all.

Thanks!

CORS error when uploading video

I'm trying to setup the plugin in Studio v2, but it looks like I'm getting CORS issues. I've followed the setup guide and added the API credentials, but it looks like there's an issue with the request.

Any idea on how to resolve this?

Here's the deps in my Studio instance:

"dependencies": {
  "@sanity/base": "^2.25.1",
  "@sanity/cli": "^2.30.0",
  "@sanity/components": "^2.14.0",
  "@sanity/core": "^2.25.0",
  "@sanity/dashboard": "^2.26.0",
  "@sanity/default-layout": "^2.25.1",
  "@sanity/default-login": "^2.24.1",
  "@sanity/desk-tool": "^2.25.3",
  "@sanity/production-preview": "^2.29.3",
  "@sanity/vision": "^2.25.4",
  "bcp47": "^1.1.2",
  "get-youtube-id": "^1.0.1",
  "prop-types": "^15.7",
  "react": "^17.0",
  "react-dom": "^17.0",
  "react-icons": "^4.3.1",
  "react-youtube": "^8.2.1",
  "sanity-plugin-dashboard-widget-document-list": "^0.0.13",
  "sanity-plugin-iframe-pane": "^1.0.16",
  "sanity-plugin-media": "^1.4.4",
  "sanity-plugin-mux-input": "^1.1.9",
  "sanity-plugin-vercel-deploy": "^2.1.6",
  "styled-components": "^5.3.3"
}

A few screenshots:

Screenshot 2022-10-26 at 22 34 47

Screenshot 2022-10-26 at 22 35 44

duration in grapqhl

when using mux-input in sanity, i am getting back something like the following in graphql:

{
          "video": {
            "_key": null,
            "_type": null,
            "_rawAsset": {
              "_ref": "-d974861b-cac9-5f8b-a158-59418996435c"
            },
            "asset": {
              "_key": null,
              "_type": "mux.videoAsset",
              "status": "ready",
              "assetId": "2xaMSf5x36Y6fTuORL2x8HLtwfEjmStABjrriVoLR7Y",
              "playbackId": "a01x5yI6RIQjV1MkobmxSWbH8BKpxixKsSHpxZBdxK5A",
              "filename": null,
              "thumbTime": 0
            }
          },
          "title": "My Imagevideo"
        }

Is there a reason i dont get back the "duration" of the clip?

The automated release is failing 🚨

🚨 The automated release from the studio-v2 branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the studio-v2 branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Batch upload multiple videos

Is there any possibility to upload multiple videos at once in a sanity array field? Currently the array with mux.video is an object and can take a single video at a time.

Also noticed a bug when you add an entry in the array, close the modal, move on to upload the next video as an other array entry, the first video transfer is canceled.

Some context:

{
  name: 'videos',
  type: 'array',
  of: [
    {
      name: 'video',
      type: 'mux.video',
    },
  ],
}

Disable removing asset from Mux

When an asset is referenced between two documents, a user can still choose to delete the asset from Mux when removing the video from a document. If you try and do this a mutation error will display. Would it be possible to either:

  1. Have the option to disable removing from Mux completely ( we'd prefer to manage these within Mux )
  2. Stop users from removing from Mux if the asset is referenced elsewhere ( similar to how Sanity alerts when a document has references ), either by prompting the user or just disabling the option at all ( e.g. display a "This asset is used by other documents. You cannot delete it from Mux" notice )

Thanks!

Module should potentially be using named exports instead of exporting an object

The module exports from this plugin seem to be an object exported as default with the components as properties, instead of named exports. Because of that the following does not work as I expected:

import MuxInputPlugin, { Preview }  from 'sanity-plugin-mux-input'

console.log(Preview)
//null

console.log(MuxInputPlugin.Preview)
// (the component)

I think from a user perspective this is confusing and might be worth changing to named exports?

Video preview in sanity studio displays the wrong video

I found a strange bug in sanity studio. Every time I click on a new video, it shows me the video that I clicked right before. The first video that I click is empty.

After deleting everything, upgrading to sanity 2.21.0 and MuxInput 1.1.0 and uploading some videos again, the bug still remained.

bug.mov

Malformed asset error with Sanity 2.10.0

After upgrading to Sanity 2.10.0, uploading an asset using this plugin causes Sanity to crash with the following error:

Error: Malformed asset _ref 'c77166f1-da6a-478f-9c9e-d747de8dbcf2'. Expected an id like "image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg".
    at parseAssetId (/static/js/app.bundle.js:91740:13)
    at urlForImage (/static/js/app.bundle.js:91870:17)
    at ImageUrlBuilder.url (/static/js/app.bundle.js:92285:14)
    at http://localhost:3333/static/js/app.bundle.js:91545:124
    at DefaultPreview.render (/static/js/app.bundle.js:125438:39)
    at finishClassComponent (/static/js/vendor.bundle.js:20318:31)
    at updateClassComponent (/static/js/vendor.bundle.js:20268:24)
    at beginWork (/static/js/vendor.bundle.js:21778:16)
    at HTMLUnknownElement.callCallback (/static/js/vendor.bundle.js:3346:14)
    at Object.invokeGuardedCallbackDev (/static/js/vendor.bundle.js:3395:16)

Validation errors are not shown

It seems to be not possible see validation errors for mux.video type fields.

For example, the following causes a validation error but it isn't visible next to the mux.video field:

{
  type: "object",
  name: "myVideo",
  fields: [
    {
      type: "mux.video",
      name: "video",
      validation: Rule => Rule.required()
    }
  ]
}

Watermark support?

I love this plugin it's such a core part of my business! I am looking to add watermarks to my videos. It looks like it is not supported because I do not see it in the UI. It also looks like the Mux API makes it problematic to add watermarks to existing videos as I think they expect the user to clone the asset. Any thoughts on watermarks? Thank you for your work.

Asset is sometimes empty in production build

For some reason the mux asset in Gatsby is sometimes an empty object in production build with no playbackid. We fixed it by temporarily hard coding the playbackID in the front end.

Is this an issue with the mux sanity input or sanity's api or gatsby somehow?

Dangling mux.videoAsset documents remain when file uploads are not gracefully aborted

Steps to recreate

Either:

  1. Initiate an upload (either manually with a local file or via copy and paste)
  2. 'Ungracefully' abort the transaction (by navigating to another part of the studio, reloading the browser etc) before the file has completed uploading

At this point, the studio will have created a dangling and incomplete mux.videoAsset document with status === "waiting_for_upload".

Screen recording

sanity-plugin-mux-input.-.Kapture.2021-09-27.mp4

Other comments

I think Sanity's proxy is responsible creating this mux.videoAsset as part of its upload endpoint.

Perhaps the solve is deleting any associated mux.videoAsset where status !== ready || preparing when the Uploader component unmounts.

large uploads fail

Perhaps the same as #5, but, the POST data is showing up fine in the network tab.

I'm uploading a 500mb video file, which is taking about 6 minutes on my connection. After the upload reaches 100%, I see "Unexpected error occurred":

image

In the network tab, the request has failed with a 400 status. Here's what is in the Chrome network tab:

General

Request URL: https://ddpo9nmo.api.sanity.io/v1/addons/mux/assets/production?muxBody=%7B%22input%22%3A%22%22%2C%22playback_policy%22%3A%5B%22public%22%5D%7D&filename=kusama-original.mp4
Request Method: POST
Status Code: 400 
Remote Address: 35.241.31.122:443
Referrer Policy: no-referrer-when-downgrade

Response Headers

access-control-allow-credentials: true
access-control-allow-origin: https://onehundredyearplan.sanity.studio
access-control-expose-headers: Content-Type, Content-Length, ETag, X-Sanity-Deprecated, X-Sanity-Warning
access-control-max-age: 600
alt-svc: clear
content-length: 81
content-type: application/json; charset=utf-8
date: Fri, 27 Sep 2019 17:37:41 GMT
etag: W/"51-BqXby0DlGrHHO5RU6zvKO8edQhI"
status: 400
vary: Origin
via: 1.1 google

Request Headers

Provisional headers are shown
Accept: application/json
Content-Type: video/mp4
DNT: 1
MUX-Proxy-UUID: [redacted]
Origin: https://onehundredyearplan.sanity.studio
Referer: https://onehundredyearplan.sanity.studio/desk/websites;c203233e-ba1f-47f0-bc31-24d727370fe0
Sec-Fetch-Mode: cors
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36

Query String Parameters

muxBody: {"input":"","playback_policy":["public"]}
filename: kusama-original.mp4

The video has successfully uploaded to MUX, it shows up in the dashboard there. But, it's never registered as an asset in Sanity, so it can't be added to the document later.

Edit: I just tried uploading a smaller video (30mb) with the network throttled. It took 5.9 minutes and failed in the same way.

Input never sets `_type` on document.

This leaves every video field with no _type identifer, ie:

{
   asset: { _ref: '5ee373e4-4206-42ba-aee6-9da552a474a1', _type: 'reference' }
}

which should be

{
   _type: 'mux.video',
   asset: { _ref: '5ee373e4-4206-42ba-aee6-9da552a474a1', _type: 'reference' }
}

Ability to upload a mux video via Sanity programatically

Is your feature request related to a problem? Please describe.
Ability to upload a Mux video using the @sanity/client like we can do for images and files

Describe the solution you'd like
The mux video is uploadable via JS script instead of using the dashboard

Describe alternatives you've considered
Looking at the source code of the mux plugin and repeating the same code that plugin is doing internally, or just give up and load the videos manually in the dashboard

Support block content

Hi,

The Mux input works as a field on a custom document type however if I try adding it to the blockContent definition as a custom input, I get the following error:

Stack trace:

TypeError: this._input.focus is not a function
    at WithDocument.focus (/static/js/app.bundle.js:70760:19)
    at WithDocument.focus (/static/js/app.bundle.js:350865:25)
    at FormBuilderInput.focus (/static/js/app.bundle.js:39204:19)
    at FormBuilderInput.focus (/static/js/app.bundle.js:350865:25)
    at FormBuilderInput.componentDidMount (/static/js/app.bundle.js:39164:12)
    at FormBuilderInput.componentDidMount (/static/js/app.bundle.js:350855:123)
    at commitLifeCycles (/static/js/vendor.bundle.js:22535:22)
    at commitLayoutEffects (/static/js/vendor.bundle.js:25524:7)
    at HTMLUnknownElement.callCallback (/static/js/vendor.bundle.js:2909:14)
    at Object.invokeGuardedCallbackDev (/static/js/vendor.bundle.js:2958:16)

Component stack:

    in FormBuilderInput (created by DefaultObjectEditing)
    in div (created by ForwardRef(RegionsWithIntersections))
    in div (created by ForwardRef(RegionsWithIntersections))
    in ForwardRef(RegionsWithIntersections) (created by StickyOverlay)
    in StickyOverlay (created by OverlayEnabled)
    in Tracker (created by OverlayEnabled)
    in OverlayEnabled (created by DefaultObjectEditing)
    in div (created by DefaultDialogChildren)
    in div (created by ForwardRef(ScrollContainer))
    in ForwardRef(ScrollContainer) (created by DefaultDialogChildren)
    in div (created by DefaultDialogChildren)
    in div (created by DefaultDialogChildren)
    in div (created by ContainerQuery)
    in ContainerQuery (created by DefaultDialogChildren)
    in DefaultDialogChildren (created by DefaultDialog)
    in div (created by LayerChildren)
    in LayerChildren (created by Layer)
    in Portal (created by Layer)
    in LayerProvider (created by Layer)
    in Layer (created by DefaultDialog)
    in DefaultDialog (created by DefaultObjectEditing)
    in DefaultObjectEditing (created by EditObject)
    in EditObject (created by PortableTextInput)
    in BoundaryElementProvider (created by PortableTextInput)
    in div (created by PortableTextInput)
    in PortableTextInput (created by ForwardRef(PortableTextInput))
    in PortableTextEditor (created by ForwardRef(PortableTextInput))
    in ForwardRef(PortableTextInput) (created by PortableTextInputWithFocusAndBlur)
    in div (created by DefaultFormField)
    in div (created by DefaultFormField)
    in DefaultFormField (created by PortableTextInputWithFocusAndBlur)
    in PortableTextInputWithFocusAndBlur (created by withPatches(PortableTextInputWithFocusAndBlur))
    in withPatches(PortableTextInputWithFocusAndBlur) (created by FormBuilderInput)
    in ChangeIndicatorProvider (created by FormBuilderInput)
    in div (created by FormBuilderInput)
    in FormBuilderInput (created by Field)
    in div (created by Field)
    in Field (created by ObjectInput)
    in div (created by ObjectInput)
    in div (created by ObjectInput)
    in ObjectInput (created by FormBuilderInput)
    in ChangeIndicatorProvider (created by FormBuilderInput)
    in div (created by FormBuilderInput)
    in FormBuilderInput (created by SanityFormBuilder)
    in FormBuilderContext (created by SanityFormBuilderContext)
    in SanityFormBuilderContext (created by SanityFormBuilder)
    in SanityFormBuilder
    in form
    in Unknown (created by FormView)
    in div (created by ForwardRef(RegionsWithIntersections))
    in div (created by ForwardRef(RegionsWithIntersections))
    in ForwardRef(RegionsWithIntersections) (created by StickyOverlay)
    in StickyOverlay (created by OverlayEnabled)
    in Tracker (created by OverlayEnabled)
    in OverlayEnabled (created by FormView)
    in div (created by FormView)
    in FormView (created by DocumentPanel)
    in div (created by ForwardRef(ScrollContainer))
    in ForwardRef(ScrollContainer) (created by DocumentPanel)
    in div (created by DocumentPanel)
    in PortalProvider (created by DocumentPanel)
    in div (created by DocumentPanel)
    in DocumentPanel (created by DocumentPane)
    in div (created by DocumentPane)
    in div (created by ForwardRef(ScrollContainer))
    in ForwardRef(ScrollContainer) (created by EnabledChangeConnectorRoot)
    in Tracker (created by EnabledChangeConnectorRoot)
    in EnabledChangeConnectorRoot (created by DocumentPane)
    in div (created by KeyboardShortcutResponder)
    in KeyboardShortcutResponder (created by GetHookCollectionState)
    in GetHookCollectionState (created by RenderActionCollectionState)
    in RenderActionCollectionState
    in Unknown (created by DocumentPane)
    in DocumentPane (created by DocumentPaneProvider)
    in DocumentHistoryProvider (created by DocumentPaneProvider)
    in DocumentPaneProvider
    in StreamingComponent
    in StreamingComponent (created by Context.Consumer)
    in WithInitialValueWrapper (created by DeskToolPane)
    in DeskToolPane (created by DeskToolPanes)
    in SplitPaneWrapper (created by DeskToolPanes)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in div (created by Pane)
    in Pane (created by SplitPane)
    in div (created by SplitPane)
    in SplitPane (created by PanesSplitController)
    in div (created by PanesSplitController)
    in PanesSplitController (created by DeskToolPanes)
    in div (created by DeskToolPanes)
    in DeskToolPanes (created by DeskTool)
    in DeskTool (created by withRouter(DeskTool))
    in withRouter(DeskTool) (created by DeskToolPaneStateSyncer)
    in DeskToolPaneStateSyncer (created by DeskTool)
    in DeskToolFeaturesProvider (created by DeskTool)
    in DeskTool (created by RenderTool)
    in RenderTool (created by SchemaErrorReporter)
    in RouteScope (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in div (created by SchemaErrorReporter)
    in SchemaErrorReporter (created by DefaultLayout)
    in DefaultLayout (created by withRouter(DefaultLayout))
    in withRouter(DefaultLayout) (created by DefaultLayoutRoot)
    in RouterProvider (created by DefaultLayoutRoot)
    in LoginWrapper (created by DefaultLayoutRoot)
    in DefaultLayoutRoot (created by SanityRoot)
    in div (created by SanityRoot)
    in SnackbarProvider (created by SanityRoot)
    in LayerProvider (created by SanityRoot)
    in PortalProvider (created by SanityRoot)
    in UserColorManagerProvider (created by SanityRoot)
    in SanityRoot
    in AppContainer

Cannot preview videos with signed urls

When I enable the signed url settings, I get an error: url.startsWith is not a function inside of the Video component.
The video preview works fine when the enable signed url option is disabled. Not sure where I'm going wrong.

Sanity Studio: dev-preview
Sanity Mux Plugin: ^2.0.0-v3-studio.5

Audio preview/browse gives errors

Uploading audio files works, but browsing assets with audio files gives an error due to no thumbnails being found in the UI as well as in the console.

CleanShot 2022-10-24 at 09 09 38@2x

CleanShot 2022-10-21 at 10 24 03@2x

I understand that the plugin is for video, but Mux supports audio and the errors seems to come only because of the thumbnail preview.

A possible solution to support this is by changing the preview in browse (for example to a list of file names, only attempting to show thumbnails when they are present)

I'm using Mux plugin 1.1.9 on Sanity 2.35.0

Sanity Asset Missing Mux Asset Information

Hello all, I'm having some problems using the mux-input plugin. When I open the sanity studio, I can choose a video and upload it successfully to Mux, but when I try to use GROQ to retrieve information about the video, the information is incomplete. I have followed the set up guides exactly, but I am new to Sanity and Mux so I may be missing something. Anyway, here is is my course.js schema:

export default {
  title: "Video course",
  name: "videoCourse",
  type: "document",
  fields: [
    { title: "Title", name: "title", type: "string" },
    { title: "Video file", name: "video", type: "mux.video" },
  ]
}

and I've made sure to import it in my schema.js:

// import createSchema and schemaTypes
import course from "./course";
export default createSchema({
  name: "default",
  types: schemaTypes.concat([
    category,
    // others
  ])
})

What my Sanity studio looks like:

sanity-studio-flame

Proof the video was uploaded to Mux:

mux-flame

However this is what I get when I use GROQ from Sanity Vision:
sanity-vision

What am I missing to get the asset information from Mux like the playback ID?

Thanks for any help!

Allow MP4 Support

The Sanity API this is communicating with seems to be setting default values with its asset creation request. Is it possible to include the "mp4_support": "standard" line to enable MP4 transformations?

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.