GROQ query for Mux video asset returning only _ref instead of full data

9 replies
Last updated: Nov 29, 2025
I am currently trying to integrate Mux video playback in my Sanity project with a plain react FE.
I am using the 'mux-input' plugin for uploading integration in the studio and that works perfect.
🙂
i want to use the 'sanity-mux-player' for showing the videos on client side, and i have been following this guide :
https://www.sanity.io/blog/first-class-responsive-video-support-with-the-new-mux-plugin
But when i try and query with the GROQ example i only get a _ref in the video asset. According to the guide i should be getting a lot more data.

I have also tried to query everything on the video type and i still don't get anymore data back.

What is the correct GROQ query?

Any help or tips on how to query the data with GROQ correctly would be greatly appreciated Thanks.
🙂
AI Update

The issue you're encountering is a common one when working with Mux videos in Sanity! You're getting just a _ref because you need to use the dereference operator (->) in your GROQ query to expand the reference and get the full asset data.

The blog post example you're following uses Mux video inside a Portable Text field (that's what the text[] part is about), but it sounds like you have a direct video field on your document instead.

For a direct video field on your document type, your GROQ query should look like this:

*[_type == "video"]{
  ...,
  'video': video.asset->
}

This will dereference the asset and give you all the Mux asset data including playbackId, status, data, and other metadata that the sanity-mux-player component needs.

If you want to be more explicit about what data you're fetching, you can also write it like:

*[_type == "video"]{
  ...,
  video {
    asset-> {
      playbackId,
      status,
      data
    }
  }
}

The key is that -> operator after asset - that tells GROQ to follow the reference and return the actual asset document instead of just the reference object with _ref.

Once you have the playbackId in your query results, you can pass the asset data directly to the sanity-mux-player component's assetDocument prop, and it should handle the rest! The player component expects the full asset document with all the Mux metadata, which is why dereferencing is essential here.

Show original thread
9 replies

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.

Was this answer helpful?