Issue with fetching Mux video type in Sanity schema using Groq
Hey! I'd be happy to help you with Mux video issues. Since your question is pretty general, let me cover the most common issues people run into with the Mux video plugin and how to solve them:
Common Issues & Solutions:
Setup & Configuration
- Make sure you've installed the plugin:
npm install sanity-plugin-mux-input - You need to add the plugin to your
sanity.config.tsand configure it with your Mux credentials - Don't forget to set up the required environment variables for your Mux token ID and signing key
- Make sure you've installed the plugin:
Schema Definition
- In your schema, you should define the field using the
mux.videotype (not just a regular object) - Example:
{ name: 'video', title: 'Video', type: 'mux.video' }- In your schema, you should define the field using the
Upload Issues
- If videos aren't uploading, check your Mux account has sufficient quota
- Verify your API credentials are correct and have the right permissions
- Large files may take time to process - there's a known issue where large uploads (500MB+) can fail with "Unexpected error occurred" after reaching 100%
Playback/Preview Issues
- Make sure you're querying the video asset correctly in GROQ
- You'll need to use Mux's player SDK in your frontend to actually play the videos
- The plugin stores references to Mux assets, not the actual video files
CORS Errors
- Add your domain to Mux's allowed domains in their dashboard
If you're using Media Library (Enterprise feature):
The newer Media Library with video support works differently:
- Uses
defineVideoFieldfromsanity/media-libraryinstead ofmux.video - Videos are streamed directly from Sanity's CDN
- Requires Studio v4.0.1+ and the video addon to be enabled
Could you share more details about what specifically isn't working? For example:
- Are you using the Mux plugin or Media Library?
- Is the upload failing?
- Are videos not appearing in the studio?
- Is playback not working on your frontend?
- Any specific error messages?
That would help me give you more targeted advice!
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.