Skip to content

Move self-hosted video dimensions to Source object#15556

Merged
domlander merged 1 commit intomainfrom
doml/sh-move-dimensions-model
Mar 23, 2026
Merged

Move self-hosted video dimensions to Source object#15556
domlander merged 1 commit intomainfrom
doml/sh-move-dimensions-model

Conversation

@domlander
Copy link
Contributor

@domlander domlander commented Mar 18, 2026

What does this change?

Updates the MainMedia type:

  • Removes width and height
  • Adds aspectRatio

Updates the Source type:

  • Adds width and height

Why?

We will soon be transcoding multiple videos per MIME type. This has the goal of improving the experience for users, by downloading a smaller video if they have a small screen. Since each source will have different width and height values, the dimensions of the video should live on each source, rather than the parent.

Dimensions are no longer passed in to the SelfHostedVideo component as these are now indeterminable on the server. The aspect ratio is known, however, and it is passed to the component so that the browser is still informed of the size that the video will take up, to prevent CLS.

@domlander domlander self-assigned this Mar 18, 2026
@domlander domlander added run_chromatic Runs chromatic when label is applied fronts + curation maintenance Departmental tracking: maintenance work, not a fix or a feature labels Mar 18, 2026
@domlander domlander force-pushed the doml/sh-move-dimensions-model branch from 55c2b65 to 88796bb Compare March 18, 2026 16:43
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 18, 2026
@github-actions
Copy link

github-actions bot commented Mar 18, 2026

@domlander domlander force-pushed the doml/sh-move-dimensions-model branch from 88796bb to 652d6dd Compare March 19, 2026 12:30
@domlander domlander changed the title WIP - Move self-hosted video dimensions to source object Move self-hosted video dimensions to Source object Mar 19, 2026
@domlander domlander added the run_chromatic Runs chromatic when label is applied label Mar 19, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 19, 2026
@domlander domlander marked this pull request as ready for review March 19, 2026 14:10
@github-actions
Copy link

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

Comment on lines 222 to 223
height={height}
width={width}
Copy link
Contributor

Choose a reason for hiding this comment

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

are these okay to be undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is better than providing a guess at width & height (i.e. by using the largest available), then possibly updating later if it's not correct, but I'm not 100% on that. We can revisit later if we find out this causes an issue, although I think it'll be fine.

Comment on lines +309 to +310
const [width, setWidth] = useState<number | undefined>();
const [height, setHeight] = useState<number | undefined>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these derived from the loaded asset?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. On the client, once the video data has loaded, these values will be set

@domlander domlander requested review from abeddow91 and removed request for abeddow91 March 23, 2026 11:49
@domlander domlander merged commit 3579a1e into main Mar 23, 2026
36 checks passed
@domlander domlander deleted the doml/sh-move-dimensions-model branch March 23, 2026 15:15
@domlander domlander mentioned this pull request Mar 23, 2026
@gu-prout
Copy link

gu-prout bot commented Mar 23, 2026

Overdue on PROD (merged by @domlander 30 minutes and 7 seconds ago) What's gone wrong?

@gu-prout
Copy link

gu-prout bot commented Mar 23, 2026

Seen on PROD (merged by @domlander 33 minutes and 59 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fronts + curation maintenance Departmental tracking: maintenance work, not a fix or a feature Seen-on-PROD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants