{% load i18n cms_tags %}

{% with instance.audio_file.extension as ext %}
    <audio controls
        {% if instance.text_title %} title="{{ instance.text_title }}"{% endif %}
        {% if instance.attributes %} {{ instance.attributes_str }}{% endif %}>
        <source src="{{ instance.audio_file.url }}" type="audio/{% if ext == "mp3" %}mpeg{% else %}{{ ext }}{% endif %}">
        {{ instance.text_description }}
        {% for plugin in instance.child_plugin_instances %}
            {% render_plugin plugin %}
        {% endfor %}
    </audio>
{% endwith %}

{% comment %}
    # https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio
    # https://github.com/divio/django-filer/blob/master/filer/models/filemodels.py
    {{ instance.audio_file }}
    # Available variables:
    {{ instance.text_title }}
    {{ instance.text_description }}
    {{ instance.attributes_str }}
{% endcomment %}
