Reference
Field value
Section titled “Field value”A Video Scribe field returns a VideoScribeValue object with the following properties and methods.
| Property / method | Returns | Description |
|---|---|---|
video.hasVariants | bool | Whether any transcoded variants exist |
video.variants | VariantRecord[] | All saved variants (silently drops any with missing assets or deleted presets) |
video.variant(handle) | VariantRecord|null | A specific variant by preset handle |
video.source | Asset|null | The original source file, if Keep source was enabled |
Variant properties
Section titled “Variant properties”Each item in video.variants (and the return of video.variant(handle)) is a VariantRecord:
| Property | Type | Description |
|---|---|---|
variant.url | string|null | CDN/volume URL of the video file |
variant.mimeType | string | e.g. video/webm; codecs="vp9" |
variant.thumbnailUrl | string|null | URL of the poster JPEG |
variant.thumbnail | Asset|null | Poster as a Craft Asset (supports image transforms) |
variant.width | int|null | Pixel width |
variant.height | int|null | Pixel height |
variant.duration | float|null | Duration in seconds |
variant.size | int|null | File size in bytes |
variant.asset | Asset|null | The video Craft Asset element |
Example
Section titled “Example”{% set video = entry.heroVideo %}
{% if video and video.hasVariants %} {% set v = video.variants | first %} {# {{ v.width }}×{{ v.height }}, {{ v.duration }}s, {{ v.size / 1024 / 1024 | round(1) }} MB #}
<video poster="{{ v.thumbnailUrl }}" width="{{ v.width }}" height="{{ v.height }}" muted autoplay loop playsinline > {% for variant in video.variants %} <source src="{{ variant.url }}" type="{{ variant.mimeType }}"> {% endfor %} </video>{% endif %}