# Media

> Editor42 Media plugin — enables inserting and editing embedded media content such as video, audio, iframes, and embed/object elements.

Source: https://editor42.com/plugins/media  
Every page of editor42.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://editor42.com/llms-full.txt

Plugin alias: `media`

```js
editor42.init({
  plugins: 'media'
});
```

Enables inserting and editing embedded media content such as video, audio, iframes, and embed/object elements. Media elements are replaced with placeholder images for safe editing in the editor, then restored on serialization. Supports live embed previews, custom URL resolvers, and template callbacks.

## Options

| Option | Type | Default | Description |
|---|---|---|---|
| `audio_template_callback` | function | — | Custom HTML for audio. |
| `video_template_callback` | function | — | Custom HTML for video. |
| `iframe_template_callback` | function | — | Custom HTML for iframes. |
| `media_live_embeds` | boolean | `true` | Live preview in editor. |
| `media_filter_html` | boolean | `true` | Sanitize embed HTML. |
| `media_url_resolver` | function | — | Async URL-to-embed resolver. |
| `media_alt_source` | boolean | `true` | Show alt source field. |
| `media_poster` | boolean | `true` | Show poster field. |
| `media_dimensions` | boolean | `true` | Show width/height. |

## Commands

| Command | Description |
|---|---|
| `editor42Media` | Opens media dialog. |

## Toolbar buttons

| Button | Type | Description |
|---|---|---|
| `media` | Toggle button | Active when media is selected. |

## Menu items

| Item | Description |
|---|---|
| `media` | Opens media dialog. |

## API

| Method | Description |
|---|---|
| `showDialog()` | Programmatically opens the media dialog. |
