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

Migrate fabric video to svelte #410

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dskamiotis
Copy link
Contributor

@dskamiotis dskamiotis commented Sep 27, 2024

What does this change?

Converts the Fabric Video template to Svelte.

Its important to note, we need to perform setup logic after the component renders.

  • Using the IntersectionObserver, video play logic, depends on the DOM being fully initialised, meant we needed to use the subscribe to subscribe to a store, so we can perform actions whenever the value of the store changes.
  • ad.json removed from legacy fabric video to prevent it being detected by GAM.

How to test

How can we measure success?

We can further check the functionality of the pause and the play methods by adding console.logs in the "observer" if and navigate the viewport in Preview so the fabric video is out of view.

We have added the IntersectionObserver, which is responsible for detecting when the video element enters the viewport and playing or pausing the video accordingly. Updating the previous functions in the legacy code.

Have we considered potential risks?

Images

Screen.Recording.2024-10-21.at.12.40.58.mov

Accessibility

co-authored: @Jakeii

Copy link

github-actions bot commented Sep 27, 2024

Visual regression testing results 🔍

If any tests are failing, please check that any visual changes are intentional before merging your PR.

Template Visual test status
CAPI Multiple Hosted
CAPI Multiple Paidfor
Fabric Custom
Fabric
Manual Multiple
Manual Single

@dskamiotis dskamiotis force-pushed the migrate-fabric-video-to-svelte branch 2 times, most recently from a1adcba to 60b0633 Compare October 17, 2024 09:05
@@ -49,7 +49,8 @@ type StringMessage = StandardMessage<
| 'get-page-url'
| 'passback-refresh'
| 'viewport'
| 'scroll',
| 'scroll'
| 'click',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is click actually being used anywhere?

(result) => result as { top: number; bottom: number },
);

const onViewport = () =>
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 see any references to onScroll or onViewport? Could you clarify why these are being added here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 yes this part of the inital migration but seems latrer the IntersectionObserver, which is responsible for detecting when the video element enters the viewport and playing or pausing the video accordingly.

style:--desktop-background-image={`url('${Layer3BackgroundImage}')`}
style:--desktop-background-position={Layer3BackgroundPosition}
style:--mobile-background-image={`url('${MobileLayer3BackgroundImage}')`}
style:--mobile-background-position={MobileLayer3BackgroundPosition}
Copy link
Contributor

@emma-imber emma-imber Oct 24, 2024

Choose a reason for hiding this comment

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

There's lots of duplicate code from the Fabric component - could we use that here and add the video as an option inside the component? Feels like it would be easier to maintain if we used the shared component!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@emma-imber 👍 Refactored to a more generic Fabric Component

@dskamiotis dskamiotis force-pushed the migrate-fabric-video-to-svelte branch from e2c07b1 to 9f80b57 Compare October 28, 2024 11:43
@dskamiotis dskamiotis force-pushed the migrate-fabric-video-to-svelte branch from 9f80b57 to fa4fd96 Compare October 28, 2024 14:36
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