Skip to content

Conversation

@Pintorado
Copy link

Description

This PR improves audio file handling in the Mux plugin and adds configurable MIME type validation. It builds upon the work from PR #398 by @isaac-martin.

This is a step forward in addressing issue #382, which calls for better audio file handling and support in the plugin, although there's still work to be done.

What to review

  • Added acceptedMimeTypes configuration option that allows configuring which file types are accepted by the input ('video/*' and/or 'audio/*'). Default value is ['video/*', 'audio/*']
  • Fixed audio preview after upload: audio files now display correctly in the player component after being uploaded through the uploader
  • Updated README.md with comprehensive documentation for the acceptedMimeTypes configuration option

Testing

Schema including the different options:

import { defineField, defineType } from "sanity";

export default defineType({
  name: "muxTest",
  title: "Mux Files",
  type: "document",
  fields: [
    defineField({
      name: "audioFile",
      title: "Audio File",
      type: "mux.video",
      options: {
        acceptedMimeTypes: ["audio/*"],
      },
    }),
    defineField({
      name: "videoFile",
      title: "Video File",
      type: "mux.video",
      options: {
        acceptedMimeTypes: ["video/*"],
      },
    }),
    defineField({
      name: "either",
      title: "Either File",
      type: "mux.video",
    }),
  ],
});

Try uploading audios, videos and other unsupported file types in the different uploaders. Verify that each uploader accepts only the file types specified in its acceptedMimeTypes configuration (by default, accepts both audio and video files). After uploading an audio, check that the preview displays correctly.

@vercel
Copy link

vercel bot commented Nov 21, 2025

@Pintorado is attempting to deploy a commit to the Sanity Sandbox Team on Vercel.

A member of the Team first needs to authorize it.

@R-Delfino95 R-Delfino95 self-requested a review November 21, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant