-
Notifications
You must be signed in to change notification settings - Fork 4
/
video-control.vtl
47 lines (40 loc) · 1.99 KB
/
video-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
43
44
45
46
47
#** ===========================================================================
VIDEO CONTROL
This Confluence user macro adds an HTML5 video control element to your page
that can play MP4 and OGG files.
Version: 1.1.1
Updated: 2022-01-09
Author/s: George Lewe
Source: https://github.com/glewe/confluence-user-macros
License: GNU LGPLv3
Macro Body Processing: No macro body
*#
#** ---------------------------------------------------------------------------
* PARAMETER
*#
## @param File:title=File|type=string|desc=Enter the file name of the video file. It needs to be attached to the page.|default=myvideo.mp4
## @param Format:title=Audio Format|type=enum|enumValues=mp4,ogg|desc=Select the audio format of the file.|default=mp4
## @param showFilename: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 left.|default=false
## @param Width:title=Width|type=string|desc=Enter the width of the video display on the page. Leave empty for original width of the video.|default=
## @param Height:title=Height|type=string|desc=Enter the height of the video display on the page. Leave empty for original height of the video.|default=
#** ---------------------------------------------------------------------------
PROCESS INPUT
*#
#if (!$paramFormat)
#set ($paramFormat="mp4")
#elseif ($paramFormat=="mp4")
#set ($paramFormat="mp4")
#else
#set ($paramFormat="ogg")
#end
#set($paramCaption="")
#if ($paramshowFilename==true)
#set($paramCaption="<p style='margin-top:-4px; font-style:italic'>$paramFile</p>")
#end
#** ---------------------------------------------------------------------------
OUTPUT
*#
<!-- User Macro: Video Control START -->
<video width="$paramWidth" height="$paramHeight" controls><source src="/download/attachments/$content.getIdAsString()/$paramFile" type="video/$paramFormat">Your browser does not support this HTML5 video element.</video>
$paramCaption
<!-- User Macro: Video Control END -->