2024-02-27 23:51:33 +03:00
|
|
|
{% assign video_url = include.src %}
|
2024-04-04 19:54:50 +03:00
|
|
|
{% assign title = include.title %}
|
2024-02-27 23:51:33 +03:00
|
|
|
{% assign poster_url = include.poster %}
|
2024-04-04 19:54:50 +03:00
|
|
|
{% assign types = include.types | default: '' | strip | split: '|' %}
|
2024-02-27 23:51:33 +03:00
|
|
|
|
|
|
|
{% unless video_url contains '://' %}
|
|
|
|
{%- capture video_url -%}
|
2024-04-12 23:34:48 +03:00
|
|
|
{% include media-url.html src=video_url %}
|
2024-02-27 23:51:33 +03:00
|
|
|
{%- endcapture -%}
|
|
|
|
{% endunless %}
|
|
|
|
|
|
|
|
{% if poster_url %}
|
|
|
|
{% unless poster_url contains '://' %}
|
|
|
|
{%- capture poster_url -%}
|
2024-04-12 23:34:48 +03:00
|
|
|
{% include media-url.html src=poster_url subpath=page.media_subpath %}
|
2024-02-27 23:51:33 +03:00
|
|
|
{%- endcapture -%}
|
|
|
|
{% endunless %}
|
|
|
|
{% assign poster = 'poster="' | append: poster_url | append: '"' %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% assign attributes = 'controls' %}
|
|
|
|
|
|
|
|
{% if include.autoplay %}
|
|
|
|
{% assign attributes = attributes | append: ' ' | append: 'autoplay' %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if include.loop %}
|
|
|
|
{% assign attributes = attributes | append: ' ' | append: 'loop' %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if include.muted %}
|
|
|
|
{% assign attributes = attributes | append: ' ' | append: 'muted' %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<p>
|
2024-04-04 19:54:50 +03:00
|
|
|
<video class="embed-video file" {{ poster }} {{ attributes }}>
|
|
|
|
{% assign extension = video_url | split: '.' | last %}
|
|
|
|
{% assign types = extension | concat: types %}
|
|
|
|
|
|
|
|
{% assign ext_size = extension | size %}
|
|
|
|
{% assign src_size = video_url | size %}
|
|
|
|
{% assign slice_size = src_size | minus: ext_size %}
|
|
|
|
|
|
|
|
{% assign filepath = video_url | slice: 0, slice_size %}
|
|
|
|
|
|
|
|
{% for type in types %}
|
|
|
|
{% assign src = filepath | append: type %}
|
|
|
|
{% assign media_item = site.data.media | find: 'extension', type %}
|
|
|
|
{% assign mime_type = media_item.mime_type | default: type %}
|
|
|
|
<source src="{{ src }}" type="video/{{ mime_type }}">
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
Your browser does not support the video tag. Here is a
|
|
|
|
<a href="{{ video_url | strip }}">link to the video file</a> instead.
|
2024-02-27 23:51:33 +03:00
|
|
|
</video>
|
2024-04-04 19:54:50 +03:00
|
|
|
{% if title %}
|
|
|
|
<em>{{ title }}</em>
|
|
|
|
{% endif %}
|
2024-02-27 23:51:33 +03:00
|
|
|
</p>
|