{# vim: set ts=2 et sts=2 sw=2: #}

<div class="video{% if params['modal'] %} modal-trigger{% endif %}">
  {% if params['modal'] %}
    <a href="{% if sources %}{{ sources[0].src }}{% else %}{{ fallback }}{% endif %}" class="video-modal-trigger-{{ video.id }}">
      <span class="video-placeholder">
        {% if params['placeholder'] %}
          {{ params['placeholder']|safe }}
        {% else %}
          <img class="video-thumbnail" src="{{ video.thumbnail_url_if_set() }}"/>
        {% endif %}
      </span>
    </a>{# /video-modal#}
    <div class="video-modal kbox" title="{% if params['title'] %}{{ params['title'] }}{% else %}{{ video.title }}{% endif %}" data-target="a.video-modal-trigger-{{ video.id }}" data-modal="true">
  {% endif %}

  <video data-fallback="{{ fallback }}" height="{{ height }}" width="{{ width }}" controls=""{% if video.poster %} poster="{{ video.poster.url }}"{% endif %}>
    {% for s in sources %}
      <source src="{{ s.src }}" type="video/{{ s.type }}">
    {% endfor %}
  </video>

  {% if params['modal'] %}
    </div>
  {% endif %}
</div>
