Skip to content

Instantly share code, notes, and snippets.

@trieloff
Created November 26, 2010 15:52
Show Gist options
  • Save trieloff/716879 to your computer and use it in GitHub Desktop.
Save trieloff/716879 to your computer and use it in GitHub Desktop.
<%--
Youtube Video component.
--%><%
%><%@include file="/libs/foundation/global.jsp"%><%
%><%@page session="false" import="com.day.cq.wcm.foundation.forms.FormsHelper" %><%
%><%
if (!FormsHelper.isReadOnly(slingRequest, resource)) {
%><cq:include path="." resourceType="foundation/components/form/text"/><%
} else {
String[] values = FormsHelper.getValues(slingRequest, resource);
if (values != null) {
String id = values[0].replaceAll(".*v=([0-9a-zA-Z]+)&?.*","$1");
%>
<object width="640" height="385">
<param name="movie" value="http://www.youtube.com/v/<%=id%>?fs=1&amp;hl=en_US"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/<%=id%>?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed>
</object>
<%
}
}
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment