Skip to main content

external_video

Information about an external video from YouTube or Vimeo.


Tip

Use the external_video_tag filter to output the video in an HTML <iframe> tag. Use the external_video_url filter to specify parameters for the external video player.


Properties

The alt text of the external video.

Anchor to
aspect_ratio

The aspect ratio of the video as a decimal.

Anchor to
external_id

The ID of the video from its external source.

Anchor to
host
string from a set of values

The service that hosts the video.

Possible values
youtube
vimeo

The ID of the external video.

The media type of the external video. Always returns external_video.

Example
Filter for media of a specific type

You can use the media_type property with the where filter to filter the product.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 %}

Output

<iframe frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/vj01PAffOac?controls=1&amp;enablejsapi=1&amp;modestbranding=1&amp;origin=https%3A%2F%2Fpolinas-potent-potions.myshopify.com&amp;playsinline=1&amp;rel=0" title="Potion beats"></iframe>

The position of the external video in the product.media array.

Anchor to
preview_image

A preview image of the media.

Note

Preview images don't have an ID attribute.

{
"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?