# Media

> The discriminated union returned anywhere a connector or component schema yields an image, video, or audio asset. Three variants, source-driven rendering through the Media component.

A product has images. A hero banner has a background image. A blog post has a featured image. A category card might have a video. A podcast episode has an audio file. The shape connectors and editors return for all of these is the same `Media` discriminated union: a `type` field plus a list of source URLs (one per variant the renderer can pick from). The storefront's [`<Media>`](/laioutr-ui/ui-kit/general/media) component reads the sources, picks the right one for the current viewport, and hands the chosen URL to nuxt-image so the right provider can serve it.

```ts
import type { Media } from '@laioutr-core/core-types/common';

type Media = MediaImage | MediaVideo | MediaAudio;
```

The variants exist because the renderer treats them differently. An image renders as a `<picture>` with responsive `<source>` tags. A video needs a `<video>` element with controls. An audio asset needs an `<audio>` element. All three wrap a list of sources, and each source carries the nuxt-image `provider` name (or, for video and audio, the streaming format) that tells the renderer how to fetch and serve that particular URL.

## Choosing a variant

<table>
<thead>
  <tr>
    <th>
      Variant
    </th>
    
    <th>
      Use it for
    </th>
    
    <th>
      Renders as
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a href="#mediaimage">
        <code>
          image
        </code>
      </a>
    </td>
    
    <td>
      Photographs, illustrations, product shots, hero backgrounds
    </td>
    
    <td>
      <code>
        <picture>
      </code>
      
       with responsive <code>
        <source>
      </code>
      
       tags via nuxt-image
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="#mediavideo">
        <code>
          video
        </code>
      </a>
    </td>
    
    <td>
      Product demos, hero loops, autoplay backgrounds
    </td>
    
    <td>
      Built-in native <code>
        <video>
      </code>
      
       (override with your own renderer)
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="#mediaaudio">
        <code>
          audio
        </code>
      </a>
    </td>
    
    <td>
      Podcasts, voice-overs, music previews
    </td>
    
    <td>
      Built-in native <code>
        <audio>
      </code>
      
       (override with your own renderer)
    </td>
  </tr>
</tbody>
</table>

If you're a connector returning a product's main image, use `MediaImage`. If you're an editor picking from the media library, the schema field gives you all three, optionally restricted via `allowedTypes`.

## Variants

### MediaImage

```ts
{
  type: 'image';
  sources: MediaSourceImage[];      // at least one
  alt?: string;
  aiDisclosure?: MediaAiDisclosure;
  placeholder?: MediaSourcePlaceholder;
}
```

Use this for any still asset. The `sources` array is the heart of the type: one entry per variant the renderer can choose from. A single static source covers the simple case. Multiple sources let you ship separate files for mobile and desktop, or different formats for different providers.

`alt` is the default alt text. The renderer uses it unless overridden via the `<Media>` component's `alt` prop.

