1. Home
  2. Docs
  3. Confluence
  4. Confluence User Macros
  5. Video Control

Video Control

Summary

This Confluence user macro adds an HTML5 video control element to your page that can play MP4 and OGG files.

Source Code

#* ============================================================================
 * 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.000
 * Date:    2017-08-25
 * Author:  George Lewe
 * Source:  https://github.com/glewe/video-control
 * License: GNU LGPLv3
 *
 * Macro body:      None
 * Body processing: None
 *#

#* ----------------------------------------------------------------------------
 * 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
 *#
<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
Was this article helpful to you? Yes No

Leave a Reply

Your email address will not be published. Required fields are marked *