The `ExternalVideo` component renders an embedded video for the Storefront API's [ExternalVideo object](https://shopify.dev/api/storefront/reference/products/externalvideo).
import {ExternalVideo} from '@shopify/hydrogen-react';
export default function MyProductVideo({products}) {
const firstMediaElement = products.nodes[0].media.nodes[0];
if (firstMediaElement.__typename === 'ExternalVideo') {
return <ExternalVideo data={firstMediaElement} />;
}
}
import {ExternalVideo} from '@shopify/hydrogen-react';
import type {ProductConnection} from '@shopify/hydrogen-react/storefront-api-types';
export default function MyProductVideo({
products,
}: {
products: ProductConnection;
}) {
const firstMediaElement = products.nodes[0].media.nodes[0];
if (firstMediaElement.__typename === 'ExternalVideo') {
return <ExternalVideo data={firstMediaElement} />;
}
}
Takes in the same props as a native `<iframe>` element, except for `src`.
An object with fields that correspond to the Storefront API's [ExternalVideo object](https://shopify.dev/api/storefront/reference/products/externalvideo).
An object containing the options available for either [YouTube](https://developers.google.com/youtube/player_parameters#Parameters) or [Vimeo](https://vimeo.zendesk.com/hc/en-us/articles/360001494447-Using-Player-Parameters).
0 | 1 | boolean