audio.html 1.05 KB
Newer Older
Simon Daron's avatar
Simon Daron committed
1
{% load soundfiles %}
Simon Daron's avatar
Simon Daron committed
2
{% if sound|is_format_available:'mp3' or sound|is_format_available:'ogg' %}
Simon Daron's avatar
Simon Daron committed
3
4
5
6
7
8
9
10
11
	<!--
	<span class="controls audioControls" data-audio-control="Audio-{{ sound.file.url|slugify }}">
		<button class="playpause icon-play">{{ sound.content_types }}</button>
		<button class="icon-eye-open" title="Show/Hidden HTML5 audio player" onclick="$('#Audio-{{ sound.file.url|slugify }}').toggleClass('hidden');$(this).toggleClass('icon-eye-open icon-eye-close');return false;"></button>
		<a class="icon-download" href="{{ sound.url }}"></a>
	</span>
	-->
	<audio 
		id="Audio-{{ sound.file.url|slugify }}" 
Simon Daron's avatar
Simon Daron committed
12
		preload="{% if preload %}{{ preload }}{% else %}none{% endif %}"
Simon Daron's avatar
Simon Daron committed
13
14
		controls="{% if controls %}{{ controls }}{% else %}controls{% endif%}"
		>
Simon Daron's avatar
Simon Daron committed
15
		{% if sound|is_format_available:'ogg' %}
Simon Daron's avatar
Simon Daron committed
16
17
			<source src="{{ sound|format_url:'ogg' }}" type="audio/ogg">
		{% endif %}
Simon Daron's avatar
Simon Daron committed
18
		{% if sound|is_format_available:'mp3' %}
Simon Daron's avatar
Simon Daron committed
19
20
			<source src="{{ sound|format_url:'mp3' }}" type="audio/mpeg">
		{% endif %}
Simon Daron's avatar
Simon Daron committed
21
	</audio>  
Simon Daron's avatar
Simon Daron committed
22
{% else %}
23
	<div class="error">No sound available!</div>
Simon Daron's avatar
Simon Daron committed
24
{% endif%}