cancel
Showing results for 
Search instead for 
Did you mean: 

Can you play videos with Alfresco?

zebra
Champ in-the-making
Champ in-the-making
Hello everyone,

I discover now Alfresco and I wonder if it is possible to play streaming videos from the interface of Alfresco share.

Thank you in advance for your answers.
33 REPLIES 33

zaizi
Champ in-the-making
Champ in-the-making
Yes.

You'll need to do some custom configuration. Change the default preview page to load a video player such as http://flowplayer.org/. They can then progressively download flv files from Alfresco. You can also configure ffmpeg (http://ffmpeg.org/) to convert video files to flv using http://wiki.alfresco.com/wiki/Content_Transformations.

zebra
Champ in-the-making
Champ in-the-making
Thanks a lot for your answer, I'll see that.

zebra
Champ in-the-making
Champ in-the-making
I tried to change the webpreviewer per the flowplayer but it don’t work. How do you do for custom this page. If it works, can I preview all documents .doc, .pdf, and .flv ?

Otherwise, it may be easier to put videos in the blog or wiki and customize TinyMCE.

Can you help me?

Best regards.

zaizi
Champ in-the-making
Champ in-the-making
Modify web-preview.get.html.ftl to check the mime-type of the content to render the Alfresco Web Preview component or Flowplayer.

zebra
Champ in-the-making
Champ in-the-making
I did a little customization of web-preview.get.html.ftl file. I do not know if it is good practice, but it works.


<#if (node?exists)>
<script type="text/javascript">//<![CDATA[
new Alfresco.WebPreview("${args.htmlid}").setOptions(
{
   nodeRef: "${node.nodeRef}",
   name: "${node.name?js_string}",
   icon: "${node.icon}",
   mimeType: "${node.mimeType}",
   previews: [<#list node.previews as p>"${p}"<#if (p_has_next)>, </#if></#list>]
}).setMessages(
   ${messages}
      );
//]]></script>
</#if>
<div class="web-preview">
   <div class="hd">
      <div class="title">
         <h4>
            <img id="${args.htmlid}-title-img" src="${url.context}/components/images/generic-file-32.png" alt="File" />
            <span id="${args.htmlid}-title-span"></span>           
         </h4>
      </div>
   </div>
   <div class="bd">
   <p>${page.url.context}/proxy/alfresco-feed/api/node/content/workspace/SpacesStore/${node.nodeRef?substring(24)}/${node.name?html}?a=true</p>
      
      <#if node.mimeType == "video/x-flv">
      

      <!– this A tag is where your Flowplayer will be placed. it can be anywhere –>
      <a 
          href="${page.url.context}/proxy/alfresco-feed/api/node/content/workspace/SpacesStore/${node.nodeRef?substring(24)}/${node.name?html}?a=true" 
          style="display:block;width:520px;height:330px" 
          id="player">
      </a>
   
      <!– this will install flowplayer inside previous A- tag. –>
      <script>
         flowplayer("player", "${page.url.context}/components/preview/flowplayer-3.1.1.swf");
      </script>
      
     <#else>
     <div id="${args.htmlid}-shadow-swf-div" class="preview-swf">
         <div id="${args.htmlid}-swfPlayerMessage-div"></div>
      </div>
     </#if>
   </div>
</div>

Best regards.

zebra
Champ in-the-making
Champ in-the-making
Now, I try to configure ffmpeg to convert flv to wmv file.
I put the Ffmpeg folder in the Alfresco root , I added the bin folder in the path.
I created a file my-transformers-context.xml with the following script:


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<bean id="transformer.ffmpeg.WMVtoFLV" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformer" parent="baseContentTransformer">
   <!– <property name="checkCommand">
      <bean class="org.alfresco.util.exec.RuntimeExec">
         <property name="commandMap">
            <map>
               <entry key=".*">
                  <value>ffmpeg -h</value>
               </entry>
                </map>
         </property>
            <property name="errorCodes">
            <value>2</value>
         </property>
      </bean>
   </property> –>
   <property name="transformCommand">
      <bean class="org.alfresco.util.exec.RuntimeExec">
         <property name="commandMap">
            <map>
               <entry key="Linux">
                  <value>ffmpeg -i '${source}' -vcodec flv -ar 44100 -ab 32 -b 800k '${target}'</value>
               </entry>
               <entry key="Windows.*">
                  <value>ffmpeg -i '${source}' -vcodec flv -ar 44100 -ab 32 -b 800k '${target}'</value>
               </entry>
            </map>
         </property>
         <property name="errorCodes">
            <value>2</value>
         </property>
      </bean>
   </property>
   <property name="explicitTransformations">
      <list>
         <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
            <property name="sourceMimetype"><value>video/x-ms-wmv</value></property>
            <property name="targetMimetype"><value>video/x-flv</value></property>
         </bean>
      </list>
   </property>
</bean>

But I have the following error in starting Alfresco.


16:52:07,411 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:alfresco/application-context.xml]
Offending resource: ServletContext resource [/WEB-INF/web-application-context.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:alfresco/extension/*-context.xml]
Offending resource: class path resource [alfresco/application-context.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 4 in XML document from file [C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension\my-transformers-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "bean", must match DOCTYPE root "beans".
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:alfresco/extension/*-context.xml]
Offending resource: class path resource [alfresco/application-context.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 4 in XML document from file [C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension\my-transformers-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "bean", must match DOCTYPE root "beans".
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 4 in XML document from file [C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension\my-transformers-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "bean", must match DOCTYPE root "beans".
Caused by: org.xml.sax.SAXParseException: Document root element "bean", must match DOCTYPE root "beans".
   at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
   at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
   at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
   at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
   at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:73)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:361)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:171)
   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:145)
   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:130)
   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:468)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:363)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:171)
   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:145)
   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:130)
   at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:468)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:363)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
   at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
   at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
   at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
   at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:394)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:324)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
   at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:69)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
   at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:516)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

Thank you in advance

Best regards

mikeh
Star Contributor
Star Contributor
The error contains the solution: you're missing a wrapper element, "<beans>"

Mike

a_thakur
Champ in-the-making
Champ in-the-making
A 'sneaky' way to solve this in v3.2 would be inserting a webview dashlet and uploading your video elsewhere  :wink:

zebra
Champ in-the-making
Champ in-the-making
I just saw in the path "share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components" a content-viewer folder with inside different templates (video, audio, test …). How can I activate these templates?

Best regards