-
Notifications
You must be signed in to change notification settings - Fork 30
Resume looping video when re-enters viewport #14133
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
Conversation
Size Change: +380 B (+0.04%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
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. |
// not want videos to play automatically, e.g. prefers reduced motion. Otherwise, | ||
// we do not need to download the image as the video will be autoplayed. | ||
const posterImage = | ||
!!prefersReducedMotion || isInView === false |
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.
why do we need to grab the image if the video is not in view?
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.
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.
Looks great!
'PAUSED_BY_USER', | ||
'PAUSED_BY_INTERSECTION_OBSERVER', | ||
] as const; | ||
|
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 really like this type, it makes the intent of the loop video very easy to follow.
Seen on PROD (merged by @domlander 8 minutes and 53 seconds ago) Please check your changes! |
What does this change?
useIsInView
to be able to know for certain whether an element it out of view. This is helpful because we don't want to display (and therefore download) the poster image if the video is in view and will autoplay.hasAudio
check. We don't yet receive this flag.webm
option. This is not yet implemented and we will only receive mp4 files for now.Why?
Minor bug fixes, code quality improvement
Screenshots
Play muted video when 50% of player re-enters viewport
Screen.Recording.2025-06-25.at.16.24.42.mov
Prefers reduced motion: ON
Screen.Recording.2025-06-25.at.16.27.22.mov