external_ video
Information about an external video from YouTube or Vimeo.
Tip
Properties
The service that hosts the video.
Possible values youtube vimeo The media type of the external video. Always returns
.
ExampleFilter for media of a specific typeYou can use the
property with the
where
filter to filter theproduct.media
array for all media of a desired type.{% assign external_videos = product.media | where: 'media_type', 'external_video' %}{% for external_video in external_videos %}{{- external_video | external_video_tag }}{% endfor %}{% assign external_videos = product.media | where: 'media_type', 'external_video' %} {% for external_video in external_videos %} {{- external_video | external_video_tag }} {% endfor %}
{ "product": { "media": [ { "media_type": "external_video" }, { "media_type": "video" } ] } }
Output
<iframe frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/vj01PAffOac?controls=1&enablejsapi=1&modestbranding=1&origin=https%3A%2F%2Fpolinas-potent-potions.myshopify.com&playsinline=1&rel=0" title="Potion beats"></iframe>The position of the external video in the
product.media
array.
{
"alt": "Potion beats",
"aspect_ratio": "1.77",
"external_id": "vj01PAffOac",
"host": "youtube",
"id": 22015756402753,
"media_type": "external_video",
"position": 1,
"preview_image": {}
}
{
"alt": "Potion beats",
"aspect_ratio": "1.77",
"external_id": "vj01PAffOac",
"host": "youtube",
"id": 22015756402753,
"media_type": "external_video",
"position": 1,
"preview_image": {}
}
Was this section helpful?