Skip to content

[6.x] Support more video providers, including Cloudflare Stream - #11871

Open
edalzell wants to merge 45 commits into
statamic:6.xfrom
edalzell:feature/add-cf-to-video-fieldtype
Open

[6.x] Support more video providers, including Cloudflare Stream#11871
edalzell wants to merge 45 commits into
statamic:6.xfrom
edalzell:feature/add-cf-to-video-fieldtype

Conversation

@edalzell

Copy link
Copy Markdown
Contributor

@godismyjudge95

Copy link
Copy Markdown
Contributor

Might be worthwhile doing something similar to what I did with the embera tag - https://github.com/godismyjudge95/statamic-embera

Embera is a oembed client that takes in a video url and spits out an iframe. It has a decent number of video providers supported - https://github.com/mpratt/Embera/blob/master/doc/02-providers.md

@edalzell

Copy link
Copy Markdown
Contributor Author

Might be worthwhile doing something similar to what I did with the embera tag - godismyjudge95/statamic-embera

This is a really nice idea. I'll chat w/ the team on how they'd like to approach, as it's another dependency.

@duncanmcclean
duncanmcclean changed the base branch from ui to master June 30, 2025 18:42
@edalzell

edalzell commented Jul 1, 2025

Copy link
Copy Markdown
Contributor Author
  • 3 fields - url for pasting, dropdown for provider, video id
  • if you paste into the url, we'll extract the id and populate provider/id
  • save the provider/id

for augmenting maybe...

  • have a Video class with provider and id
  • the Video class would know how to get the regular and embed urls
  • __toString could output the non-embed url so {{ video_field }} on its own would continue to work
  • the embed_url modifier could handle a Video instance, so it could get the embed url from that

for backwards compat...

  • if your field has a url, it doesnt get augmented to a Video instance. it stays as a string.

@edalzell
edalzell marked this pull request as ready for review July 9, 2025 22:13
@edalzell
edalzell requested a review from jasonvarga July 9, 2025 22:13

@duncanmcclean duncanmcclean left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like some of the tests are failing. Are you able to take a look?

@edalzell

Copy link
Copy Markdown
Contributor Author

It looks like some of the tests are failing. Are you able to take a look?

Done

@jasonvarga
jasonvarga changed the base branch from master to 6.x January 28, 2026 16:32
@edalzell
edalzell requested a review from duncanmcclean March 19, 2026 22:44
@edalzell
edalzell requested a review from a team as a code owner June 9, 2026 20:51

@jasonvarga jasonvarga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings from review (see inline comments). Cloudflare Stream preview is provably broken as written, plus a couple of warnings worth fixing before merge. Full writeup: the Cloudflare embed never renders because the Vue component sends a bare video ID while the backend expects a cloudflare:-prefixed string; the controller test only covers the prefixed form, so it doesn't catch this.

Comment thread resources/js/components/fieldtypes/VideoFieldtype.vue Outdated
Comment thread src/Http/Controllers/CP/Fieldtypes/VideoFieldtypeController.php Outdated
Comment thread resources/js/components/fieldtypes/VideoFieldtype.vue
Comment thread tests/Fieldtypes/VideoTest.php Outdated
Comment thread src/Fieldtypes/Video/Video.php Outdated
Comment thread resources/js/components/fieldtypes/VideoFieldtype.vue Outdated
@edalzell

edalzell commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all six. Cloudflare now sends the stored cloudflare: value as url, controller only reads url. Lazy-load gating restored, ID escaped with e(), .catch() toasts, Text tests removed. Also fixed a watcher bug where a lookup that changed the provider wiped the embed and URL input. Added Vitest coverage for the component, which is what the controller test couldn't catch.

@edalzell
edalzell requested a review from jasonvarga September 8, 2026 19:45
@duncanmcclean
duncanmcclean removed their request for review September 8, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Cloudflare Stream to Video fieldtype

4 participants