-
Notifications
You must be signed in to change notification settings - Fork 30
Cinemagraphs #14826
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
Cinemagraphs #14826
Conversation
91a81cb to
fba9ff8
Compare
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
fba9ff8 to
98989b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of functionality, this works well 👏
I've detailed in the PR but i've found the checks for isCinemagraph a bit hard to follow and I wonder if we would lift these up to a single decision point and pass that down, leaving the player agnostic to the video type.
I'm also not sure about keeping LoopVideo as the component as this now seems to be an optional characteristic of the player - similar to autoplay - rather than its explicit function, given that self hosted videos are now separated out into 'Loop' | 'Cinemagraph' | 'Default'. As far as I'm aware, the only thing that makes this player a loop player is setting loop=true
I wonder if its worth refactoring the player to be more generic before we implement Cinemagraph but I don't think this is blocking at this point.
| {/* This overlay is styled when the CardLink is hovered */} | ||
| {(mediaType === 'picture' || | ||
| mediaType === 'slideshow' || | ||
| (mediaType === 'loop-video' && isCinemagraph)) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this media type correct?
I thought this should be SelfHostedVideo following #14827
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a different type CardMediaType: https://github.com/guardian/dotcom-rendering/blob/main/dotcom-rendering/src/types/layout.ts#L24
I understand this is confusing and could be refactored...I had a look and it wasn't trivial to do, so I have left it for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've addressed this here: c1693a9
| <MediaWrapper | ||
| mediaSize={mediaSize} | ||
| mediaType={media.type} | ||
| isCinemagraph={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just pass the videoStyle here instead of creating a new abstraction?
| activeCue={activeCue} | ||
| isCinemagraph={isCinemagraph} | ||
| /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somewhat personal preference but I find the isCinemagraph repetition quite tricky to parse and I wonder about how this might scale.
I did wonder about having a loop video wrapper to pass video preferences down depending on videoStyle rather than determining them all here. Do you have any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering about having bundling up the player options so that we don't need to pepper the component with checks. Something like
const playerProps = {
showPlayIcon: !isCinemagraph,
enableSubtitles: !isCinemagraph,
enableAudioControls: !isCinemagraph,
pointerEventsNone: isCinemagraph,
trackingStyle: videoStyle,
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed on the repetition being terrible. I have refactored to remove the duplication.
| !!subtitleSource && | ||
| !!subtitleSize && | ||
| !!activeCue?.text && | ||
| !isCinemagraph; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check isCinemagraph here given we dont pass subtitleSource or subtitleSize the level above if it isCinemagraph?
| 'current' in ref && | ||
| ref.current && | ||
| isPlayable && | ||
| !isCinemagraph && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check isCinemagraph here given we set this at the wrapper above
showPlayIcon={!isCinemagraph ? showPlayIcon : false}
| /* used in custom subtitle overlays */ | ||
| activeCue?: ActiveCue | null; | ||
| /* Cinemagraphs do not display subtitles or video controls */ | ||
| isCinemagraph: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've mentioned this below but I think we can get rid of this if we explicitly set props using isCinemagraph prior to this.
| type="button" | ||
| onClick={handleAudioClick} | ||
| css={audioButtonStyles} | ||
| data-link-name={`gu-video-loop-${ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment we are specifying loop in the tracking.
Should this be the video style now rather than one hardcoded property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be handled in a follow up PR - these components should be renamed given they will soon be handling non-loops
33c30e4 to
8bc8a72
Compare
abeddow91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. Thanks for taking the time to refactor this.
8bc8a72 to
3554a19
Compare
|
Seen on PROD (merged by @domlander 7 minutes and 54 seconds ago) Please check your changes! |
What does this change?
Creates an option for looping videos to present cinemagraph-like behaviour.
Cinemagraphs are looping videos with the following changes:
Why?
So that we can show a cinemagraph style of video on our fronts.
Screenshots
Note: the cursor is a pointer when not in Screenshare mode
Screen.Recording.2025-11-12.at.10.34.15.mov