What are you using for streaming video to confluence?
Asked by Kyle Slosek:

Hi, I am trying to get my company to use Confluence as our intranet. One thing I would like to have in Confluence is the ability to have training videos there. Now I know that the multimedia macro will work to stream media, but we have several movies that are very large (2GB or more). Our IT admins have put an upload restriction on the Confluence Server. The other issue is that we cannot upload these to any cloud system like YouTube or Vimeo per our information security policy.

With that in mind I'd like to have another server that would run as a streaming server and then be able to "embed" something like an HTML 5 or other player in Confluence. Basically I'd like to have an internal YouTube application.

What are others out there doing to overcome this issue?


Answers:
author: Stephen Deutsch
body: We stored some videos on an external server, and I wrote a user macro to allow embedding of external HTML5 videos in Confluence (mp4 files should be most compatible) based on a [user macro](https://davidsimpson.me/2013/07/28/html-5-video-user-macro-for-atlassian-confluence/) of [@David at David Simpson Apps](/t5/user/viewprofilepage/user-id/781462):

```
## Macro title: HTML5 Video
## Macro has a body: N
##
## @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
## @param External:title=External Video|type=boolean|required=true
## @param Override:title=Override Extension|type=string|required=false|desc=Enter file extension to override

#if ( $paramExternal != "true" )
 #set ( $attachment = $content.getAttachmentNamed($paramsrc) )
 #set ( $extension = $attachment.getFileExtension() )
 #set ( $path = $attachment.getDownloadPath() )
#else
 #set ( $last3 = $paramsrc.length() - 3 )
 #set ( $extension = $paramsrc.substring($last3) )
 #set ( $path = $paramsrc )
#end

#if ( $paramOverride )
 #set ( $extension = $paramOverride )
#end

#if ( $extension == "m4v" )
 #set ( $mimetype = "video/mp4" )
#else
 #set ( $mimetype = "video/" + $extension )
#end

<video controls="controls" 
 #if ($paramwidth) width="$paramwidth" #end
 #if ($paramheight) height="$paramheight" #end
 #if ($paramposter) poster="$paramposter" #end ## Set a placeholder image for the video
 src="$path">
 <source type="$mimetype" src="$path" />
</video>
<p>
 <strong>Download video:</strong> <a href="$path">$extension format</a>
</p>
```

I wrote another user macro to link to a specific time in the video:

```
## @param VideoFilename:title=Video Filename|type=string|required=true|desc=Enter file name of the video to which you want to link to a specific time
## @param Timestamp:title=Timestamp|type=string|required=true|desc=Enter timestamp in the video to which you want to jump (hh:mm:ss, mm:ss, or ss)
<a href="javascript&colon;void(0)" class="video-timestamp-link" data-video-filename="${paramVideoFilename}" data-timestamp="${paramTimestamp}">$paramTimestamp</a>
<script>

function hmsToSeconds(str) {
 var p = str.split(':'),
 s = 0, m = 1;
 while (p.length > 0) {
 s += m * parseInt(p.pop(), 10);
 m *= 60;
 }
 return s;
}

jQuery(".video-timestamp-link").click(function() {
 var v = jQuery('video[src*="' + jQuery(this).attr("data-video-filename") + '"]');
 if (v.length) {
 v.get(0).currentTime = hmsToSeconds(jQuery(this).attr("data-timestamp"));
 }
});

</script>
```

Maybe that will help :)

comments: author: Kyle Slosek
body: So that's what I was thinking... Thanks for the Macro I'll give it a shot.

So how do you have your backend server running? Is it just a regular HTTP (like Apache or IIS)? Or do you have some streaming server running?


author: Stephen Deutsch
body: Just standard HTTP, that's worked OK for us. Modern browsers are pretty good at handling static video files these days.


author: Vanisree Valaboju
body: [@Stephen Deutsch](/t5/user/viewprofilepage/user-id/781490) - In order to use the above user macro the source should be the path?

I am trying to save the vide file on server (AWS cloud), should I have to give that path?


Tags: video