> ## Documentation Index
> Fetch the complete documentation index at: https://payload-storage-bunny.seshuk.im/llms.txt
> Use this file to discover all available pages before exploring further.

# Media preview

> Show inline Bunny Stream video and audio previews in the Payload admin using the media-preview plugin and the Bunny Stream adapter.

Show inline **Bunny Stream** video and audio previews in the Payload admin — the player embedded right on the document — using the standalone [`@seshuk/payload-plugin-media-preview`](https://github.com/maximseshuk/payload-plugin-media-preview) plugin together with the Bunny Stream adapter this plugin ships.

This plugin exports a ready-made adapter at **`@seshuk/payload-storage-bunny/media-preview`**. It resolves any document whose `bunnyData.stream` carries a `videoId` and `libraryId` to Bunny Stream's iframe embed player, so Stream videos preview inline with no extra wiring.

## Install

The media-preview plugin is an optional peer — install it alongside this plugin:

<CodeGroup>
  `bash npm npm install @seshuk/payload-plugin-media-preview ` `bash pnpm pnpm add
      @seshuk/payload-plugin-media-preview ` `bash yarn yarn add @seshuk/payload-plugin-media-preview `
</CodeGroup>

## Wire it up

Register the media-preview plugin after `bunnyStorage`, passing the Bunny Stream adapter:

```ts payload.config.ts theme={null}
import { mediaPreview } from '@seshuk/payload-plugin-media-preview'
import { bunnyStorage } from '@seshuk/payload-storage-bunny'
import { bunnyStreamAdapter } from '@seshuk/payload-storage-bunny/media-preview'

export default buildConfig({
  plugins: [
    bunnyStorage({
      collections: { media: true },
      stream: {
        apiKey: process.env.BUNNY_STREAM_API_KEY,
        hostname: 'vz-abc123def-456.b-cdn.net',
        libraryId: 123456,
      },
    }),
    mediaPreview({
      adapters: [bunnyStreamAdapter],
      collections: { media: true },
    }),
  ],
})
```

## How it resolves

* Only **`video/*`** and **`audio/*`** documents are handled; anything else falls through to the media-preview plugin's other adapters and built-in viewers.
* The document must have `bunnyData.stream.videoId` and `libraryId` — i.e. it was uploaded to Bunny Stream. Files still encoding, or non-Stream files, are skipped.
* It renders an inline iframe using Bunny Stream's embed player (`iframe.mediadelivery.net`); nothing is proxied through your server.

See the [`@seshuk/payload-plugin-media-preview`](https://github.com/maximseshuk/payload-plugin-media-preview) docs for previewing other file types (images, documents), per-collection adapters, and field placement.
