Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎉 mp4 videos in articles #2731

Merged
merged 2 commits into from
Oct 11, 2023
Merged

🎉 mp4 videos in articles #2731

merged 2 commits into from
Oct 11, 2023

Conversation

ikesau
Copy link
Member

@ikesau ikesau commented Oct 10, 2023

A quick component for inline videos in our articles in advance of the Grapher redesign post.

I opted to implement this without syncing the file from Google Drive like we do for images, as we're likely going to refactor that code soon with CF Images anyway, and it'd be a lot of extra complexity for a feature we're probably not going to use very much.

This means we'll need to ensure our mp4 files are hosted somewhere stable (in my demo I'm using a DO bucket) - these will be tracked in the posts_gdocs_links table so we can keep an eye on them and make sure they're not 404'ing.

The filename property used with the poster attribute for the video, which is recommended if you're using preload="none" for the video element.

These images are getting baked and resized like all our other images, even though we're only using the source image for the poster. If we think it's worth it, we could add an event listener to pick a resized version for further mobile pagespeed improvements.

{.video}
url: https://owid-image-upload.nyc3.cdn.digitaloceanspaces.com/staging/bunny.mp4
caption: hello [world](https://en.wikipedia.org/wiki/World){ref}Refs work here too{/ref}
filename: bunny-poster.jpg
shouldLoop: true
{}
video.demo.mp4

@ikesau
Copy link
Member Author

ikesau commented Oct 10, 2023

TODO: add documentation for this component once it's merged

Copy link
Member

@mlbrgl mlbrgl left a comment

Choose a reason for hiding this comment

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

LGTM. I agree, not over-engineering this feature seems like a good call given how rarely we've reached out for videos until now.

video: {
type: "video",
url: "https://ourworldindata.org/assets/videos/example.mp4",
filename: "https://ourworldindata.org/assets/images/example-poster.mp4",
Copy link
Member

Choose a reason for hiding this comment

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

nit: .jpg?

Copy link
Member

Choose a reason for hiding this comment

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

was updating/adding the explorer, image--wide and toc layouts intentional in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

yup, just alphabetised and removed some redundancies

@ikesau ikesau merged commit d867c3c into master Oct 11, 2023
12 checks passed
@ikesau ikesau deleted the videos branch October 11, 2023 17:22
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.

2 participants