Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions content/collections/fieldtypes/video.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Video
description: Extract embed URLs from Youtube, Vimeo, and HTML5 compatible video links and preview them right inline.
description: Extract embed URLs from Youtube, Vimeo, Cloudflare Stream, and HTML5 compatible video links and preview them right inline.
intro: |
Extract embed URLs from Youtube, Vimeo, and HTML5 compatible video links and preview them right inline. Feel free watch the whole thing instead of working – we won't tell.
Extract embed URLs from Youtube, Vimeo, Cloudflare Stream, and HTML5 compatible video links and preview them right inline. Feel free watch the whole thing instead of working – we won't tell.
screenshot: fieldtypes/screenshots/v6/video.webp
screenshot_dark: fieldtypes/screenshots/v6/video-dark.webp
id: ced8b901-95bd-4006-b70e-4ea04d72fcb7
Expand All @@ -15,8 +15,11 @@ You may enter:

- YouTube URLs: `https://www.youtube.com/watch?v=s9F5fhJQo34`
- Vimeo URLs: `https://vimeo.com/22439234`
- Cloudflare Stream URLs: `https://customer-abc123.cloudflarestream.com/b209b1484821fff0ed2e5535fbb4ff7b/watch`
- mp4, ogv, mov, or webm URLs: `http://example.com/video.mp4`

For Cloudflare Stream, use the URL from the **Video Link** button in the Cloudflare dashboard. The `/iframe` URL from the embed code works too, and keeps any player options (like `autoplay` or `muted`) from its query string. Manifest URLs (`.m3u8` and `.mpd`) can't be embedded.

## Data Structure

The Video field will save the URL of the video you've entered. If you paste embed code into the field, it will extract the proper URL for you.
Expand All @@ -35,7 +38,7 @@ You can use the [is_embeddable](/modifiers/is_embeddable) and
::tab antlers
```antlers
{{ if video | is_embeddable }}
<!-- Youtube and Vimeo -->
<!-- Youtube, Vimeo, and Cloudflare Stream -->
<iframe src="{{ video | embed_url }}" ...></iframe>
{{ else }}
<!-- Other HTML5 video types -->
Expand All @@ -45,7 +48,7 @@ You can use the [is_embeddable](/modifiers/is_embeddable) and
::tab blade
```blade
@if (Statamic::modify($video)->isEmbeddable()->fetch())
<!-- Youtube and Vimeo -->
<!-- Youtube, Vimeo, and Cloudflare Stream -->
<iframe src="{{ Statamic::modify($video)->embedUrl() }}" ...></iframe>
@else
<!-- Other HTML5 video types -->
Expand Down Expand Up @@ -79,10 +82,10 @@ The video field is augmented into an object that still outputs the URL you enter
| Variable | Description |
|----------|-------------|
| `url` | The URL that was entered. |
| `provider` | `youtube`, `vimeo`, `file` (a direct link to a video file), or `unsupported`. |
| `id` | The YouTube or Vimeo video ID. `null` for other providers. |
| `provider` | `youtube`, `vimeo`, `cloudflare`, `file` (a direct link to a video file), or `unsupported`. |
| `id` | The YouTube, Vimeo, or Cloudflare Stream video ID. `null` for other providers. |
| `privacy_hash` | The privacy hash of an unlisted Vimeo video (e.g. the `abc123` in `vimeo.com/22439234/abc123`). `null` otherwise. |
| `embed_url` | The embeddable player URL for YouTube and Vimeo, the URL itself for video files, or `null` for anything unsupported. |
| `embed_url` | The embeddable player URL for YouTube, Vimeo, and Cloudflare Stream, the URL itself for video files, or `null` for anything unsupported. |

This lets you check the provider directly rather than reaching for modifiers:

Expand Down
2 changes: 1 addition & 1 deletion content/collections/modifiers/embed_url.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ modifier_types:
- string
title: 'Embed Url'
---
Converts a Youtube or Vimeo link to their embed URLs.
Converts a Youtube, Vimeo, or Cloudflare Stream link to their embed URLs.

Plays nicely with the [Video fieldtype](/fieldtypes/video) and the [is_embeddable modifier](/modifiers/is_embeddable).

Expand Down
2 changes: 1 addition & 1 deletion content/collections/modifiers/is_embeddable.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ modifier_types:
- string
title: 'Is Embeddable'
---
Recognizes YouTube and Vimeo URLs as supported embed sources. This does not check whether the video exists or whether its owner permits embedding.
Recognizes YouTube, Vimeo, and Cloudflare Stream URLs as supported embed sources. This does not check whether the video exists or whether its owner permits embedding.

Plays nicely with the [Video fieldtype](/fieldtypes/video) and the [embed_url modifier](/modifiers/embed_url).

Expand Down