For Video or Images
Quite often a client will want a component that accepts both videos and images.
Our Media
component is that catch-all.
Unless we know for a fact that the client will be uploading only images, we recommend reaching for the Media component whenever possible.
Quite simply, you pass whatever media is coming down via the media
prop. In sanity, we provide a condition
option where the client can choose the type of media they're uploading (image, video, etc.)
The Media
component uses this condition
value to determine what component is ultimately rendered.
You also have the option of passing down videoControls
, as well as type
and ratio
for further fine-tuning.