Skip to content

Instantly share code, notes, and snippets.

@rushfrisby
Forked from dvdsmpsn/html5-video-user-macro.vm
Last active August 29, 2015 14:16
Show Gist options
  • Save rushfrisby/4196368807cf26fcd4b7 to your computer and use it in GitHub Desktop.
Save rushfrisby/4196368807cf26fcd4b7 to your computer and use it in GitHub Desktop.
HTML 5 Video user macro for Confluence / updated based on user comments of original
## Macro title: HTML5 Video
## Macro has a body: N
##
## Output: HTML
##
## Developed by: David Simpson <[email protected]>
## Date created: dd/mm/yyyy
## Installed by: My Name
##
## @param width:title=Width|type=string|required=false|desc=Video width
## @param height:title=Height|type=string|required=false|desc=Video height
## @param poster:title=Poster|type=string|required=false|desc=Set a placeholder image
## @param src:title=Source|type=string|required=true|desc=Attached video filename
##
## Usage: {html5video:src=myvideo.mp4|width=600|height=400}
#set ($attachment = $content.getAttachmentNamed($paramsrc))
<video controls="controls" preload="none"
#if ($paramwidth) width="$paramwidth" #end
#if ($paramheight) height="$paramheight" #end
#if ($paramposter) poster="$paramposter" #end ## Set a placeholder image for the video
>
<source type="video/$attachment.getFileExtension()" src="$action.getGlobalSettings().getBaseUrl()$attachment.getDownloadPath()" />
<object type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"
#if ($paramwidth) width="$paramwidth" #else width="640" #end
#if ($paramheight) height="$paramheight" #else height="360" #end
>
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
<param name="allowFullScreen" value="true" />
<param name="wmode" value="transparent" />
<param name="flashVars" value="config={'playlist':[{'url':'$generalUtil.urlEncode("$action.getGlobalSettings().getBaseUrl()${attachment.getDownloadPath()}")','autoPlay':false}]}" />
<span title="No video playback capabilities!!!"></span>
</object>
</video>
<p>
<strong>Download video:</strong> <a href="$action.getGlobalSettings().getBaseUrl()$attachment.getDownloadPath()">$attachment.getFileExtension() format</a>
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment