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.
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)
*/
@Override
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 'kaltura.com'
* (anywhere in it).
*/
@Override
public boolean matches(
final String url) {
return url.contains("kaltura.com");
}
my kaltura.vm is
<iframe id="$playerId"
src="https://cdnapisec.kaltura.com/p/2286491/sp/228649100/embedIframeJs/uiconf_id/39478542/partner_id/2286491?iframeembed=true&playerId=$playerId&entry_id=$videoId&flashvars[streamerType]=auto&flashvars[localizationCode]=en&flashvars[leadWithHTML5]=true&flashvars[sideBarContainer.plugin]=true&flashvars[sideBarContainer.position]=left&flashvars[sideBarContainer.clickToClose]=true&flashvars[chapters.plugin]=true&flashvars[chapters.layout]=vertical&flashvars[chapters.thumbnailRotator]=false&flashvars[streamSelector.plugin]=true&flashvars[EmbedPlayer.SpinnerTarget]=videoHolder&flashvars[dualScreen.plugin]=true&&wid=$videoSrcId" width=$width height=$height allowfullscreen webkitallowfullscreen mozAllowFullScreen frameborder="0" title="Kaltura Player">
</iframe>
With this code am able to play few kaltura videos.
It would be great to have a Kaltura macro / plugin available...!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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,
Shannon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
>rcsaas.mediaspace.kaltura.com</
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
=
"https://rcsaas.mediaspace.kaltura.com/media/Summer+Roses/0_t4ba0g3c/75994502"
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 ViewMacroErrorPlaceholderImpl.java 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.