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

[BUG] Fix ExternalVideo render error in Gallery.client.jsx and update ExternalVideo to support embed compatible urls #454

Closed
johncraigcole opened this issue Jan 12, 2022 · 0 comments
Labels
bug Something isn't working hydrogen-ui Components, hooks, and utilities

Comments

@johncraigcole
Copy link
Contributor

Describe the bug
If a given product resource has an external video the Gallery.client.jsx component causes a render error because an EXTERNAL_VIDEO_TYPE does not have an image attribute like that of MODEL_3D_TYPE and VIDEO_TYPE.

galler client jsx-error

In Gallery.client.jsx Handling the external video type similar to MODEL_3D_TYPE prevents the render error from happening

const galleryMedia = media.filter((med) => {
    if (
      med.mediaContentType === MODEL_3D_TYPE ||
      med.mediaContentType === VIDEO_TYPE || 
      med.mediaContentType === EXTERNAL_VIDEO_TYPE
    ) {
      return true;
    }

    return !med.image.url.includes(featuredMediaSrc);
  });

but then uncovers that embeddedUrl returned from the Storefront API is not actually an embed compatible url that will properly render in an iFrame.
Screen Shot 2022-01-11 at 8 26 42 PM

The ExternalVideoType of the Storefront API has been adjusted to deprecate embeddedUrl and introduce two new fields. embedUrl and originUrl. The embedUrl field represents an iFrame embed compatible URL and should be used instead of embeddedUrl.

To Reproduce

  • The initial render error noted above can be seen here which is a product with an external video from this stackblitz instance.
  • After observing the render error for the bach-c-trumpet you can adjust the Gallery.client.jsx component as illustrated above to further see the error in connecting to youtube.com. Manually adjusting the iFrame source with browser tools to a proper embed compatible url will correct the connection error.

Expected behaviour
External videos added to product resources in Shopify should render and properly connect via the iFrame to the supported external video services Youtube and Vimeo.

@johncraigcole johncraigcole added the bug Something isn't working label Jan 12, 2022
@elisenyang elisenyang added the hydrogen-ui Components, hooks, and utilities label Jan 12, 2022
frehner added a commit that referenced this issue Feb 11, 2022
frehner added a commit that referenced this issue Mar 4, 2022
* fix: external video product issues (close #454)

* Update types and fix prop issue in test

* add changeset

Co-authored-by: Anthony Frehner <[email protected]>
rafaelstz pushed a commit to rafaelstz/hydrogen that referenced this issue Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hydrogen-ui Components, hooks, and utilities
Projects
None yet
Development

No branches or pull requests

2 participants