`placeholder` shows a low-quality preview while the real image loads. See [Placeholders](#placeholders).

### MediaVideo

```ts
{
  type: 'video';
  sources: MediaSourceVideo[];      // at least one
  poster?: MediaImage;
  tracks?: MediaTextTrack[];
  alt?: string;
  aiDisclosure?: MediaAiDisclosure;
}
```

Use this for moving assets. The `poster` field carries a still image shown by the player before playback starts; it maps directly to the HTML `<video poster="…">` attribute. The `tracks` field carries timed text tracks (subtitles, captions, chapters); see [Text tracks](#text-tracks).

The [`<Media>`](/laioutr-ui/ui-kit/general/media) component renders `MediaVideo` with a built-in native `<video>` player (the `poster` becomes its `poster` attribute). Playback is set with props on `<Media>` — a `playback` mode (`interactive` or `background`) plus the individual `controls` / `autoplay` / `muted` / `loop` / `playsinline` / `disablePictureInPicture` overrides — not stored on the value. For adaptive streaming (HLS/DASH) or a custom player UI, register your own renderer with `provideMediaRenderers` to override the built-in. See [Rendering video and audio](/laioutr-ui/ui-kit/general/media#rendering-video-and-audio).

### MediaAudio

```ts
{
  type: 'audio';
  sources: MediaSourceAudio[];      // at least one
  cover?: MediaImage;
  tracks?: MediaTextTrack[];
  alt?: string;
  aiDisclosure?: MediaAiDisclosure;
}
```

Use this for audio-only assets such as podcasts, voice-overs, or music previews. The `cover` field carries an image the player can show alongside the audio (album art, podcast cover); the HTML `<audio>` element has no native poster, so the player overlays this image itself. The `tracks` field carries timed text tracks (chapters, descriptions, transcripts); see [Text tracks](#text-tracks).

The [`<Media>`](/laioutr-ui/ui-kit/general/media) component renders `MediaAudio` with a built-in native `<audio>` player, showing the `cover` image above it (since `<audio>` has no native poster). Override it with your own renderer through `provideMediaRenderers`, the same way as video. See [Rendering video and audio](/laioutr-ui/ui-kit/general/media#rendering-video-and-audio).

## AI disclosure

All three variants share an optional `aiDisclosure`, recording how generative AI was involved in producing the asset.

```ts
type MediaAiDisclosure = 'generated' | 'modified';
```

<table>
<thead>
  <tr>
    <th>
      Value
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        'generated'
      </code>
    </td>
    
    <td>
      Fully AI-generated, no human-authored element
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        'modified'
      </code>
    </td>
    
    <td>
      Human-authored content altered by generative AI
    </td>
  </tr>
  
  <tr>
    <td>
      absent
    </td>
    
    <td>
      No disclosure is known — there is nothing to disclose
    </td>
  </tr>
</tbody>
</table>

**Absent does not assert that an asset is human-made.** It means laioutr holds no disclosure for it, which covers both an asset that genuinely is not AI-touched and one whose backend simply told us nothing.

The field describes the depicted content, so it is the same across every responsive variant, format and crop — which is why it sits on the media object rather than on the individual sources. A video's `poster` and an audio's `cover` are themselves images and carry their own, independent disclosure: a camera-shot video can legitimately have an AI-generated poster frame.

<note>

Nothing in the storefront renders this field. `<Media>` ignores it. It is the data foundation for a disclosure label, not the label itself.

</note>

## Sources

A `Media` object is mostly its `sources`: each one is a self-contained URL plus the metadata the renderer needs to pick and serve it.

### MediaSourceImage

```ts
{
  provider: string;                 // nuxt-image provider name
  src: string;                      // URL or provider-specific id
  origin?: MediaOrigin;             // producing library + stable asset id (see Source origin)
  width?: number;
  height?: number;
  responsive?: 'static' | 'mobile' | 'desktop';
  focalPoint?: [number, number];    // [x, y] as fractions, e.g. [0.5, 0.5] for center
}
```

`provider` is the most load-bearing field. It tells nuxt-image which adapter to use to fetch and resize this URL. Common values are `'shopify'` (Shopify CDN), `'cloudinary'`, `'directus'`, `'sanity'`, custom names registered by your app, or `'none'` (a [nuxt-image built-in](https://image.nuxt.com/providers/none)) to pass the URL through unchanged.

`width` and `height` are the source's natural dimensions. Set them when the backend gives you that information. The renderer uses them to set the `<img>` `width`/`height` attributes (preventing layout shift) and to compute the native aspect ratio when `aspectRatio={true}` is passed.

`responsive` marks a source as mobile-only or desktop-only. See [Responsive sources](#responsive-sources).

`focalPoint` lets the editor (or the connector) declare which part of the image should remain visible when the renderer crops the image. `[0.5, 0.5]` is center; `[0.0, 0.0]` is top-left.

### MediaSourceVideo

```ts
{
  provider: string;
  src: string;
  origin?: MediaOrigin;             // producing library + stable asset id (see Source origin)
  width: number;                    // required for video
  height: number;                   // required for video
  length?: Duration;                // ISO 8601 duration string
  format?: string;                  // e.g. 'mp4', 'webm'
  responsive?: 'static' | 'mobile' | 'desktop';
  streaming?: 'progressive' | 'hls' | 'dash';
  focalPoint?: [number, number];    // [x, y] as fractions, e.g. [0.5, 0.5] for center
}
```

Width and height are required because video players need them up front to reserve layout space. `length` is an ISO 8601 duration (`'PT1M30S'` for 90 seconds). `format` lets the renderer pick the best source for the browser when multiple formats are provided. `streaming` declares the delivery format of this source; see [Streaming formats](#streaming-formats).

`focalPoint` works as it does on image sources. The built-in `MediaVideo` renderer applies it as `object-position`, resolved per viewport, so the important region stays in frame when the video is cropped by `object-fit: cover`. Sources without one fall back to `center center`.

### MediaSourceAudio

```ts
{
  provider: string;
  src: string;
  origin?: MediaOrigin;             // producing library + stable asset id (see Source origin)
  format?: string;                  // MIME type, e.g. 'audio/mpeg'
  length?: Duration;                // ISO 8601 duration string
  streaming?: 'progressive' | 'hls' | 'dash';
}
```

Audio sources skip width and height (an `<audio>` element reserves no layout space for the media itself). `format` is the MIME type, e.g. `'audio/mpeg'`, `'audio/aac'`, `'audio/ogg'`, or `'application/vnd.apple.mpegurl'` for an HLS manifest. `length` is an ISO 8601 duration. `streaming` declares the delivery format; see [Streaming formats](#streaming-formats).

### MediaSourcePlaceholder

```ts
type MediaSourcePlaceholder = ['solid', string] | ['thumbhash', string];
```

A two-element tuple. The first element picks the placeholder style; the second element carries the data. `'solid'` takes a hex color. `'thumbhash'` takes a [thumbhash](https://evanw.github.io/thumbhash/) string (Shopify produces these out of the box). Both render under the real image until it loads.

### Source origin

Every source can carry an optional `origin` recording which media library produced it and that library's stable id for the asset:

```ts
interface MediaOrigin {
  libraryId: string;     // the producing library's id (the media library's `.mediaLibrary()` id)
  externalId?: string;   // the asset's stable id within that library (Shopify gid, Shopware media UUID, …)
}
```

`origin` is **management-plane data**: the storefront renderer never reads it (it keys off `src` + `provider`). It exists so future re-resolution and orphan-detection can find the source asset behind a stored URL. It lives on the **source**, not the whole media, because an art-directed image can compose sources from different assets — even different libraries.

You rarely set `origin` by hand. When an asset is picked from a [media library](/frontend/features/media), the `.mediaLibrary()` wrapper stamps it onto every source automatically from the connector's item-level `externalId`. A pasted raw URL has no `origin`. The field is optional and additive, so media stored before it existed remain valid.

## Responsive sources

A `Media` value can ship separate sources for mobile and desktop. The renderer picks one per viewport based on the `responsive` field on each source:

- `'static'` (or omitted): the source works on all viewports. This is the default.
- `'mobile'`: the renderer uses this source below the desktop breakpoint.
- `'desktop'`: the renderer uses this source at and above the desktop breakpoint.

When both a mobile and a desktop source are present, the renderer emits a `<picture>` element with two `<source>` tags and a media query, letting the browser pick. When only one source exists, it's used everywhere.

```ts
const responsiveBanner: MediaImage = {
  type: 'image',
  alt: 'Summer collection 2026',
  sources: [
    { provider: 'shopify', src: 'https://cdn.shopify.com/.../mobile.jpg', width: 750, height: 1000, responsive: 'mobile' },
    { provider: 'shopify', src: 'https://cdn.shopify.com/.../desktop.jpg', width: 2400, height: 800, responsive: 'desktop' },
  ],
};
```

The desktop breakpoint defaults to `md` (the laioutr-ui theme breakpoint). Pass `desktopBreakpoint` to the `<Media>` component to change it.

## Placeholders

Placeholders give you something to show on screen before the full image arrives, eliminating the visual jank of a blank box jumping into a photo.

```ts
{
  type: 'image',
  sources: [...],
  placeholder: ['solid', '#1a1a1a'],
}
```

```ts
{
  type: 'image',
  sources: [...],
  placeholder: ['thumbhash', 'wXj5SoJ4eIB3iIeHf...'],
}
```

`'solid'` is the right choice when the connector knows the dominant color of the image (Shopify exposes this; some DAMs do too). `'thumbhash'` produces a tiny blurred preview that looks like the real image at very low resolution. Both are inline (no extra HTTP request).

## Streaming formats

Video and audio sources can declare how the asset is delivered through the `streaming` field. The renderer needs this to decide whether the source can be handed straight to the browser or whether it needs a JavaScript player to demux it.

- `'progressive'` (or omitted): a single self-contained file (e.g. MP4 for video, MP3 or AAC for audio). The browser picks one source at load time and stays on it. No adaptive bitrate.
- `'hls'`: an HLS manifest (`.m3u8`). Native adaptive bitrate in Safari; other browsers need `hls.js` plus MSE.
- `'dash'`: a DASH manifest (`.mpd`). No browser supports it natively; needs `dash.js` or Shaka plus MSE.

If the field is omitted, treat the source as `progressive`. Mix streaming and progressive sources in the same `sources` array if you want the renderer to fall back when MSE is not available.

## Text tracks

`MediaVideo` and `MediaAudio` both accept a `tracks` array of `MediaTextTrack` for subtitles, captions, chapters, descriptions, or arbitrary metadata. Each track maps to one HTML `<track>` element.

```ts
{
  src: string;                      // URL to a WebVTT (.vtt) or SRT file
  kind: 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata';
  srclang?: string;                 // BCP-47 tag, e.g. 'en', 'de-DE'
  label?: string;                   // shown in the player's track-selection UI
  default?: boolean;                // enable when no other track matches user preferences
}
```

Use `subtitles` for translations, `captions` for transcriptions that also describe non-speech audio, `descriptions` for audio descriptions of the visual content, `chapters` for timed navigation points, and `metadata` for tracks consumed by JavaScript rather than displayed to the user.

```ts
const lectureVideo: MediaVideo = {
  type: 'video',
  sources: [{ provider: 'mux', src: 'https://stream.mux.com/.../lecture.m3u8', width: 1920, height: 1080, streaming: 'hls' }],
  poster: lecturePoster,
  tracks: [
    { src: 'https://cdn.example.com/lecture.en.vtt', kind: 'subtitles', srclang: 'en', label: 'English', default: true },
    { src: 'https://cdn.example.com/lecture.de.vtt', kind: 'subtitles', srclang: 'de', label: 'Deutsch' },
    { src: 'https://cdn.example.com/lecture.chapters.vtt', kind: 'chapters', srclang: 'en' },
  ],
};
```

## Rendering Media

A `Media` value is just data. Turning it into pixels on the page is the job of the `<Media>` UI Kit component, which reads the sources, picks the right one for the viewport, and hands the URL to nuxt-image:

```vue [components/SomeBlock.vue]
<script setup lang="ts">
import type { MediaImage } from '@laioutr-core/core-types/common';
const props = defineProps<{ image: MediaImage }>();
</script>

<template>
  <Media :media="props.image" sizes="100vw md:50vw" />
</template>
```

The component handles responsive source selection, focal-point cropping, placeholder display, lazy loading, and the `imagesizes`/`imagesrcset` link tags for above-the-fold preloading. See the [`<Media>` component reference](/laioutr-ui/ui-kit/general/media) for the full prop list.

<warning>

Laioutr's frontend-core registers nuxt-image with `provider: 'none'` at the module level, which disables the global default; each source's `provider` field is what selects an adapter at render time. The same name `'none'` is also a valid per-source provider: it's nuxt-image's built-in pass-through that returns the URL unchanged. If you set a source's `provider` to a name nobody has registered, nuxt-image errors at provider-resolution time rather than silently falling back.

</warning>

## For connector authors

This is the section that prevents the most common bug in connector code: returning media the storefront can't render efficiently. The rule is short:

> Map your backend's asset shape to a `Media` object with the right `provider`. Never return a bare URL string, never default everything to `'none'`, and never drop the dimensions when the backend gives them to you.

### Wrong

```ts
// Shopify connector, product media handler
return {
  cover: product.featuredImage.url,                        // ❌ bare string
  gallery: product.images.map((img) => ({ url: img.url })), // ❌ ad-hoc shape
};
```

This breaks for three independent reasons:

1. **Bare strings aren't Media.** The frontend doesn't know whether this is an image or a video, what its dimensions are, or which nuxt-image provider can serve it. Components that expect `Media` will type-error or misrender.
2. **No provider.** The renderer can't ask Shopify's CDN to resize the image, so users download full-resolution originals on every viewport.
3. **No dimensions.** The `<img>` tag ships without `width`/`height`, causing layout shift as each image arrives.

### Right

```ts
// Shopify connector, product media handler
import type { MediaImage } from '@laioutr-core/core-types/common';

const toMediaImage = (img: ShopifyImage): MediaImage => ({
  type: 'image',
  alt: img.altText ?? '',
  placeholder: img.thumbhash ? ['thumbhash', img.thumbhash] : undefined,
  sources: [
    {
      provider: 'shopify',
      src: img.url,
      width: img.width,
      height: img.height,
    },
  ],
});

return {
  cover: toMediaImage(product.featuredImage),
  gallery: product.images.map(toMediaImage),
};
```

The connector says "this is an image, served by Shopify's CDN, with these dimensions and this thumbhash for the LQIP." The frontend's nuxt-image setup decides how to resize, format, and lazy-load it. Multi-viewport rendering, placeholder behavior, and preloading all stay where they belong: in the storefront.

### Picking the right `provider`

The `provider` field must match a nuxt-image provider that the storefront has configured (or that your app registers). Common cases:

<table>
<thead>
  <tr>
    <th>
      If the asset comes from…
    </th>
    
    <th>
      Use <code>
        provider
      </code>
    </th>
    
    <th>
      Notes
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Shopify Files / Storefront API
    </td>
    
    <td>
      <code>
        'shopify'
      </code>
    </td>
    
    <td>
      Built into the Shopify app; supports CDN resizing parameters
    </td>
  </tr>
  
  <tr>
    <td>
      Cloudinary
    </td>
    
    <td>
      <code>
        'cloudinary'
      </code>
    </td>
    
    <td>
      Configure with your Cloudinary cloud name
    </td>
  </tr>
  
  <tr>
    <td>
      A DAM with a custom URL scheme
    </td>
    
    <td>
      a custom name you register
    </td>
    
    <td>
      Register a <a href="https://image.nuxt.com/advanced/custom-provider" rel="nofollow">
        nuxt-image provider
      </a>
      
       in your app
    </td>
  </tr>
  
  <tr>
    <td>
      A plain CDN URL with no resize API
    </td>
    
    <td>
      <code>
        'none'
      </code>
    </td>
    
    <td>
      nuxt-image built-in pass-through; skips optimization but works
    </td>
  </tr>
</tbody>
</table>

Picking `'none'` everywhere "to keep things simple" gives up the bandwidth savings and format conversion that nuxt-image is there to do. Spend the time wiring up the right provider; it pays back on every page load.

### Returning responsive sources

If your backend stores separate mobile and desktop assets (Hygraph and many DAMs let editors crop per breakpoint), return them both with the `responsive` field set:

```ts
{
  type: 'image',
  alt: hero.alt,
  sources: [
    { provider: 'hygraph', src: hero.mobile.url, width: hero.mobile.width, height: hero.mobile.height, responsive: 'mobile' },
    { provider: 'hygraph', src: hero.desktop.url, width: hero.desktop.width, height: hero.desktop.height, responsive: 'desktop' },
  ],
}
```

If your backend only stores one asset, return one source with `responsive: 'static'` (or omit `responsive`). The renderer handles both cases.

## Related

- [`<Media>` component](/laioutr-ui/ui-kit/general/media): the UI Kit component that renders `Media` values.
- [Media Library](/frontend/features/media): how editors pick `Media` values from connected backends in Cockpit, and how to add a media library provider for your asset system.
- [`media` schema field](/apps/app-development/schema-fields#media): the editor-facing media picker that produces a `Media` value.
- [nuxt-image documentation](https://image.nuxt.com/): provider configuration, sizes syntax, and image optimization concepts.

<style>

html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}

</style>

## Changelog

```yaml
Media:
  - version: 0.34.0
    type: added
    changelog: frontend
    note: >-
      Every source gained an optional
      [`origin`](/frontend/api-reference/common-types/media#source-origin) (`{
      libraryId, externalId? }`) recording the media library that produced it
      and that library's stable asset id. It is stamped automatically when an
      asset is picked from a media library, and is management-plane only — the
      renderer never reads it. Additive and optional, so media stored before it
      existed stay valid.
  - version: 0.30.1
    type: added
    changelog: frontend
    note: >-
      Added an [`audio`](/frontend/api-reference/common-types/media#mediaaudio)
      variant, plus [text
      tracks](/frontend/api-reference/common-types/media#text-tracks) and
      [streaming
      formats](/frontend/api-reference/common-types/media#streaming-formats) for
      video. Studio `media` fields can restrict to it with `allowedTypes:
      ['audio']`.
  - version: 0.30.1
    type: changed
    breaking: true
    changelog: frontend
    note: >-
      `MediaVideo.preview` was renamed to `MediaVideo.poster` to match the HTML
      `<video poster>` attribute.
    migration: >
      Rename the field on every `MediaVideo` you construct or read.


      ```ts

      // Before

      const video: MediaVideo = { type: 'video', sources, preview: posterImage
      };

      // After

      const video: MediaVideo = { type: 'video', sources, poster: posterImage };

      ```
  - version: 0.30.1
    type: changed
    breaking: true
    changelog: frontend
    note: >-
      The `Media` union was widened to include `MediaAudio`, so `media.type` can
      now be `'audio'`.
    migration: >
      Any exhaustive `switch (media.type)` without a `default` branch must add
      an

      `'audio'` case, or TypeScript reports a non-exhaustive switch.


      ```ts

      switch (media.type) {
        case 'image': return renderImage(media);
        case 'video': return renderVideo(media);
        case 'audio': return renderAudio(media); // new
      }

      ```
```
