Integrating video in Sanity using Mux Input and Vime/Youtube plugins
I understand the frustration with the Mux plugin issues! You have several good options for handling video in Sanity, and your URL approach is actually a solid, pragmatic solution.
Your URL approach is perfectly valid and often the simplest route. Here's how you can enhance it:
{
name: 'video',
title: 'Video',
type: 'object',
fields: [
{
name: 'url',
title: 'Video URL',
type: 'url',
description: 'Vimeo, YouTube, or direct video URL'
},
{
name: 'provider',
title: 'Video Provider',
type: 'string',
options: {
list: ['vimeo', 'youtube', 'direct']
}
},
{
name: 'thumbnail',
title: 'Thumbnail',
type: 'image',
description: 'Optional custom thumbnail'
}
]
}Other alternatives to consider:
- Native file uploads: You can use Sanity's built-in
filetype to upload video files directly to Sanity's asset CDN. This works well for smaller videos but lacks the optimization and streaming features that specialized video platforms provide.
{
name: 'video',
title: 'Video File',
type: 'file',
options: {
accept: 'video/*'
}
}Cloudinary plugin: There's a sanity-plugin-cloudinary available that supports video uploads with transcoding and optimization capabilities.
Wait for Mux plugin updates: If you specifically need Mux's features (adaptive streaming, analytics, etc.), you might check the plugin's GitHub repository for recent issues and updates. Sometimes these issues get resolved quickly.
My recommendation: If you're experiencing crashes with the Mux plugin, the URL approach you outlined is a great pragmatic solution. It's simple, reliable, and gives you full control. You can always migrate to a more integrated solution later when the plugin stabilizes or your needs change. Vimeo and YouTube handle all the transcoding and streaming optimization for you, so you're not losing much functionality compared to a full integration—especially if you're just embedding videos rather than building a complex video platform.
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.