-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaudio-control.vtl
42 lines (36 loc) · 1.56 KB
/
audio-control.vtl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#** ===========================================================================
AUDIO CONTROL
This Confluence user macro adds an HTML5 audio control element to your page
that can play MP3, OGG and WAV files.
Version: 1.1.0
Updated: 2021-01-08
Author/s: George Lewe
Source: https://github.com/glewe/confluence-user-macros
License: GNU LGPLv3
Macro Body Processing: No macro body
*#
#** ---------------------------------------------------------------------------
PARAMETERS
*#
## @param File:title=File|type=string|desc=Enter the file name of the audio file. It needs to be attached to the page.|default=myfile.mp3
## @param Format:title=Audio Format|type=enum|enumValues=mp3,mp4,ogg,wav|desc=Select the audio format of the file.|default=mp3
## @param Filename:title=Show File Name|type=boolean|desc=Select to display the file name underneath the control. This might not show in the preview on the right.|default=false
#** ---------------------------------------------------------------------------
INPUT
*#
#if (!$paramFormat)
#set ($paramFormat="mpeg")
#elseif ($paramFormat=="mp3")
#set ($paramFormat="mpeg")
#end
#** ---------------------------------------------------------------------------
OUTPUT
*#
<!-- User Macro: Audio Control START -->
<audio controls>
<source src="/download/attachments/$content.getIdAsString()/$paramFile" type="audio/$paramFormat">Your browser does not support this HTML5 audio element.
</audio>
#if ($paramFilename==true)
<p style="margin-top:-4px; font-style:italic">$paramFile</p>
#end
<!-- User Macro: Audio Control END -->