Skip to main content

video

Information about a video uploaded as product media or a file_reference metafield.


Tip

Use the video_tag filter to output the video in an HTML <video> tag.


Properties

The alt text of the video.

Anchor to
aspect_ratio

The aspect ratio of the video as a decimal.

The duration of the video in milliseconds.

The ID of the video.

The media type of the model. Always returns 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 videos = product.media | where: 'media_type', 'video' %}

{% for video in videos %}
{{- video | video_tag }}
{% endfor %}

Output

<video playsinline="playsinline" preload="metadata" aria-label="Potion beats" poster="//polinas-potent-potions.myshopify.com/cdn/shop/products/4edc28a708b7405093a927cebe794f1a.thumbnail.0000000_small.jpg?v=1655255324"><source src="//polinas-potent-potions.myshopify.com/cdn/shop/videos/c/vp/4edc28a708b7405093a927cebe794f1a/4edc28a708b7405093a927cebe794f1a.HD-1080p-7.2Mbps.mp4?v=0" type="video/mp4"><img src="//polinas-potent-potions.myshopify.com/cdn/shop/products/4edc28a708b7405093a927cebe794f1a.thumbnail.0000000_small.jpg?v=1655255324"></video>

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

Anchor to
preview_image

A preview image for the video.

Anchor to
sources
array of video_source

The source files for the video.

{
"alt": "Potion beats",
"aspect_ratio": 1.779,
"duration": 34801,
"id": 22070396551233,
"media_type": "video",
"position": 2,
"preview_image": {},
"sources": []
}
Was this section helpful?