This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/source/_partials/talk/video.html.twig

44 lines
1.1 KiB
Twig

{% macro videoSrc(talk) %}
{# TODO: Cleanup once videos have been added to talks properly. #}
{% set videoType = talk.video.type %}
{% set videoId = talk.video.id %}
{% if talk.youtube %}
{% set videoType = 'youtube' %}
{% set videoId = talk.youtube.id %}
{% endif %}
{% if talk.vimeo %}
{% set videoType = 'vimeo' %}
{% set videoId = talk.vimeo.id %}
{% endif %}
{% set srcUrls = {
youtube: '//www.youtube.com/embed',
videopress: 'https://videopress.com/embed',
vimeo: 'https://player.vimeo.com/video',
} %}
{{ srcUrls[videoType] ~ '/' ~ videoId }}
{% endmacro %}
{% from _self import videoSrc %}
{# TODO: Cleanup once videos have been added to talks properly. #}
{% if page.youtube.id or page.vimeo.id or page.video %}
<div class="mt-4">
<h2 class="mb-2">Video</h2>
<div class="video-full">
<iframe
width="678"
height="408"
src="{{ videoSrc(page) }}"
frameborder="0"
allowfullscreen
>
</iframe>
</div>
</div>
{% endif %}