How Kaltura video integration is done in confluence?

As the user gives the kaltura video url , i have written the code to auto convert the url to Widgetconnector macro. Can anyone help me on framing the iframe tag which is to be displayed in UI with thumbnail.

3 answers

1 accepted

this was my java code and am rendering the velocity params to the vm.

public class KalturaWidgetRenderer implements WidgetRenderer {

private final VelocityRenderService renderer;

* Constructor. Used primarily to auto-wire dependencies.
* @param renderer
* Velocity rendering service used to render our custom template.
public KalturaWidgetRenderer(
final VelocityRenderService renderer) {
this.renderer = renderer;

* Returns the HTML to embed on the Confluence page.
* @param url
* Incoming URL for the Kaltura video
* @param params
* Velocity parameters (pre-populated with standard Confluence variables)
public String getEmbeddedHtml(
final String url,
final Map<String, String> params) {

String[] urlSegments = url.split("/");
String videoId = "";
if (urlSegments.length > 1) {
videoId = urlSegments[(urlSegments.length - 1)];
} else {
params.put("error", "Invalid source URL: " + url);
for(int i=0;i<urlSegments.length;i++){
System.out.println("url "+i+urlSegments[i]);
params.put(VelocityRenderService.TEMPLATE_PARAM, "templates/kaltura.vm");
params.put("videoId", videoId);
params.put("playerId", "kaltura_player_" + UUID.randomUUID().toString());
params.put("videoSrcId", "1_swpunaa5");

// For preview without width/height specified, default to 320x200
if (params.get("width") == null) {
params.put("width", "320");
if (params.get("height") == null) {
params.put("height", "200");
System.out.println("render "+renderer.render(url, params));
return renderer.render(url, params);

* @returns 'true if the incoming URL matches ''
* (anywhere in it).
public boolean matches(
final String url) {
return url.contains("");

my kaltura.vm is

<iframe id="$playerId"
src="$playerId&entry_id=$videoId&flashvars[streamerType]=auto&amp;flashvars[localizationCode]=en&amp;flashvars[leadWithHTML5]=true&amp;flashvars[sideBarContainer.plugin]=true&amp;flashvars[sideBarContainer.position]=left&amp;flashvars[sideBarContainer.clickToClose]=true&amp;flashvars[chapters.plugin]=true&amp;flashvars[chapters.layout]=vertical&amp;flashvars[chapters.thumbnailRotator]=false&amp;flashvars[streamSelector.plugin]=true&amp;flashvars[EmbedPlayer.SpinnerTarget]=videoHolder&amp;flashvars[dualScreen.plugin]=true&amp;&wid=$videoSrcId" width=$width height=$height allowfullscreen webkitallowfullscreen mozAllowFullScreen frameborder="0" title="Kaltura Player">

 With this code am able to play few kaltura videos.

0 votes

Hi Shankar,

I'm not clear on what it is you're asking.

Are you asking how to add an iFrame into a Confluence page? Or do you require something more specific? 

Please elaborate on what we can help you with and we'll be happy to assist.

Kind Regards,

Hi Shannon,

I pasted the kaltura url in the confluence, my code is able to auto convert that url into widget macro.

When I publish the page, i cant view the thumbnail of the video. It looks like below.


I observed the code on the UI, the div tag is formed as 

<div class="widget-error">    <span class="widget-link"></span></div></div>

When I edit the html on UI to the below format, am able to see the kaltura thumbnail and able to play the video.

<iframe class="conf-macro output-block" type="text/html" style="width: 400px; height: 300px" src="" frameborder="0" data-hasbody="false" data-macro-name="widget"></iframe>

I dont want to use available html macro plugin to be enabled manually. I want to handle this framing the div tag in java code.

I found class, from confluence source code, which forms the "widget-error" class.

Similarly, I am looking for a java class which can render the above iframe tag as response.

It would be great to have a Kaltura macro / plugin available...!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

926 views 47 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you