Wednesday, November 10, 2010

I Want to Watch Videos in Liferay! Part I

So you want to create a portlet that runs in Liferay 5.2 that will play videos stored in your Document Library.

There are a series of hurdles that you'll have to overcome to be able to do this, however. Nothing too horrible, but it's easy to underestimate what a pain it can be.

First, Liferay is kind of picky about what kinds of files can be uploaded into it. By default it won't accept videos of certain formats and the file size is fairly limited anyway. Luckily, this is an easy fix.

Do you have a portal-ext.properties file in your Liferay home directory? No? Create one. If you don't know what this file is for, it's a configuration file that will override the settings that are in Liferay by default. Create the empty file, name it portal-ext.properties, and add the following line to it:

dl.file.max.size=3072000

This will give you more maneuvering room for uploading videos. You can set that to whatever value is best for your project.

Next, you have to tell Liferay what file formats to accept. Add this line:

dl.file.extensions=.bmp,.css,.doc,.dot,.gif,.gz,.htm,.html,.jpg,.js,.lar,.odb,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.ppt,.rtf,.swf,.sxc,.sxi,.sxw,.tar,.tiff,.tgz,.txt,.vsd,.xls,.xml,.zip,.avi,.mov,.wmv

Make sure you have no carriage returns in that file if you're copying and pasting this! If you wind up with newlines in that parameter list it'll ignore everything after it.

Now restart Liferay.

You should now be able to upload video files with the above formats into your Document Library.

Not too bad, eh?

No comments:

Post a Comment