bune.city/_includes/video.html

17 lines
No EOL
1 KiB
HTML

<figure class="video aligncenter">
{%- assign mime_types = "mp4,webm" | split: "," %}
{%- if mime_types contains include.extension %}{% assign type = "video/" | append: include.extension %}{% endif %}
{%- if include.qualities %}{% assign qualities = include.qualities | split: "," %}{% endif %}
<video controls preload="auto" playsinline controls class='plyr' {%- if include.qualities %} data-default='{{ qualities.first }}' {%- endif %}>
{%- if include.qualities %}
{%- for quality in qualities -%}
<source src='https://cdn.bune.city/post-media/{{ page.date | date: "%Y-%m-%d" }}-{{ page.slug }}/{{ include.name }}-{{ quality }}.{{ include.extension }}' size='{{ quality }}' {%- if type %} type="{{ type }}" {%- endif -%}>
{% endfor %}
{%- else %}
<source src='https://cdn.bune.city/post-media/{{ page.date | date: "%Y-%m-%d" }}-{{ page.slug }}/{{ include.name }}.{{ include.extension }}' {%- if type %} type="{{ type }}" {%- endif -%}>
{%- endif %}
</video>
<figcaption>
{{ include.caption }}
</figcaption>
</figure>