# video()

Creates a privacy-friendly video embed via iframe for YouTube

****

- Source: <https://github.com/getkirby/kirby/tree/5.5.3/config/helpers.php#L151>

****

```php
video(string $url, Kirby\Cms\File|null $poster, array $options = [ ], array $attr = [ ]): string|null
```

## Parameters

| Name | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| `$url` (required) | `string` | – | – |
| `$poster` | `Kirby\Cms\File` or `null` | – | – |
| `$options` | `array` | `[ ]` | – |
| `$attr` | `array` | `[ ]` | – |

## Return types

`string` or `null`

## Examples

### Basic example

```php
<?= video('https://www.youtube.com/watch?v=QwjX8JAwBws') ?>
```

### With parameters

You can add query parameters as arrays for the respective video type using the keys `youtube` or `vimeo`. In case you want to use both YouTube or Vimeo URLs, you can add options for both types.

```php
<?= video('https://www.youtube.com/watch?v=QwjX8JAwBws',
  [
    'youtube' => [
      'autoplay' => 1,
      'controls' => 0,
      'mute'     => 1
    ],
  ]
) ?>
```

### With additional attributes

You can add additional attributes as a third parameter:

```php
<?= video('https://www.youtube.com/watch?v=QwjX8JAwBws',
  [
    'youtube' => [
      'autoplay' => 1,
      'controls' => 0,
      'mute'     => 1
    ],
  ],
  [
    'class' => 'myvideo'
  ]
) ?>
```