Skip to content

feat(card): add videoLoop, videoAutoPlay, videoDataAttributes to cards#1494

Open
ieduardogf wants to merge 13 commits intomasterfrom
feat/WEB-2336-video-props-cards
Open

feat(card): add videoLoop, videoAutoPlay, videoDataAttributes to cards#1494
ieduardogf wants to merge 13 commits intomasterfrom
feat/WEB-2336-video-props-cards

Conversation

@ieduardogf
Copy link
Collaborator

@ieduardogf ieduardogf commented Feb 10, 2026

Expose video customization props on MediaCard, CoverCard, and NakedCard when using videoSrc (replacing deprecated media prop).

  • videoLoop: control video loop behavior
  • videoAutoPlay: control autoplay (default: when-loaded)
  • videoDataAttributes: pass data attributes to the video element

Resolves WEB-2336

(This is another attempt; the previous PR (#1481) will be discarded.)

Expose video customization props on MediaCard, CoverCard, and NakedCard
when using videoSrc (replacing deprecated media prop).

- videoLoop: control video loop behavior
- videoAutoPlay: control autoplay (default: when-loaded)
- videoDataAttributes: pass data attributes to the video element

Refactor useVideoWithControls to accept object params for extensibility.
When videoAutoPlay is false, show play button instead of spinner after load.

Resolves WEB-2336

Co-authored-by: Cursor <cursoragent@cursor.com>
@ieduardogf ieduardogf requested a review from atabel February 10, 2026 10:51
@github-actions
Copy link

github-actions bot commented Feb 10, 2026

Size stats

master this branch diff
Total JS 16.5 MB 16.5 MB +744 B
JS without icons 2.42 MB 2.42 MB +744 B
Lib overhead 87.2 kB 87.2 kB 0 B
Lib overhead (gzip) 18.7 kB 18.7 kB 0 B

@ieduardogf ieduardogf added the AI AI Generated label Feb 10, 2026
@github-actions
Copy link

github-actions bot commented Feb 10, 2026

Accessibility report
✔️ No issues found

ℹ️ You can run this locally by executing yarn audit-accessibility.

@github-actions
Copy link

github-actions bot commented Feb 10, 2026

Deploy preview for mistica-web ready!

✅ Preview
https://mistica-7kph8f280-flows-projects-65bb050e.vercel.app

Built with commit ac0502f.
This pull request is being automatically deployed with vercel-action

@ieduardogf
Copy link
Collaborator Author

ieduardogf commented Feb 10, 2026

Example, playroom

@ieduardogf ieduardogf marked this pull request as ready for review February 10, 2026 17:27
@ieduardogf ieduardogf enabled auto-merge February 16, 2026 19:17
export type CardActionButtonSecondary = RendersNullableElement<typeof ButtonSecondary>;
export type CardActionButtonLink = RendersNullableElement<typeof ButtonLink>;

export type CardVideoProps = {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this export? I think it isn't used outside this file

Comment on lines -444 to -445
if (videoStatus === 'loading') {
dispatch('showSpinner');
Copy link
Contributor

Choose a reason for hiding this comment

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

I miss this case

videoSrc?: VideoSource;
videoRef?: React.RefObject<VideoElement>;
videoLoop?: boolean;
videoAutoPlay?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

missing these new props in storybook controls (in card stories)

Enhance NakedCard, CoverCard, and MediaCard stories by introducing videoLoop and videoAutoPlay props for better video control. Update argTypes in card-common for new props. Refactor video handling in card-internal to accommodate these features.
ieduardogf and others added 4 commits February 17, 2026 15:54
Introduce new screenshot tests for MediaCard, CoverCard, and NakedCard with videoAutoPlay set to false. These tests ensure the correct rendering of cards in a paused state, verifying the visual output after a video load delay.
Introduce a reference to track the initial load state of the video, ensuring that the transition to 'paused' state only occurs once per video source. This change addresses issues with Chrome firing onCanPlayThrough multiple times, which could incorrectly revert the card state while the video is playing.
These new screenshot tests were failing in CI because baseline images
cannot be generated locally (Chromium not available on macOS) and CI
doesn't auto-write new snapshots. The videoAutoPlay=false fix has been
verified through browser event monitoring.

Co-authored-by: Cursor <cursoragent@cursor.com>
Previously the button showed a Pause icon during the 'loading' state,
which was misleading when autoPlay was false. Now both 'loading' and
'loadingTimeout' states show a spinner and disable the button, so
the icon correctly reflects loading → play/pause based on autoPlay.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ieduardogf ieduardogf force-pushed the feat/WEB-2336-video-props-cards branch from 5cf373a to 79691ee Compare February 17, 2026 16:18
@github-actions
Copy link

github-actions bot commented Feb 17, 2026

Screenshot tests report

card / card-anatomy-media-card-with-footer-and-media-on-the-left
card / card-anatomy-media-card-with-footer-and-media-on-the-right
card / card-anatomy-naked-card-with-footer-and-media-on-the-left
card / card-anatomy-naked-card-with-footer-and-media-on-the-right

yceballost
yceballost previously approved these changes Feb 17, 2026
Copy link
Contributor

@yceballost yceballost left a comment

Choose a reason for hiding this comment

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

thank you Claudio 😂

@ieduardogf ieduardogf added this pull request to the merge queue Feb 17, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 17, 2026
#1494)

Expose video customization props on MediaCard, CoverCard, and NakedCard
when using videoSrc (replacing deprecated media prop).

- videoLoop: control video loop behavior
- videoAutoPlay: control autoplay (default: when-loaded)
- videoDataAttributes: pass data attributes to the video element

Resolves WEB-2336 

(This is another attempt; the previous PR
(#1481) will be
discarded.)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
@ieduardogf ieduardogf removed this pull request from the merge queue due to a manual request Feb 17, 2026
atabel
atabel previously approved these changes Feb 18, 2026
Marcosld
Marcosld previously approved these changes Feb 18, 2026
initialLoadDoneRef.current = true;
dispatch('pause');
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this is really a case that can happen, but I would just add a new state loaded so we can avoid having the comment and the ref. This state would be transitioned to only if current state is loading and this handler is called (and would show the pause icon by default).

topActions={getTopActions(topActions)}
imageSrc={imageNameToUrl[imageSrc as never]}
videoSrc={videoNameToUrl[videoSrc as never]}
videoLoop={videoLoop}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing default args for the new props below (for all the stories)

return {video};
}

const isVideoLoading = videoStatus === 'loading' || videoStatus === 'loadingTimeout';
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can safely remove 'loadingTimeout' and its related logic, as it is just the same than 'loading'.

video.pause();
} else {
video.play().then(
() => dispatch('play'),
Copy link
Contributor

Choose a reason for hiding this comment

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

We will receive this event twice (not a problem but I liked it as it was before)

ieduardogf and others added 3 commits February 18, 2026 19:12
… stories

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@ieduardogf ieduardogf dismissed stale reviews from yceballost, Marcosld, and atabel via ac0502f February 18, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI AI Generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments