The video object

The video object can be accessed from the product object's media attribute. It contains information about a video uploaded from the product details page in the Shopify admin.

This page describes the different attributes of the video object.

video.alt

Returns the alt tag of the video set on the product details page of the Shopify admin.

video.aspect_ratio

Returns the aspect ratio of the video source file.

video.duration

Returns the duration of the video source file.

video.id

Returns the media_id of the video.

video.media_type

Returns the type of the object (video). This can be used to filter the product object's media array.

Input

{% assign videos = product.media | where: "media_type", "video" %}

{% for video in videos %}
  {{ video.alt }}
{% endfor %}

Output

Promotional video for stroller
Features video for stroller

video.position

Returns the position of the video in the product object's media array.

video.preview_image

Returns a preview image for the video.

video.sources

Returns an array of video source objects.

Ready to start selling with Shopify?

Try it free